[lkml]   [2017]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] drm: Fix a possible sleep-in-atomic bug in show_leaks
The driver may sleep under a spinlock.
The function call path is:
drm_vma_offset_manager_destroy (acquire the spinlock)
kmalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.

This bug is found by my static analysis tool(DSAC) and checked by my code review.

Signed-off-by: Jia-Ju Bai <>
drivers/gpu/drm/drm_mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 61a1c8e..5b9965d 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -127,7 +127,7 @@ static void show_leaks(struct drm_mm *mm)
unsigned long entries[STACKDEPTH];
char *buf;

- buf = kmalloc(BUFSZ, GFP_KERNEL);
+ buf = kmalloc(BUFSZ, GFP_ATOMIC);
if (!buf)

 \ /
  Last update: 2017-12-13 15:20    [W:0.025 / U:3.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site