mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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: 0d5501c1c8
("net: Always untag vlan-tagged traffic on input.")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f8414a8d88
commit
55eff0eb74
@ -5418,8 +5418,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
|
||||
skb = skb_share_check(skb, GFP_ATOMIC);
|
||||
if (unlikely(!skb))
|
||||
goto err_free;
|
||||
|
||||
if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
|
||||
/* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
|
||||
if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
|
||||
goto err_free;
|
||||
|
||||
vhdr = (struct vlan_hdr *)skb->data;
|
||||
|
Loading…
Reference in New Issue
Block a user