Skip to content

Commit a64d49c

Browse files
ebiedermdavem330
authored andcommitted
bonding: Manage /proc/net/bonding/ entries from the netdev events
It was recently reported that moving a bonding device between network namespaces causes warnings from /proc. It turns out after the move we were trying to add and to remove the /proc/net/bonding entries from the wrong network namespace. Move the bonding /proc registration code into the NETDEV_REGISTER and NETDEV_UNREGISTER events where the proc registration and unregistration will always happen at the right time. Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 684901a commit a64d49c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,6 +3227,12 @@ static int bond_master_netdev_event(unsigned long event,
32273227
switch (event) {
32283228
case NETDEV_CHANGENAME:
32293229
return bond_event_changename(event_bond);
3230+
case NETDEV_UNREGISTER:
3231+
bond_remove_proc_entry(event_bond);
3232+
break;
3233+
case NETDEV_REGISTER:
3234+
bond_create_proc_entry(event_bond);
3235+
break;
32303236
default:
32313237
break;
32323238
}
@@ -4411,8 +4417,6 @@ static void bond_uninit(struct net_device *bond_dev)
44114417

44124418
bond_work_cancel_all(bond);
44134419

4414-
bond_remove_proc_entry(bond);
4415-
44164420
bond_debug_unregister(bond);
44174421

44184422
__hw_addr_flush(&bond->mc_list);
@@ -4814,7 +4818,6 @@ static int bond_init(struct net_device *bond_dev)
48144818

48154819
bond_set_lockdep_class(bond_dev);
48164820

4817-
bond_create_proc_entry(bond);
48184821
list_add_tail(&bond->bond_list, &bn->dev_list);
48194822

48204823
bond_prepare_sysfs_group(bond);

0 commit comments

Comments
 (0)