* [PATCH net] net: release netpoll dev_lock when NETDEV_PRE_UP vetoes an open
@ 2026-11-18 6:27 SeungJong Ha
0 siblings, 0 replies; only message in thread
From: SeungJong Ha @ 2026-11-18 6:27 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Neil Horman
Cc: netdev, linux-kernel, stable, SeungJong Ha
When netpoll is attached to a device, __dev_open() takes
npinfo->dev_lock through netpoll_poll_disable() before calling the
NETDEV_PRE_UP notifiers, but returns without releasing it when a
notifier vetoes the open. The next attempt to open the device then
sleeps in down() with RTNL held, and every other RTNL user blocks
behind it.
For example, with netconsole on a wireless interface, cfg80211 vetoes
the open while the wiphy is rfkill-blocked. Release the lock on that
path, as the ndo_open() error path does.
Found by an AI coding assistant reviewing __dev_open(). Reproduced in
QEMU on an unmodified net tree with mac80211_hwsim built in and
netconsole bound to wlan0:
ip link set wlan0 down
echo 1 > /sys/class/ieee80211/phy0/rfkill0/soft
ip link set wlan0 up # fails: RF-kill
echo 0 > /sys/class/ieee80211/phy0/rfkill0/soft
ip link set wlan0 up # hangs in D state:
down
__dev_open
__dev_change_flags
netif_change_flags
do_setlink
With this patch the last command succeeds. Selftests were not run.
Fixes: ca99ca14c95a ("netpoll: protect napi_poll and poll_controller during dev_[open|close]")
Cc: stable@vger.kernel.org
Signed-off-by: SeungJong Ha <engineer.jjhama@gmail.com>
---
The fix just drops the lock on the veto path, the same way the
ndo_open() error path a few lines below already does.
I tested it in QEMU on net (297ae1590173) with mac80211_hwsim and
netconsole built in: the reproducer from the commit message hangs
without the patch and completes with it. W=1 allyesconfig and
allmodconfig builds are clean for net/core/dev.c.
The bug was found, and the reproducer and patch written, with Claude
Code (Claude Opus 5.5). I reviewed all of it by hand and re-ran the
reproducer myself.
---
net/core/dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 3c58db732761..0be9e78572ff 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1748,8 +1748,10 @@ static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
ret = call_netdevice_notifiers_extack(NETDEV_PRE_UP, dev, extack);
ret = notifier_to_errno(ret);
- if (ret)
+ if (ret) {
+ netpoll_poll_enable(dev);
return ret;
+ }
set_bit(__LINK_STATE_START, &dev->state);
---
base-commit: 297ae15901733df7562a6781613fb49f3d270401
change-id: 20261117-netpoll-preup-veto-943045f4616b
Best regards,
--
SeungJong Ha <engineer.jjhama@gmail.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 6:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 6:27 [PATCH net] net: release netpoll dev_lock when NETDEV_PRE_UP vetoes an open SeungJong Ha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®