]> git.itanic.dy.fi Git - linux-stable/commitdiff
staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
authorJia-Ju Bai <baijiaju1990@163.com>
Mon, 5 Jun 2017 07:30:16 +0000 (15:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:48:56 +0000 (22:48 +0200)
commit 498c4b4e9c23855d17ecc2a108d949bb68020481 upstream.

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>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/xd.c

index 10fea7bb8f3088d395a2a1d4402783ae921e50fd..3db4a2570b19469d164453c5bc524c288e279cdd 100644 (file)
@@ -1252,7 +1252,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) {