Skip to content

Commit

Permalink
vlan: Fix register_vlan_dev() error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 17, 2009
1 parent 69c0cab commit 6b863d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ int register_vlan_dev(struct net_device *dev)
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;
}

Expand Down

0 comments on commit 6b863d1

Please sign in to comment.