summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2026-07-10 04:38:53 -0700
committerPaolo Abeni <pabeni@redhat.com>2026-07-17 12:09:15 +0200
commita620ff84d42cf46cbfb708bacd40ad5e36d02de8 (patch)
tree1c2b1602fef947ee45f6e1e4251d075f03ad631d
parentf6f3b36c15ed44de1fbb44e645e4fae8c4a4453e (diff)
downloadlinux-next-a620ff84d42cf46cbfb708bacd40ad5e36d02de8.tar.gz
linux-next-a620ff84d42cf46cbfb708bacd40ad5e36d02de8.zip
netconsole: clean up released targets dropped before the cleanup worker
drop_netconsole_target() might eventually tear down a target that netconsole_netdev_event() had moved to target_cleanup_list but that netconsole_process_cleanups_core() had not processed yet. Always cleanup devices that eventually have a device attached to the target, independent of the state. Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260710-netconsole_move_more-v3-1-6f63f76b28bc@debian.org Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/netconsole.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index c1812a98365b..a939daa07cf9 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1481,15 +1481,15 @@ static void drop_netconsole_target(struct config_group *group,
mutex_lock(&target_cleanup_list_lock);
spin_lock_irqsave(&target_list_lock, flags);
- /* A STATE_DEACTIVATED target may have been moved to
- * target_cleanup_list by netconsole_netdev_event() but not yet
- * processed by netconsole_process_cleanups_core(). Unlinking it below
- * hides it from the cleanup worker, so this path has to clean it up
- * itself. Record that the target still owns a netpoll before the
- * state is downgraded.
+ /* A target moved to target_cleanup_list by netconsole_netdev_event()
+ * but not yet processed still owns a netpoll; unlinking it below hides
+ * it from the cleanup worker, so this path must tear it down itself.
+ * This covers NETDEV_UNREGISTER (STATE_DEACTIVATED) and
+ * NETDEV_RELEASE / NETDEV_JOIN (STATE_DISABLED); key off nt->np.dev,
+ * which stays set until the netpoll is cleaned up.
*/
needs_cleanup = nt->state == STATE_ENABLED ||
- nt->state == STATE_DEACTIVATED;
+ nt->state == STATE_DEACTIVATED || nt->np.dev;
/* Disable deactivated target to prevent races between resume attempt
* and target removal.
*/