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.31.9~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5ad94d1e45df0cc29918fb5309ef85b99fc58c5;p=thirdparty%2Fkernel%2Fstable.git vlan: Fix register_vlan_dev() error path [ 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index fe649081fbdcc..db09b94663542 100644 --- 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; }