From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: daniel.vetter@intel.com, jani.nikula@linux.intel.com,
seanpaul@chromium.org, airlied@linux.ie, dh.herrmann@gmail.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: [PATCH] drm: Fix a possible sleep-in-atomic bug in show_leaks
Date: Wed, 13 Dec 2017 22:22:23 +0800 [thread overview]
Message-ID: <1513174943-18891-1-git-send-email-baijiaju1990@gmail.com> (raw)
The driver may sleep under a spinlock.
The function call path is:
drm_vma_offset_manager_destroy (acquire the spinlock)
drm_mm_takedown
show_leaks
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 <baijiaju1990@gmail.com>
---
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)
return;
--
1.7.9.5
reply other threads:[~2017-12-13 14:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513174943-18891-1-git-send-email-baijiaju1990@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dh.herrmann@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.