In the Linux kernel, the following vulnerability has been resolved:
mm/kmemleak: avoid deadlock by moving prwarn() outside kmemleaklock
When netpoll is enabled, calling prwarnonce() while holding kmemleaklock in mempoolalloc() can cause a deadlock due to lock inversion with the netconsole subsystem. This occurs because prwarnonce() may trigger netpoll, which eventually leads to _allocskb() and back into kmemleak code, attempting to reacquire kmemleaklock.
This is the path for the deadlock.
mempoolalloc() -> rawspinlockirqsave(&kmemleaklock, flags); -> prwarnonce() -> netconsole subsystem -> netpoll -> _allocskb -> _createobject -> rawspinlockirqsave(&kmemleaklock, flags);
Fix this by setting a flag and issuing the prwarnonce() after kmemleak_lock is released.