public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: matt@console-pimps.org, dsd@laptop.org,
	linux-mmc@vger.kernel.org, mm-commits@vger.kernel.org
Subject: [to-be-updated] sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep.patch removed from -mm tree
Date: Wed, 02 Dec 2009 15:51:23 -0800	[thread overview]
Message-ID: <200912022351.nB2NpNNG031853@imap1.linux-foundation.org> (raw)


The patch titled
     sdio: initialise SDIO functions and update card->sdio_funcs in lockstep
has been removed from the -mm tree.  Its filename was
     sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: sdio: initialise SDIO functions and update card->sdio_funcs in lockstep
From: Matt Fleming <matt@console-pimps.org>

We need to accurately track how many SDIO functions have been initialised
(and keep card->sdio_funcs in sync) so that we don't try to remove more
functions than we initialised if we hit the error path in
mmc_attach_sdio().

Without this patch if we hit the error path in mmc_attach_sdio() we run
the risk of deferencing invalid memory in sdio_remove_func(), leading to a
crash.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Cc: Daniel Drake <dsd@laptop.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mmc/core/sdio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/mmc/core/sdio.c~sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep drivers/mmc/core/sdio.c
--- a/drivers/mmc/core/sdio.c~sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep
+++ a/drivers/mmc/core/sdio.c
@@ -516,7 +516,8 @@ int mmc_attach_sdio(struct mmc_host *hos
 	 * The number of functions on the card is encoded inside
 	 * the ocr.
 	 */
-	card->sdio_funcs = funcs = (ocr & 0x70000000) >> 28;
+	funcs = (ocr & 0x70000000) >> 28;
+	card->sdio_funcs = 0;
 
 	/*
 	 * If needed, disconnect card detection pull-up resistor.
@@ -528,7 +529,7 @@ int mmc_attach_sdio(struct mmc_host *hos
 	/*
 	 * Initialize (but don't add) all present functions.
 	 */
-	for (i = 0;i < funcs;i++) {
+	for (i = 0;i < funcs;i++, card->sdio_funcs++) {
 		err = sdio_init_func(host->card, i + 1);
 		if (err)
 			goto remove;
_

Patches currently in -mm which might be from matt@console-pimps.org are

linux-next.patch
sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep.patch
sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockstep-checkpatch-fixes.patch


             reply	other threads:[~2009-12-02 23:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 23:51 akpm [this message]
2009-12-08 13:57 ` [to-be-updated] sdio-initialise-sdio-functions-and-update-card-sdio_funcs-in-lockste p.patch removed from -mm tree Matt Fleming
2009-12-08 20:08   ` Andrew Morton
2009-12-08 20:59     ` Matt Fleming

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=200912022351.nB2NpNNG031853@imap1.linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dsd@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=mm-commits@vger.kernel.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