Skip to contentSkip to conversation

bonding: check return value of register_netdevice() in bond_newlink()

PATCH In review Cong Wang 2 participants 2 messages Jul 22, 2020 – Jul 23, 2020

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 bonding: check return value of register_netdevice() in bond_newlink()

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 [email protected]
Cc Beniamino Galvani <[email protected]>
Cc Taehee Yoo <[email protected]>
Cc Jay Vosburgh <[email protected]>
---
 drivers/net/bonding/bond_netlink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bonding/bond_netlink.c +1 -2
index b43b51646b11..f0f9138e967f 100644
@@ -456,11 +456,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);
 	}
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw

From: Cong Wang <[email protected]>
Date: Wed, 22 Jul 2020 16:31:54 -0700

Quoted 11 lines

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 [email protected]
Cc Beniamino Galvani <[email protected]>
Cc Taehee Yoo <[email protected]>
Cc Jay Vosburgh <[email protected]>

Applied and queued up for -stable, thanks.