🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by SeungJong Ha Wed, 18 Nov 2026 06:27
[PATCH net] net: release netpoll dev_lock when NETDEV_PRE_UP vetoes an open
#18336
Author: SeungJong Ha
Date: Wed, 18 Nov 2026 06:27
72 lines
13132 bytes
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>
Re: [PATCH net] net: release netpoll dev_lock when NETDEV_PRE_UP vetoes an open
#21108
Author: patchwork-bot+netdevbpf
Date: Mon, 23 Nov 2026 15:00
24 lines
8652 bytes
Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 18 Nov 2026 15:27:44 +0900 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: release netpoll dev_lock when NETDEV_PRE_UP vetoes an open
    https://git.kernel.org/netdev/net/c/a233b32f1a12

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads