net: Fix potential wrong skb->protocol in skb_vlan_untag()
authorMiaohe Lin <linmiaohe@huawei.com>
Sat, 15 Aug 2020 08:44:31 +0000 (04:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:19:22 +0000 (11:19 +0200)
commitc40fc891ca6c7ada3b10e5c16593e6469d4dfa22
tree8398d09ecb672726a46c25513f73db0b1769c6a7
parent61b7ab3507b38377aade089bcc2ddd77d7115e72
net: Fix potential wrong skb->protocol in skb_vlan_untag()

[ Upstream commit 55eff0eb7460c3d50716ed9eccf22257b046ca92 ]

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: 0d5501c1c828 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/skbuff.c