public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH] mmc: fix racy probe cleanup
Date: Mon, 7 Dec 2015 16:46:24 +0000	[thread overview]
Message-ID: <20151207164623.GT8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAPDyKFr6qMJAPW7WMXD--Dhy32iJ8iOmfOS2wXCPWFq7B891yA@mail.gmail.com>

On Mon, Dec 07, 2015 at 05:10:29PM +0100, Ulf Hansson wrote:
> On 7 December 2015 at 12:15, Russell King <rmk+kernel@arm.linux.org.uk> wrote:
> > MMC probe cleanup is racy: consider the following sequence:
> >
> > - mmc_alloc_host()
> > - mmc_gpio_request_cd()
> > - some failure
> > - mmc_free_host()
> >
> > mmc_gpio_request_cd() registers a handler for the card detect GPIO
> > signal, and if this is triggered, it can queue the delayed work in
> 
> mmc_gpio_request_cd() requests the GPIO, but doesn't request the IRQ.
> Instead that's delayed until mmc_add_host() is called.
> 
> > struct mmc_host.  mmc_free_host() then frees the mmc_host structure
> > with the still queued delayed work, which will then cause the timer
> > subsystem to touch free'd memory, potentially oopsing the kernel.
> 
> Because of the above, I don't think this can happen..
> 
> ...unless there are some specific cases when hosts dealing with
> registering the GPIO CD irq themselves, is that so?

This is over a year old, and I forget the details now.  I'll drop the
patch for now.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

      reply	other threads:[~2015-12-07 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 11:15 [PATCH] mmc: fix racy probe cleanup Russell King
2015-12-07 16:10 ` Ulf Hansson
2015-12-07 16:46   ` Russell King - ARM Linux [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151207164623.GT8644@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox