]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - 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
CommitLineData
5aeac1fd
GKH
1From 498c4b4e9c23855d17ecc2a108d949bb68020481 Mon Sep 17 00:00:00 2001
2From: Jia-Ju Bai <baijiaju1990@163.com>
3Date: Mon, 5 Jun 2017 15:30:16 +0800
4Subject: staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
5
6From: Jia-Ju Bai <baijiaju1990@163.com>
7
8commit 498c4b4e9c23855d17ecc2a108d949bb68020481 upstream.
9
10The driver may sleep under a spin lock, and the function call path is:
11rtsx_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
21To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page.
22
23Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
24Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
25Signed-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) {