bonding: fix bonding_masters race condition in bond unloading
authornikolay@redhat.com <nikolay@redhat.com>
Sat, 6 Apr 2013 00:54:38 +0000 (00:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2013 20:45:09 +0000 (16:45 -0400)
commit69b0216ac255f523556fa3d4ff030d857eaaa37f
tree45138d6eae10f05815b353556fa62d57ceea35db
parentffcdedb667b6db8ee31c7efa76a3ec59d9c3b0fc
bonding: fix bonding_masters race condition in bond unloading

While the bonding module is unloading, it is considered that after
rtnl_link_unregister all bond devices are destroyed but since no
synchronization mechanism exists, a new bond device can be created
via bonding_masters before unregister_pernet_subsys which would
lead to multiple problems (e.g. NULL pointer dereference, wrong RIP,
list corruption).

This patch fixes the issue by removing any bond devices left in the
netns after bonding_masters is removed from sysfs.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Acked-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c