From: Taehee Yoo <[email protected]>
Date: Sun, 19 Jul 2020 12:11:24 +0000
> If register_netdevice() is failed, net_device should not be used
> because variables are uninitialized or freed.
> So, the routine should be stopped immediately.
> But, bond_create() doesn't check return value of register_netdevice()
> immediately. That will result in a panic because of using uninitialized
> or freed memory.
>
> Test commands:
> modprobe netdev-notifier-error-inject
> echo -22 > /sys/kernel/debug/notifier-error-inject/netdev/\
> actions/NETDEV_REGISTER/error
> modprobe bonding max_bonds=3
>
> Splat looks like:
...
> Fixes: e826eafa65c6 ("bonding: Call netif_carrier_off after
> register_netdevice")
> Signed-off-by: Taehee Yoo <[email protected]>
Applied and queued up for -stable, thank you.