mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
8021q: fix a potential memory leak
[ Upstream commit 916c1689a0 ]
skb_cow called in vlan_reorder_header does not free the skb when it failed,
and vlan_reorder_header returns NULL to reset original skb when it is called
in vlan_untag, lead to a memory leak.
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e9013d0f0f
commit
1b56220b0d
|
|
@ -103,8 +103,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_id);
|
|||
|
||||
static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
|
||||
{
|
||||
if (skb_cow(skb, skb_headroom(skb)) < 0)
|
||||
if (skb_cow(skb, skb_headroom(skb)) < 0) {
|
||||
kfree_skb(skb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
|
||||
skb->mac_header += VLAN_HLEN;
|
||||
return skb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user