From: Jia-Ju Bai <baijiaju1990@163.com>
To: gregkh@linuxfoundation.org, wporter82@gmail.com,
sergio.paracuellos@gmail.com, aquannie@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Jia-Ju Bai <baijiaju1990@163.com>
Subject: [PATCH V2] staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
Date: Mon, 5 Jun 2017 15:57:04 +0800 [thread overview]
Message-ID: <1496649424-1494-1-git-send-email-baijiaju1990@163.com> (raw)
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
next reply other threads:[~2017-06-05 7:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 7:57 Jia-Ju Bai [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-06-05 7:30 [PATCH V2] staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page Jia-Ju Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496649424-1494-1-git-send-email-baijiaju1990@163.com \
--to=baijiaju1990@163.com \
--cc=aquannie@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sergio.paracuellos@gmail.com \
--cc=wporter82@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.