From patchwork Wed Apr 27 21:44:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ball X-Patchwork-Id: 737801 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3RLf9F6013135 for ; Wed, 27 Apr 2011 21:41:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756699Ab1D0VlI (ORCPT ); Wed, 27 Apr 2011 17:41:08 -0400 Received: from void.printf.net ([89.145.121.20]:48765 "EHLO void.printf.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759240Ab1D0VlI (ORCPT ); Wed, 27 Apr 2011 17:41:08 -0400 Received: from pullcord.laptop.org ([18.85.46.20]) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1QFCTr-0001R7-79; Wed, 27 Apr 2011 22:41:07 +0100 From: Chris Ball To: Mark Brown Cc: linux-mmc@vger.kernel.org, Ben Dooks , Dimitris Papastamos Subject: Re: [PATCH 0/2] Race fixes in sdhci References: <20110427132329.GA21499@opensource.wolfsonmicro.com> Date: Wed, 27 Apr 2011 17:44:42 -0400 In-Reply-To: <20110427132329.GA21499@opensource.wolfsonmicro.com> (Mark Brown's message of "Wed, 27 Apr 2011 14:23:30 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Apr 2011 21:41:14 +0000 (UTC) Hi Mark, On Wed, Apr 27 2011, Mark Brown wrote: > Ben Dooks (1): > MMC: SDHCI: Check mrq->cmd in sdhci_tasklet_finish > > Dimitris Papastamos (1): > MMC: SDHCI: Check mrq != NULL in sdhci_tasklet_finish Thanks. I've merged Ben's patch for .39, and also: From: Chris Ball Subject: [PATCH] mmc: sdhci: Check mrq != NULL in sdhci_tasklet_finish It seems that under certain circumstances the sdhci_tasklet_finish() call can be entered with mrq set to NULL, causing the system to crash with a NULL pointer de-reference. Seen on S3C6410 system. Based on a patch by Dimitris Papastamos. Reported-by: Dimitris Papastamos Cc: Signed-off-by: Chris Ball --- drivers/mmc/host/sdhci.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e4084a3..f197c67 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1808,6 +1808,13 @@ static void sdhci_tasklet_finish(unsigned long param) host = (struct sdhci_host*)param; + /* + * If this tasklet gets rescheduled while running, it will + * be run again afterwards but without any active request. + */ + if (!host->mrq) + return; + spin_lock_irqsave(&host->lock, flags); del_timer(&host->timer);