Skip to content

Commit f90615a

Browse files
vladimirolteandavem330
authored andcommitted
net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set
This is a preparatory change for the deletion of skb_reset_mac_header(skb) from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will no longer be set in TX paths, from which __vlan_insert_inner_tag() can still be called (perhaps indirectly). If we don't make this change, then an unset MAC header (equal to ~0U) will become set after the adjustment with VLAN_HLEN. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4d2bd25 commit f90615a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

include/linux/if_vlan.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb,
351351
/* Move the mac header sans proto to the beginning of the new header. */
352352
if (likely(mac_len > ETH_TLEN))
353353
memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN);
354-
skb->mac_header -= VLAN_HLEN;
354+
if (skb_mac_header_was_set(skb))
355+
skb->mac_header -= VLAN_HLEN;
355356

356357
veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN);
357358

0 commit comments

Comments
 (0)