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:22:23 +0000 (11:22 +0200)
commit5d28f39d847e75678901d9bb1f18a4cbd8bd7e60
tree8d0f60d90e7970aadc40cfa4c30b6f5d23615173
parent8d3dc7f94175c4a457e88a06ad871fc3e7bbfbe2
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