* [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request
@ 2017-12-12 13:47 Jia-Ju Bai
2017-12-15 14:53 ` Fabien DESSENNE
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-12-12 13:47 UTC (permalink / raw)
To: fabien.dessenne, mchehab; +Cc: linux-media, linux-kernel, Jia-Ju Bai
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>
---
drivers/media/platform/sti/bdisp/bdisp-hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c
index 4b62ceb..7b45b43 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;
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request
2017-12-12 13:47 [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request Jia-Ju Bai
@ 2017-12-15 14:53 ` Fabien DESSENNE
0 siblings, 0 replies; 2+ messages in thread
From: Fabien DESSENNE @ 2017-12-15 14:53 UTC (permalink / raw)
To: Jia-Ju Bai, mchehab
Cc: linux-media, linux-kernel, Benjamin GAIGNARD, Hans Verkuil
Hi
Thank you for the patch.
On 12/12/17 14:47, Jia-Ju Bai wrote:
> 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>
> ---
> drivers/media/platform/sti/bdisp/bdisp-hw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> index 4b62ceb..7b45b43 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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-15 14:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 13:47 [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request Jia-Ju Bai
2017-12-15 14:53 ` Fabien DESSENNE
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®