• Cong Wang's avatar
    bonding: fix a potential double-unregister · 8dcf1889
    Cong Wang authored
    [ Upstream commit 83270702 ]
    
    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: 9b5e383c ("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: default avatarCong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    8dcf1889
bond_main.c 137 KB