Commit 3ec8e9f085bcaef0de1077f555c2c5102c223390
Committed by
David S. Miller
1 parent
612a7c4e73
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
bridge: Correctly unregister MDB rtnetlink handlers
Commit 63233159fd4e596568f5f168ecb0879b61631d47: 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: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 12 additions and 3 deletions Side-by-side Diff
net/bridge/br_multicast.c
... | ... | @@ -1608,7 +1608,6 @@ |
1608 | 1608 | br_multicast_querier_expired, (unsigned long)br); |
1609 | 1609 | setup_timer(&br->multicast_query_timer, br_multicast_query_expired, |
1610 | 1610 | (unsigned long)br); |
1611 | - br_mdb_init(); | |
1612 | 1611 | } |
1613 | 1612 | |
1614 | 1613 | void br_multicast_open(struct net_bridge *br) |
... | ... | @@ -1633,7 +1632,6 @@ |
1633 | 1632 | del_timer_sync(&br->multicast_querier_timer); |
1634 | 1633 | del_timer_sync(&br->multicast_query_timer); |
1635 | 1634 | |
1636 | - br_mdb_uninit(); | |
1637 | 1635 | spin_lock_bh(&br->multicast_lock); |
1638 | 1636 | mdb = mlock_dereference(br->mdb, br); |
1639 | 1637 | if (!mdb) |
net/bridge/br_netlink.c
... | ... | @@ -299,11 +299,22 @@ |
299 | 299 | |
300 | 300 | int __init br_netlink_init(void) |
301 | 301 | { |
302 | - return rtnl_link_register(&br_link_ops); | |
302 | + int err; | |
303 | + | |
304 | + br_mdb_init(); | |
305 | + err = rtnl_link_register(&br_link_ops); | |
306 | + if (err) | |
307 | + goto out; | |
308 | + | |
309 | + return 0; | |
310 | +out: | |
311 | + br_mdb_uninit(); | |
312 | + return err; | |
303 | 313 | } |
304 | 314 | |
305 | 315 | void __exit br_netlink_fini(void) |
306 | 316 | { |
317 | + br_mdb_uninit(); | |
307 | 318 | rtnl_link_unregister(&br_link_ops); |
308 | 319 | } |