* [PATCH] vme: Fix a possible sleep-in-atomic bug in vme_tsi148
@ 2017-12-12 12:51 Jia-Ju Bai
0 siblings, 0 replies; only message in thread
From: Jia-Ju Bai @ 2017-12-12 12:51 UTC (permalink / raw)
To: martyn, manohar.vanga, gregkh, elfring, martyn.welch
Cc: devel, linux-kernel, Jia-Ju Bai
The driver may sleep under a spinlock.
The function call path is:
tsi148_master_write \ tsi148_master_read (acquire the spinlock)
vme_register_error_handler
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/vme/vme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 8124622..92500f6 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -1290,7 +1290,7 @@ struct vme_error_handler *vme_register_error_handler(
{
struct vme_error_handler *handler;
- handler = kmalloc(sizeof(*handler), GFP_KERNEL);
+ handler = kmalloc(sizeof(*handler), GFP_ATOMIC);
if (!handler)
return NULL;
--
1.7.9.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-12 12:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 12:51 [PATCH] vme: Fix a possible sleep-in-atomic bug in vme_tsi148 Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®