* [PATCH] bonding: allow nesting of bonding device
@ 2021-06-23 3:21 zhudi
2021-06-23 20:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: zhudi @ 2021-06-23 3:21 UTC (permalink / raw)
To: j.vosburgh, vfalico, kuba, davem, eric.dumazet
Cc: netdev, zhudi21, rose.chen, Jay Vosburgh
From: Di Zhu <zhudi21@huawei.com>
The commit 3c9ef511b9fa ("bonding: avoid adding slave device with
IFF_MASTER flag") fix a crash when add slave device with IFF_MASTER,
but it rejects the scenario of nested bonding device.
As Eric Dumazet described: since there indeed is a usage scenario about
nesting bonding, we should not break it.
So we add a new judgment condition to allow nesting of bonding device.
Fixes: 3c9ef511b9fa ("bonding: avoid adding slave device with IFF_MASTER flag")
Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Di Zhu <zhudi21@huawei.com>
---
drivers/net/bonding/bond_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 16840c9bc00d..03b1a93d7fea 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1601,7 +1601,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
int link_reporting;
int res = 0, i;
- if (slave_dev->flags & IFF_MASTER) {
+ if (slave_dev->flags & IFF_MASTER &&
+ !netif_is_bond_master(slave_dev)) {
+ NL_SET_ERR_MSG(extack, "Device with IFF_MASTER cannot be enslaved");
netdev_err(bond_dev,
"Error: Device with IFF_MASTER cannot be enslaved\n");
return -EPERM;
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bonding: allow nesting of bonding device
2021-06-23 3:21 [PATCH] bonding: allow nesting of bonding device zhudi
@ 2021-06-23 20:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-23 20:50 UTC (permalink / raw)
To: zhudi
Cc: j.vosburgh, vfalico, kuba, davem, eric.dumazet, netdev,
rose.chen, jay.vosburgh
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Wed, 23 Jun 2021 11:21:08 +0800 you wrote:
> From: Di Zhu <zhudi21@huawei.com>
>
> The commit 3c9ef511b9fa ("bonding: avoid adding slave device with
> IFF_MASTER flag") fix a crash when add slave device with IFF_MASTER,
> but it rejects the scenario of nested bonding device.
>
> As Eric Dumazet described: since there indeed is a usage scenario about
> nesting bonding, we should not break it.
>
> [...]
Here is the summary with links:
- bonding: allow nesting of bonding device
https://git.kernel.org/netdev/net/c/4d293fe1c69c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-23 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 3:21 [PATCH] bonding: allow nesting of bonding device zhudi
2021-06-23 20:50 ` patchwork-bot+netdevbpf
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.