summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2020-07-23 02:31:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-29 08:42:54 +0300
commit96b61dc0ce8121f4f286eaf7301737853e1499a0 (patch)
tree931e1b6c095d313a0af6f58405458bc954dcf8fd /drivers
parenta48f663be2cd70971681ccf38e2f39bca53cc576 (diff)
downloadlinux-96b61dc0ce8121f4f286eaf7301737853e1499a0.tar.xz
bonding: check return value of register_netdevice() in bond_newlink()
[ Upstream commit c75d1d5248c0c97996051809ad0e9f154ba5d76e ] Very similar to commit 544f287b8495 ("bonding: check error value of register_netdevice() immediately"), we should immediately check the return value of register_netdevice() before doing anything else. Fixes: 005db31d5f5f ("bonding: set carrier off for devices created through netlink") Reported-and-tested-by: syzbot+bbc3a11c4da63c1b74d6@syzkaller.appspotmail.com Cc: Beniamino Galvani <bgalvani@redhat.com> Cc: Taehee Yoo <ap420073@gmail.com> 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bonding/bond_netlink.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 77babf1417a7..0e95eeb822ea 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -451,11 +451,10 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
return err;
err = register_netdevice(bond_dev);
-
- netif_carrier_off(bond_dev);
if (!err) {
struct bonding *bond = netdev_priv(bond_dev);
+ netif_carrier_off(bond_dev);
bond_work_init_all(bond);
}