Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vme: Fix a possible sleep-in-atomic bug in vme_tsi148

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jia-Ju Bai and committed by
Greg Kroah-Hartman
97784615 de2ee48c

+1 -1
+1 -1
drivers/vme/vme.c
··· 1290 1290 { 1291 1291 struct vme_error_handler *handler; 1292 1292 1293 - handler = kmalloc(sizeof(*handler), GFP_KERNEL); 1293 + handler = kmalloc(sizeof(*handler), GFP_ATOMIC); 1294 1294 if (!handler) 1295 1295 return NULL; 1296 1296