public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@163.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	wporter82@gmail.com, sergio.paracuellos@gmail.com,
	aquannie@gmail.com
Cc: devel@driverdev.osuosl.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] rts5208: Fix a sleep-in-atomic bug in sd_send_cmd_get_rsp
Date: Tue, 13 Jun 2017 19:18:32 +0800	[thread overview]
Message-ID: <593FCA08.8000104@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
       sd_cleanup_work
         sd_stop_seq_mode
           sd_switch_clock
             sd_ddr_tuning
               sd_ddr_pre_tuning_tx
                 sd_send_cmd_get_rsp
                   wait_timeout
                     schedule_timeout -->  may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_send_cmd_get_rsp.

Signed-off-by: Jia-Ju Bai<baijiaju1990@163.com>
---
  drivers/staging/rts5208/sd.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index bdd35b6..fed17ff 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -226,7 +226,7 @@ static int sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 cmd_idx,
  				return STATUS_FAIL;
  			}
  			if (rty_cnt<  SD_MAX_RETRY_COUNT) {
-				wait_timeout(20);
+				mdelay(20);
  				rty_cnt++;
  				goto RTY_SEND_CMD;
  			} else {
-- 1.7.9.5

             reply	other threads:[~2017-06-13 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 11:18 Jia-Ju Bai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-06-05  1:31 [PATCH] rts5208: Fix a sleep-in-atomic bug in sd_send_cmd_get_rsp Jia-Ju Bai
2017-06-13  9:41 ` Greg KH

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=593FCA08.8000104@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox