diff options
| author | Breno Leitao <[email protected]> | 2025-07-31 09:57:18 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-08-05 20:28:46 +0000 |
| commit | 47b0f6d8f0d2be4d311a49e13d2fd5f152f492b2 (patch) | |
| tree | 6aa5bbebf1ab90c4c176142c6c82be94f31c3c35 /fs/xfs/xfs_exchrange.c | |
| parent | kasan/test: fix protection against compiler elision (diff) | |
| download | kernel-47b0f6d8f0d2be4d311a49e13d2fd5f152f492b2.tar.gz kernel-47b0f6d8f0d2be4d311a49e13d2fd5f152f492b2.zip | |
mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock
When netpoll is enabled, calling pr_warn_once() while holding
kmemleak_lock in mem_pool_alloc() can cause a deadlock due to lock
inversion with the netconsole subsystem. This occurs because
pr_warn_once() may trigger netpoll, which eventually leads to
__alloc_skb() and back into kmemleak code, attempting to reacquire
kmemleak_lock.
This is the path for the deadlock.
mem_pool_alloc()
-> raw_spin_lock_irqsave(&kmemleak_lock, flags);
-> pr_warn_once()
-> netconsole subsystem
-> netpoll
-> __alloc_skb
-> __create_object
-> raw_spin_lock_irqsave(&kmemleak_lock, flags);
Fix this by setting a flag and issuing the pr_warn_once() after
kmemleak_lock is released.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
Signed-off-by: Breno Leitao <[email protected]>
Reported-by: Jakub Kicinski <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'fs/xfs/xfs_exchrange.c')
0 files changed, 0 insertions, 0 deletions
