mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset
@ 2017-12-12 13:47 Jia-Ju Bai
  2017-12-15 14:16 ` Hans Verkuil
  2017-12-15 14:51 ` Fabien DESSENNE
  0 siblings, 2 replies; 7+ 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_reset
    msleep --> may sleep

To fix it, msleep is replaced with mdelay.

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 b7892f3..4b62ceb 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
@@ -382,7 +382,7 @@ int bdisp_hw_reset(struct bdisp_dev *bdisp)
 	for (i = 0; i < POLL_RST_MAX; i++) {
 		if (readl(bdisp->regs + BLT_STA1) & BLT_STA1_IDLE)
 			break;
-		msleep(POLL_RST_DELAY_MS);
+		mdelay(POLL_RST_DELAY_MS);
 	}
 	if (i == POLL_RST_MAX)
 		dev_err(bdisp->dev, "Reset timeout\n");
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-19  9:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 13:47 [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset Jia-Ju Bai
2017-12-15 14:16 ` Hans Verkuil
2017-12-15 14:51 ` Fabien DESSENNE
2017-12-16 11:53   ` Jia-Ju Bai
2017-12-16 14:14     ` Mauro Carvalho Chehab
2017-12-19  9:01       ` Fabien DESSENNE
2017-12-19  9:40         ` Mauro Carvalho Chehab

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®