]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.157/staging-rt5208-fix-a-sleep-in-atomic-bug-in-xd_copy_page.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.157 / staging-rt5208-fix-a-sleep-in-atomic-bug-in-xd_copy_page.patch
1 From 498c4b4e9c23855d17ecc2a108d949bb68020481 Mon Sep 17 00:00:00 2001
2 From: Jia-Ju Bai <baijiaju1990@163.com>
3 Date: Mon, 5 Jun 2017 15:30:16 +0800
4 Subject: staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
5
6 From: Jia-Ju Bai <baijiaju1990@163.com>
7
8 commit 498c4b4e9c23855d17ecc2a108d949bb68020481 upstream.
9
10 The driver may sleep under a spin lock, and the function call path is:
11 rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
12 rtsx_enter_ss
13 rtsx_power_off_card
14 xd_cleanup_work
15 xd_delay_write
16 xd_finish_write
17 xd_copy_page
18 wait_timeout
19 schedule_timeout --> may sleep
20
21 To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page.
22
23 Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
24 Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/staging/rts5208/xd.c | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 --- a/drivers/staging/rts5208/xd.c
32 +++ b/drivers/staging/rts5208/xd.c
33 @@ -1252,7 +1252,7 @@ static int xd_copy_page(struct rtsx_chip
34 reg = 0;
35 rtsx_read_register(chip, XD_CTL, &reg);
36 if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
37 - wait_timeout(100);
38 + mdelay(100);
39
40 if (detect_card_cd(chip,
41 XD_CARD) != STATUS_SUCCESS) {