public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend] rt5208: Fix a sleep-in-atomic bug in xd_copy_page
@ 2017-06-05  1:26 Jia-Ju Bai
  2017-06-05  6:35 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-06-05  1:26 UTC (permalink / raw)
  To: gregkh, wporter82, sergio.paracuellos, aquannie
  Cc: devel, linux-kernel, Jia-Ju Bai

Last patch lacks code explanation, and it is included in this patch.

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>
---
 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, &reg);
 			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

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

* Re: [PATCH resend] rt5208: Fix a sleep-in-atomic bug in xd_copy_page
  2017-06-05  1:26 [PATCH resend] rt5208: Fix a sleep-in-atomic bug in xd_copy_page Jia-Ju Bai
@ 2017-06-05  6:35 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-06-05  6:35 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: wporter82, sergio.paracuellos, aquannie, devel, linux-kernel

On Mon, Jun 05, 2017 at 09:26:35AM +0800, Jia-Ju Bai wrote:
> Last patch lacks code explanation, and it is included in this patch.

That should go below the --- line, as a 'v2' patch.  Please fix it up so
I don't have to hand-edit this and resend.

Please read Documentation/SubmittingPatches for how to properly version
your patches.  And also, please put the subsystem in your subject line,
otherwise it's hard for me to find them at times.  Look at how other
patches subject lines are for these same drivers (i.e. you need
'staging' in it...)

thanks,

greg k-h

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

end of thread, other threads:[~2017-06-05  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-05  1:26 [PATCH resend] rt5208: Fix a sleep-in-atomic bug in xd_copy_page Jia-Ju Bai
2017-06-05  6:35 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox