Skip to content

Commit 55eff0e

Browse files
MiaoheLindavem330
authored andcommitted
net: Fix potential wrong skb->protocol in skb_vlan_untag()
We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). So we should pull VLAN_HLEN + sizeof(unsigned short) in skb_vlan_untag() or we may access the wrong data. Fixes: 0d5501c ("net: Always untag vlan-tagged traffic on input.") Signed-off-by: Miaohe Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f8414a8 commit 55eff0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/skbuff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5418,8 +5418,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
54185418
skb = skb_share_check(skb, GFP_ATOMIC);
54195419
if (unlikely(!skb))
54205420
goto err_free;
5421-
5422-
if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
5421+
/* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
5422+
if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
54235423
goto err_free;
54245424

54255425
vhdr = (struct vlan_hdr *)skb->data;

0 commit comments

Comments
 (0)