提交 1c02f000 编写于 作者: P Philippe De Swert 提交者: Chris Ball

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: NPhilippe De Swert <philippedeswert@gmail.com>
Reviewed-by: NNamjae Jeon <linkinjeon@gmail.com>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 fa550189
...@@ -384,7 +384,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, ...@@ -384,7 +384,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
md = mmc_blk_get(bdev->bd_disk); md = mmc_blk_get(bdev->bd_disk);
if (!md) { if (!md) {
err = -EINVAL; err = -EINVAL;
goto cmd_done; goto cmd_err;
} }
card = md->queue.card; card = md->queue.card;
...@@ -483,6 +483,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, ...@@ -483,6 +483,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
cmd_done: cmd_done:
mmc_blk_put(md); mmc_blk_put(md);
cmd_err:
kfree(idata->buf); kfree(idata->buf);
kfree(idata); kfree(idata);
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册