Commit 6b863d1d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69c0cab1
...@@ -281,8 +281,11 @@ out_uninit_applicant: ...@@ -281,8 +281,11 @@ out_uninit_applicant:
if (ngrp) if (ngrp)
vlan_gvrp_uninit_applicant(real_dev); vlan_gvrp_uninit_applicant(real_dev);
out_free_group: out_free_group:
if (ngrp) if (ngrp) {
vlan_group_free(ngrp); hlist_del_rcu(&ngrp->hlist);
/* Free the group, after all cpu's are done. */
call_rcu(&ngrp->rcu, vlan_rcu_free);
}
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment