Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657321 > unrolled thread
| Started by | Jia-Ju Bai <baijiaju1990@163.com> |
|---|---|
| First post | 2017-06-05 09:30 +0200 |
| Last post | 2017-06-05 09:30 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH V2] staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page Jia-Ju Bai <baijiaju1990@163.com> - 2017-06-05 09:30 +0200
| From | Jia-Ju Bai <baijiaju1990@163.com> |
|---|---|
| Date | 2017-06-05 09:30 +0200 |
| Subject | [PATCH V2] staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page |
| Message-ID | <tOUCB-8jN-5@gated-at.bofh.it> |
The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
rtsx_enter_ss
rtsx_power_off_card
xd_cleanup_work
xd_delay_write
xd_finish_write
xd_copy_page
wait_timeout
schedule_timeout --> may sleep
To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page.
Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
V2:
* Add code explanation in this patch.
drivers/staging/rts5208/xd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 85aba05..74d36f9 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -1268,7 +1268,7 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk,
reg = 0;
rtsx_read_register(chip, XD_CTL, ®);
if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
- wait_timeout(100);
+ mdelay(100);
if (detect_card_cd(chip,
XD_CARD) != STATUS_SUCCESS) {
--
1.7.9.5
Back to top | Article view | linux.kernel
csiph-web