From: Philippe De Swert <philippedeswert@gmail.com>
To: philippedeswert@gmail.com, linux-mmc@vger.kernel.org,
linux-kernel@vger.kernel.org, john.calixto@modsystems.com,
prakity@marvell.com, cjb@laptop.org
Subject: [PATCH 1/2] mmc: Avoid null pointer dereference
Date: Wed, 11 Apr 2012 23:31:45 +0300 [thread overview]
Message-ID: <1334176305-6183-1-git-send-email-philippedeswert@gmail.com> (raw)
After the null check on md the code jumped to cmd_done, which then
will dereference md in mmc_blk_put. This patch avoids the possible
null pointer dereference in that case.
Signed-off-by: Philippe De Swert <philippedeswert@gmail.com>
---
drivers/mmc/card/block.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index b180965..4bed186 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -384,7 +384,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
md = mmc_blk_get(bdev->bd_disk);
if (!md) {
err = -EINVAL;
- goto cmd_done;
+ goto cmd_err;
}
card = md->queue.card;
@@ -483,6 +483,7 @@ cmd_rel_host:
cmd_done:
mmc_blk_put(md);
+cmd_err:
kfree(idata->buf);
kfree(idata);
return err;
--
1.7.9.5
next reply other threads:[~2012-04-11 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 20:31 Philippe De Swert [this message]
2012-04-12 1:45 ` Namjae Jeon
2012-05-10 0:43 ` Namjae Jeon
2012-05-10 0:54 ` Chris Ball
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=1334176305-6183-1-git-send-email-philippedeswert@gmail.com \
--to=philippedeswert@gmail.com \
--cc=cjb@laptop.org \
--cc=john.calixto@modsystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=prakity@marvell.com \
/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
all inboxes | Powered by JetHome®