All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net] bonding: check return value of register_netdevice() in bond_newlink()
@ 2020-07-22 23:31 Cong Wang
  2020-07-23 22:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2020-07-22 23:31 UTC (permalink / raw)
  To: netdev
  Cc: Cong Wang, syzbot+bbc3a11c4da63c1b74d6, Beniamino Galvani,
	Taehee Yoo, Jay Vosburgh

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>
---
 drivers/net/bonding/bond_netlink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index b43b51646b11..f0f9138e967f 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -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);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch net] bonding: check return value of register_netdevice() in bond_newlink()
  2020-07-22 23:31 [Patch net] bonding: check return value of register_netdevice() in bond_newlink() Cong Wang
@ 2020-07-23 22:17 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-23 22:17 UTC (permalink / raw)
  To: xiyou.wangcong
  Cc: netdev, syzbot+bbc3a11c4da63c1b74d6, bgalvani, ap420073, j.vosburgh

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Wed, 22 Jul 2020 16:31:54 -0700

> 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>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 23:31 [Patch net] bonding: check return value of register_netdevice() in bond_newlink() Cong Wang
2020-07-23 22:17 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.