diff options
author | Anna Lemehova <EXT-Anna.Lemehova@nokia.com> | 2010-01-08 14:42:58 -0800 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-04-27 13:50:24 +0200 |
commit | bb8a101ff288b3cbb95850ec41839f5d3b02c01d (patch) | |
tree | be0c039cf4ac05434fabcf9b2f294b9db8c89753 /drivers/mmc | |
parent | fd2ab21deb582e3ff5edd9ae23a39a45239170b0 (diff) |
mmc_block: add dev_t initialization check
When a card is removed before mmc_blk_probe() has called add_disk(), then
the minor field is uninitialized and has value 0. This caused
mmc_blk_put() to always release devidx 0 even if 0 was still in use. Then
the next mmc_blk_probe() used the first free idx of 0, which oopses in
sysfs, since it is used by another card.
Signed-off-by: Anna Lemehova <EXT-Anna.Lemehova@nokia.com>
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: If89cb58db2d2293e191251313fb554eece649a55
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/21724
Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>
Tested-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>
Reviewed-by: QATEST
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/card/block.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 97fa0fd5778..f38f3f58375 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -86,8 +86,12 @@ static void mmc_blk_put(struct mmc_blk_data *md) mutex_lock(&open_lock); md->usage--; if (md->usage == 0) { + int devmaj = MAJOR(disk_devt(md->disk)); int devidx = md->disk->first_minor >> MMC_SHIFT; + if (!devmaj) + devidx = md->disk->first_minor >> MMC_SHIFT; + blk_cleanup_queue(md->queue.queue); __clear_bit(devidx, dev_use); |