Skip to content

Commit

Permalink
staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
XidianGeneral authored and gregkh committed Jun 6, 2017
1 parent ac66925 commit 498c4b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/rts5208/xd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 498c4b4

Please sign in to comment.