]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vfree: add debug might_sleep()
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Fri, 26 Oct 2018 22:07:07 +0000 (15:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 23:26:33 +0000 (16:26 -0700)
Add might_sleep() call to vfree() to catch potential sleep-in-atomic bugs
earlier.

[aryabinin@virtuozzo.com: drop might_sleep_if() from kvfree()]
Link: http://lkml.kernel.org/r/7e19e4df-b1a6-29bd-9ae7-0266d50bef1d@virtuozzo.com
Link: http://lkml.kernel.org/r/20180914130512.10394-3-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmalloc.c

index d00d42d6bf79f0561b3f84224b51a0389db8172d..97d4b25d0373102a197ba1de455a944cf7204061 100644 (file)
@@ -1587,6 +1587,8 @@ void vfree(const void *addr)
 
        kmemleak_free(addr);
 
+       might_sleep_if(!in_interrupt());
+
        if (!addr)
                return;
        if (unlikely(in_interrupt()))