diff options
| author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-11-17 09:45:04 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-11-17 09:45:04 -0500 |
| commit | 6b863d1d3239eff0f45c2e6e672f5b56db828db0 (patch) | |
| tree | 8384f6f29891d684725015e1dad5a96e6d9fb8fc | |
| parent | 69c0cab120a85471054614418b447349caba22d7 (diff) | |
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 <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/8021q/vlan.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 8836575f9d79..a29c5ab5815c 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
| @@ -281,8 +281,11 @@ out_uninit_applicant: | |||
| 281 | if (ngrp) | 281 | if (ngrp) |
| 282 | vlan_gvrp_uninit_applicant(real_dev); | 282 | vlan_gvrp_uninit_applicant(real_dev); |
| 283 | out_free_group: | 283 | out_free_group: |
| 284 | if (ngrp) | 284 | if (ngrp) { |
| 285 | vlan_group_free(ngrp); | 285 | hlist_del_rcu(&ngrp->hlist); |
| 286 | /* Free the group, after all cpu's are done. */ | ||
| 287 | call_rcu(&ngrp->rcu, vlan_rcu_free); | ||
| 288 | } | ||
| 286 | return err; | 289 | return err; |
| 287 | } | 290 | } |
| 288 | 291 | ||
