Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751359AbdFCOJH (ORCPT ); Sat, 3 Jun 2017 10:09:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53950 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbdFCOJF (ORCPT ); Sat, 3 Jun 2017 10:09:05 -0400 Date: Sat, 3 Jun 2017 17:52:38 +0900 From: Greg KH To: Jia-Ju Bai Cc: wporter82@gmail.com, sergio.paracuellos@gmail.com, aquannie@gmail.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss Message-ID: <20170603085238.GA27539@kroah.com> References: <1496288615-29497-1-git-send-email-baijiaju1990@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1496288615-29497-1-git-send-email-baijiaju1990@163.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 682 Lines: 22 On Thu, Jun 01, 2017 at 11:43:35AM +0800, Jia-Ju Bai wrote: > 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_change_phase > wait_timeout > schedule_timeout --> may sleep > > To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase. Nice work, how are you finding these bugs? What tools gives you this kind of analysis? thanks, greg k-h