]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
bonding: fix a potential double-unregister
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 15 Aug 2020 03:05:58 +0000 (20:05 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:13:26 +0000 (05:13 -0400)
commit7b0c1229c6f9b693d3872026dfa55f3002bc872e
treecdca17461419adb06f5595a56e2ab2ad33549fda
parent2002cfa3f3cd5b02e4f4cfb5a37d8b0058d39bd5
bonding: fix a potential double-unregister

BugLink: https://bugs.launchpad.net/bugs/1893115
[ Upstream commit 832707021666411d04795c564a4adea5d6b94f17 ]

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: 9b5e383c11b0 ("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: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/bonding/bond_main.c