* [PATCH v3] net: net_failover: Fix the deadlock in slave register
@ 2026-05-07 7:43 faicker.mo
2026-05-08 22:18 ` Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: faicker.mo @ 2026-05-07 7:43 UTC (permalink / raw)
To: faicker.mo
Cc: kuba, Sridhar Samudrala, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Stanislav Fomichev,
netdev, linux-kernel
From: Faicker Mo <faicker.mo@gmail.com>
There is netdev_lock_ops() before the NETDEV_REGISTER notifier
in register_netdevice(), so use the non-locking functions
in net_failover_slave_register().
Call Trace:
<TASK>
__schedule+0x30d/0x7a0
schedule+0x27/0x90
schedule_preempt_disabled+0x15/0x30
__mutex_lock.constprop.0+0x538/0x9e0
__mutex_lock_slowpath+0x13/0x20
mutex_lock+0x3b/0x50
dev_set_mtu+0x40/0xe0
net_failover_slave_register+0x24/0x280
failover_slave_register+0x103/0x1b0
failover_event+0x15e/0x210
? dropmon_net_event+0xac/0xe0
notifier_call_chain+0x5e/0xe0
raw_notifier_call_chain+0x16/0x30
call_netdevice_notifiers_info+0x52/0xa0
register_netdevice+0x5f4/0x7c0
register_netdev+0x1e/0x40
_mlx5e_probe+0xe2/0x370 [mlx5_core]
mlx5e_probe+0x59/0x70 [mlx5_core]
? __pfx_mlx5e_probe+0x10/0x10 [mlx5_core]
Fixes: 4c975fd70002 ("net: hold instance lock during NETDEV_REGISTER/UP")
Signed-off-by: Faicker Mo <faicker.mo@gmail.com>
---
Changes since v1:
- Fix the space chars (Simon)
- Change the dev_close to netif_close (Simon)
- Change the label err_dev_open to err_netif_open
Changes since v2:
- Add lock ops in failover_existing_slave_register (Jakub Kicinski)
---
drivers/net/net_failover.c | 12 ++++++------
net/core/failover.c | 5 ++++-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
index d0361aaf25ef..3f7d31033bae 100644
--- a/drivers/net/net_failover.c
+++ b/drivers/net/net_failover.c
@@ -502,7 +502,7 @@ static int net_failover_slave_register(struct net_device *slave_dev,
/* Align MTU of slave with failover dev */
orig_mtu = slave_dev->mtu;
- err = dev_set_mtu(slave_dev, failover_dev->mtu);
+ err = netif_set_mtu(slave_dev, failover_dev->mtu);
if (err) {
netdev_err(failover_dev, "unable to change mtu of %s to %u register failed\n",
slave_dev->name, failover_dev->mtu);
@@ -512,11 +512,11 @@ static int net_failover_slave_register(struct net_device *slave_dev,
dev_hold(slave_dev);
if (netif_running(failover_dev)) {
- err = dev_open(slave_dev, NULL);
+ err = netif_open(slave_dev, NULL);
if (err && (err != -EBUSY)) {
netdev_err(failover_dev, "Opening slave %s failed err:%d\n",
slave_dev->name, err);
- goto err_dev_open;
+ goto err_netif_open;
}
}
@@ -562,10 +562,10 @@ static int net_failover_slave_register(struct net_device *slave_dev,
err_vlan_add:
dev_uc_unsync(slave_dev, failover_dev);
dev_mc_unsync(slave_dev, failover_dev);
- dev_close(slave_dev);
-err_dev_open:
+ netif_close(slave_dev);
+err_netif_open:
dev_put(slave_dev);
- dev_set_mtu(slave_dev, orig_mtu);
+ netif_set_mtu(slave_dev, orig_mtu);
done:
return err;
}
diff --git a/net/core/failover.c b/net/core/failover.c
index 11bb183c7a1b..122fbcbf915a 100644
--- a/net/core/failover.c
+++ b/net/core/failover.c
@@ -221,8 +221,11 @@ failover_existing_slave_register(struct net_device *failover_dev)
for_each_netdev(net, dev) {
if (netif_is_failover(dev))
continue;
- if (ether_addr_equal(failover_dev->perm_addr, dev->perm_addr))
+ if (ether_addr_equal(failover_dev->perm_addr, dev->perm_addr)) {
+ netdev_lock_ops(dev);
failover_slave_register(dev);
+ netdev_unlock_ops(dev);
+ }
}
rtnl_unlock();
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v3] net: net_failover: Fix the deadlock in slave register
2026-05-07 7:43 [PATCH v3] net: net_failover: Fix the deadlock in slave register faicker.mo
@ 2026-05-08 22:18 ` Jakub Kicinski
2026-05-13 3:58 ` kernel test robot
2026-05-13 4:18 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-05-08 22:18 UTC (permalink / raw)
To: faicker.mo
Cc: Sridhar Samudrala, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Stanislav Fomichev, netdev,
linux-kernel
On Thu, 7 May 2026 15:43:32 +0800 faicker.mo@gmail.com wrote:
> There is netdev_lock_ops() before the NETDEV_REGISTER notifier
> in register_netdevice(), so use the non-locking functions
> in net_failover_slave_register().
net/core/failover.c:227:25: error: implicit declaration of function ‘netdev_unlock_ops’; did you mean ‘netdev_unlock’? [-Wimplicit-function-declaration]
227 | netdev_unlock_ops(dev);
| ^~~~~~~~~~~~~~~~~
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3] net: net_failover: Fix the deadlock in slave register
2026-05-07 7:43 [PATCH v3] net: net_failover: Fix the deadlock in slave register faicker.mo
2026-05-08 22:18 ` Jakub Kicinski
@ 2026-05-13 3:58 ` kernel test robot
2026-05-13 4:18 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-05-13 3:58 UTC (permalink / raw)
To: faicker.mo
Cc: llvm, oe-kbuild-all, kuba, Sridhar Samudrala, Andrew Lunn,
Eric Dumazet, Paolo Abeni, Simon Horman, Stanislav Fomichev,
netdev, linux-kernel
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v7.1-rc3 next-20260508]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/faicker-mo-gmail-com/net-net_failover-Fix-the-deadlock-in-slave-register/20260513-045805
base: net-next/main
patch link: https://lore.kernel.org/r/20260507074332.2543229-1-faicker.mo%40gmail.com
patch subject: [PATCH v3] net: net_failover: Fix the deadlock in slave register
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20260513/202605131116.TbbaiahQ-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260513/202605131116.TbbaiahQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605131116.TbbaiahQ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> net/core/failover.c:225:4: error: call to undeclared function 'netdev_lock_ops'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
225 | netdev_lock_ops(dev);
| ^
net/core/failover.c:225:4: note: did you mean 'netdev_lock'?
include/linux/netdevice.h:2822:20: note: 'netdev_lock' declared here
2822 | static inline void netdev_lock(struct net_device *dev)
| ^
>> net/core/failover.c:227:4: error: call to undeclared function 'netdev_unlock_ops'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
227 | netdev_unlock_ops(dev);
| ^
2 errors generated.
vim +/netdev_lock_ops +225 net/core/failover.c
213
214 static void
215 failover_existing_slave_register(struct net_device *failover_dev)
216 {
217 struct net *net = dev_net(failover_dev);
218 struct net_device *dev;
219
220 rtnl_lock();
221 for_each_netdev(net, dev) {
222 if (netif_is_failover(dev))
223 continue;
224 if (ether_addr_equal(failover_dev->perm_addr, dev->perm_addr)) {
> 225 netdev_lock_ops(dev);
226 failover_slave_register(dev);
> 227 netdev_unlock_ops(dev);
228 }
229 }
230 rtnl_unlock();
231 }
232
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3] net: net_failover: Fix the deadlock in slave register
2026-05-07 7:43 [PATCH v3] net: net_failover: Fix the deadlock in slave register faicker.mo
2026-05-08 22:18 ` Jakub Kicinski
2026-05-13 3:58 ` kernel test robot
@ 2026-05-13 4:18 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-05-13 4:18 UTC (permalink / raw)
To: faicker.mo
Cc: oe-kbuild-all, kuba, Sridhar Samudrala, Andrew Lunn, Eric Dumazet,
Paolo Abeni, Simon Horman, Stanislav Fomichev, netdev,
linux-kernel
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v7.1-rc3 next-20260508]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/faicker-mo-gmail-com/net-net_failover-Fix-the-deadlock-in-slave-register/20260513-045805
base: net-next/main
patch link: https://lore.kernel.org/r/20260507074332.2543229-1-faicker.mo%40gmail.com
patch subject: [PATCH v3] net: net_failover: Fix the deadlock in slave register
config: i386-randconfig-141-20260513 (https://download.01.org/0day-ci/archive/20260513/202605131216.7sSRq0Gy-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260513/202605131216.7sSRq0Gy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605131216.7sSRq0Gy-lkp@intel.com/
All errors (new ones prefixed by >>):
net/core/failover.c: In function 'failover_existing_slave_register':
>> net/core/failover.c:225:25: error: implicit declaration of function 'netdev_lock_ops'; did you mean 'netdev_lock'? [-Wimplicit-function-declaration]
225 | netdev_lock_ops(dev);
| ^~~~~~~~~~~~~~~
| netdev_lock
>> net/core/failover.c:227:25: error: implicit declaration of function 'netdev_unlock_ops'; did you mean 'netdev_unlock'? [-Wimplicit-function-declaration]
227 | netdev_unlock_ops(dev);
| ^~~~~~~~~~~~~~~~~
| netdev_unlock
vim +225 net/core/failover.c
213
214 static void
215 failover_existing_slave_register(struct net_device *failover_dev)
216 {
217 struct net *net = dev_net(failover_dev);
218 struct net_device *dev;
219
220 rtnl_lock();
221 for_each_netdev(net, dev) {
222 if (netif_is_failover(dev))
223 continue;
224 if (ether_addr_equal(failover_dev->perm_addr, dev->perm_addr)) {
> 225 netdev_lock_ops(dev);
226 failover_slave_register(dev);
> 227 netdev_unlock_ops(dev);
228 }
229 }
230 rtnl_unlock();
231 }
232
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-13 4:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 7:43 [PATCH v3] net: net_failover: Fix the deadlock in slave register faicker.mo
2026-05-08 22:18 ` Jakub Kicinski
2026-05-13 3:58 ` kernel test robot
2026-05-13 4:18 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox