diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2014-06-18 13:46:02 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-08-06 18:07:38 +0100 |
commit | 96f641a7191379fef452609959ce0dc5009d021b (patch) | |
tree | 30f14273a794f05ac5e18949d3ca3c7402bfdbf2 | |
parent | 94fb7252513be0f7b3aa96ae03dce9e071c5dccd (diff) |
8021q: fix a potential memory leak
[ Upstream commit 916c1689a09bc1ca81f2d7a34876f8d35aadd11b ]
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: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | net/8021q/vlan_core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index e860a4fdcbe..77d3532745c 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -96,8 +96,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; |