media: bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request
authorJia-Ju Bai <baijiaju1990@gmail.com>
Tue, 12 Dec 2017 13:47:38 +0000 (08:47 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 18 Dec 2017 20:02:48 +0000 (15:02 -0500)
commitdf8ab4c6010b3b4eafb6732fcb268487fb654220
tree07214845b620112a7fc94691ba65c964714624db
parentc0cb76589c77b9a05f6271691be8707104ff0241
media: bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request

The driver may sleep under a spinlock.
The function call path is:
bdisp_device_run (acquire the spinlock)
  bdisp_hw_update
    bdisp_hw_save_request
      devm_kzalloc(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>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/sti/bdisp/bdisp-hw.c