提交 33a0af92 编写于 作者: C Cong Wang 提交者: Yang Yingliang

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

stable inclusion
from linux-4.19.135
commit 6ca307f3fa591bc29b67356a501d3de4b106399c

--------------------------------

[ Upstream commit c75d1d52 ]

Very similar to commit 544f287b
("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: 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: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NLi Aichun <liaichun@huawei.com>
Reviewed-by: Nguodeqing <geffrey.guo@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a83f175c
...@@ -451,11 +451,10 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev, ...@@ -451,11 +451,10 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
return err; return err;
err = register_netdevice(bond_dev); err = register_netdevice(bond_dev);
netif_carrier_off(bond_dev);
if (!err) { if (!err) {
struct bonding *bond = netdev_priv(bond_dev); struct bonding *bond = netdev_priv(bond_dev);
netif_carrier_off(bond_dev);
bond_work_init_all(bond); bond_work_init_all(bond);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册