diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2017-12-12 08:47:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-18 15:02:48 -0500 |
commit | df8ab4c6010b3b4eafb6732fcb268487fb654220 (patch) | |
tree | 07214845b620112a7fc94691ba65c964714624db /drivers/media/platform | |
parent | c0cb76589c77b9a05f6271691be8707104ff0241 (diff) |
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>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/sti/bdisp/bdisp-hw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c index e7836b307d21..a5eb592e12c0 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c @@ -1064,7 +1064,7 @@ static void bdisp_hw_save_request(struct bdisp_ctx *ctx) if (!copy_node[i]) { copy_node[i] = devm_kzalloc(ctx->bdisp_dev->dev, sizeof(*copy_node[i]), - GFP_KERNEL); + GFP_ATOMIC); if (!copy_node[i]) return; } |