lkml.org 
[lkml]   [2014]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.11 038/137] 8021q: fix a potential memory leak
    Date
    3.11.10.15 -stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Li RongQing <roy.qing.li@gmail.com>

    commit 916c1689a09bc1ca81f2d7a34876f8d35aadd11b upstream.

    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: Luis Henriques <luis.henriques@canonical.com>
    ---
    net/8021q/vlan_core.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
    index 6ee48aac776f..7e57135c7cc4 100644
    --- a/net/8021q/vlan_core.c
    +++ b/net/8021q/vlan_core.c
    @@ -108,8 +108,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;
    --
    1.9.1


    \
     
     \ /
      Last update: 2014-08-18 11:41    [W:4.192 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site