lkml.org 
[lkml]   [2009]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[57/90] vlan: Fix register_vlan_dev() error path
    2.6.31-stable review patch.  If anyone has any objections, please let us know.

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


    From: Eric Dumazet <eric.dumazet@gmail.com>

    [ Upstream commit 6b863d1d3239eff0f45c2e6e672f5b56db828db0 ]

    In case register_netdevice() returns an error, and a new vlan_group
    was allocated and inserted in vlan_group_hash[] we call
    vlan_group_free() without deleting group from hash table. Future
    lookups can give infinite loops or crashes.

    We must delete the vlan_group using RCU safe procedure.

    Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    net/8021q/vlan.c | 7 +++++--
    1 file changed, 5 insertions(+), 2 deletions(-)

    --- a/net/8021q/vlan.c
    +++ b/net/8021q/vlan.c
    @@ -287,8 +287,11 @@ out_uninit_applicant:
    if (ngrp)
    vlan_gvrp_uninit_applicant(real_dev);
    out_free_group:
    - if (ngrp)
    - vlan_group_free(ngrp);
    + if (ngrp) {
    + hlist_del_rcu(&ngrp->hlist);
    + /* Free the group, after all cpu's are done. */
    + call_rcu(&ngrp->rcu, vlan_rcu_free);
    + }
    return err;
    }




    \
     
     \ /
      Last update: 2009-12-17 02:37    [W:0.039 / U:62.332 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site