mm: kvmalloc: Bail if called with soft or hard IRQs disabled
The function kvmalloc may call vmalloc under the hood even when
used with GFP_ATOMIC. However, vmalloc uses naked spin locks so
it must not be called if the caller already holds spin locks that
can be used in hard or soft IRQ context.
Use the heuristic irqs_disabled() || in_softirq() to detect such
callers and prevent them from using vmalloc.
Reported-by: Liam R. Howlett (Google) <liam@infradead.org>
Fixes: c6307674ed82 ("mm: kvmalloc: add non-blocking support for vmalloc")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 file changed