mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
bonding: fix a potential double-unregister
[ Upstream commit8327070216] When we tear down a network namespace, we unregister all the netdevices within it. So we may queue a slave device and a bonding device together in the same unregister queue. If the only slave device is non-ethernet, it would automatically unregister the bonding device as well. Thus, we may end up unregistering the bonding device twice. Workaround this special case by checking reg_state. Fixes:9b5e383c11("net: Introduce unregister_netdevice_many()") Reported-by: syzbot+af23e7f3e0a7e10c8b67@syzkaller.appspotmail.com Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Andy Gospodarek <andy@greyhouse.net> Cc: Jay Vosburgh <j.vosburgh@gmail.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c6a15d151e
commit
8512aaa957
@@ -1985,7 +1985,8 @@ static int bond_release_and_destroy(struct net_device *bond_dev,
|
||||
int ret;
|
||||
|
||||
ret = bond_release(bond_dev, slave_dev);
|
||||
if (ret == 0 && !bond_has_slaves(bond)) {
|
||||
if (ret == 0 && !bond_has_slaves(bond) &&
|
||||
bond_dev->reg_state != NETREG_UNREGISTERING) {
|
||||
bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
|
||||
netdev_info(bond_dev, "Destroying bond %s\n",
|
||||
bond_dev->name);
|
||||
|
||||
Reference in New Issue
Block a user