Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ca307f3 authored by Cong Wang's avatar Cong Wang Committed by Greg Kroah-Hartman
Browse files

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: 005db31d ("bonding: set carrier off for devices created through netlink")
Reported-and-tested-by: default avatar <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: 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>
parent 6c3f2d34
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);
	}