From: Eric Dumazet Date: Tue, 17 Nov 2009 14:45:04 +0000 (-0800) Subject: vlan: Fix register_vlan_dev() error path X-Git-Tag: v2.6.32-rc8~10^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b863d1d3239eff0f45c2e6e672f5b56db828db0;p=platform%2Fkernel%2Flinux-stable.git vlan: Fix register_vlan_dev() error path 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 Signed-off-by: David S. Miller --- diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 8836575..a29c5ab 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -281,8 +281,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; }