Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbdFMLPu (ORCPT ); Tue, 13 Jun 2017 07:15:50 -0400 Received: from m12-15.163.com ([220.181.12.15]:48836 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752158AbdFMLPs (ORCPT ); Tue, 13 Jun 2017 07:15:48 -0400 Message-ID: <593FCA08.8000104@163.com> Date: Tue, 13 Jun 2017 19:18:32 +0800 From: Jia-Ju Bai User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 To: Greg KH , wporter82@gmail.com, sergio.paracuellos@gmail.com, aquannie@gmail.com CC: devel@driverdev.osuosl.org, LKML Subject: [PATCH] rts5208: Fix a sleep-in-atomic bug in sd_send_cmd_get_rsp Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: D8CowACnME1byT9ZvGmULg--.36225S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XryfCw18tFy5ur1xCFy3urg_yoWDGwcEka n3t3yxXr1UAr97t34UKw4agr92k3WfWFs5Za10qrWxt398ZFZ8tFWDXFn8XFyfWw47Casx Cw4rJrySy3s5ZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU594S7UUUUU== X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/xtbBRRz1elO-7kTeUwAAsd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1090 Lines: 35 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 sd_cleanup_work sd_stop_seq_mode sd_switch_clock sd_ddr_tuning sd_ddr_pre_tuning_tx sd_send_cmd_get_rsp wait_timeout schedule_timeout --> may sleep To fix it, "wait_timeout" is replaced with mdelay in sd_send_cmd_get_rsp. Signed-off-by: Jia-Ju Bai --- drivers/staging/rts5208/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c index bdd35b6..fed17ff 100644 --- a/drivers/staging/rts5208/sd.c +++ b/drivers/staging/rts5208/sd.c @@ -226,7 +226,7 @@ static int sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 cmd_idx, return STATUS_FAIL; } if (rty_cnt< SD_MAX_RETRY_COUNT) { - wait_timeout(20); + mdelay(20); rty_cnt++; goto RTY_SEND_CMD; } else { -- 1.7.9.5