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:47:11 +0000 (22:47 +0200)
commit11e085a7b9e8b4020e7882eeff785603a55f7d43
tree022fd6284f793dc38dea68e268432009023f4bc6
parent0d8f2274d5e7491fe4b95bcc799b78c1b30b0375
staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page

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