diff options
author | Philippe De Swert <philippedeswert@gmail.com> | 2012-04-11 16:31:45 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-05-09 20:47:37 -0400 |
commit | 1c02f000e78347aa51822feb189fcb0d90273958 (patch) | |
tree | 43ed41f00fd81354ced9e0bab29b19a78ec6e157 /drivers/mmc/card/block.c | |
parent | fa5501890d8974301042e0202d342a6cbe8609f4 (diff) |
mmc: card: Avoid null pointer dereference
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>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r-- | drivers/mmc/card/block.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index dabec556ebb8..91cda7551a60 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, | |||
384 | md = mmc_blk_get(bdev->bd_disk); | 384 | md = mmc_blk_get(bdev->bd_disk); |
385 | if (!md) { | 385 | if (!md) { |
386 | err = -EINVAL; | 386 | err = -EINVAL; |
387 | goto cmd_done; | 387 | goto cmd_err; |
388 | } | 388 | } |
389 | 389 | ||
390 | card = md->queue.card; | 390 | card = md->queue.card; |
@@ -483,6 +483,7 @@ cmd_rel_host: | |||
483 | 483 | ||
484 | cmd_done: | 484 | cmd_done: |
485 | mmc_blk_put(md); | 485 | mmc_blk_put(md); |
486 | cmd_err: | ||
486 | kfree(idata->buf); | 487 | kfree(idata->buf); |
487 | kfree(idata); | 488 | kfree(idata); |
488 | return err; | 489 | return err; |