mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-29 17:30:01 -04:00
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>
This commit is contained in:
committed by
Paolo Abeni
parent
f6f3b36c15
commit
a620ff84d4
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user