Commit 3ec8e9f0 authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller

bridge: Correctly unregister MDB rtnetlink handlers

Commit 63233159:
    bridge: Do not unregister all PF_BRIDGE rtnl operations
introduced a bug where a removal of a single bridge from a
multi-bridge system would remove MDB netlink handlers.
The handlers should only be removed once all bridges are gone, but
since we don't keep track of the number of bridge interfaces, it's
simpler to do it when the bridge module is unloaded.  To make it
consistent, move the registration code into module initialization
code path.
Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 612a7c4e
...@@ -1608,7 +1608,6 @@ void br_multicast_init(struct net_bridge *br) ...@@ -1608,7 +1608,6 @@ void br_multicast_init(struct net_bridge *br)
br_multicast_querier_expired, (unsigned long)br); br_multicast_querier_expired, (unsigned long)br);
setup_timer(&br->multicast_query_timer, br_multicast_query_expired, setup_timer(&br->multicast_query_timer, br_multicast_query_expired,
(unsigned long)br); (unsigned long)br);
br_mdb_init();
} }
void br_multicast_open(struct net_bridge *br) void br_multicast_open(struct net_bridge *br)
...@@ -1633,7 +1632,6 @@ void br_multicast_stop(struct net_bridge *br) ...@@ -1633,7 +1632,6 @@ void br_multicast_stop(struct net_bridge *br)
del_timer_sync(&br->multicast_querier_timer); del_timer_sync(&br->multicast_querier_timer);
del_timer_sync(&br->multicast_query_timer); del_timer_sync(&br->multicast_query_timer);
br_mdb_uninit();
spin_lock_bh(&br->multicast_lock); spin_lock_bh(&br->multicast_lock);
mdb = mlock_dereference(br->mdb, br); mdb = mlock_dereference(br->mdb, br);
if (!mdb) if (!mdb)
......
...@@ -299,10 +299,21 @@ struct rtnl_link_ops br_link_ops __read_mostly = { ...@@ -299,10 +299,21 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
int __init br_netlink_init(void) int __init br_netlink_init(void)
{ {
return rtnl_link_register(&br_link_ops); int err;
br_mdb_init();
err = rtnl_link_register(&br_link_ops);
if (err)
goto out;
return 0;
out:
br_mdb_uninit();
return err;
} }
void __exit br_netlink_fini(void) void __exit br_netlink_fini(void)
{ {
br_mdb_uninit();
rtnl_link_unregister(&br_link_ops); rtnl_link_unregister(&br_link_ops);
} }
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