Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c02f000 authored by Philippe De Swert's avatar Philippe De Swert Committed by Chris Ball
Browse files

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: default avatarPhilippe De Swert <philippedeswert@gmail.com>
Reviewed-by: default avatarNamjae Jeon <linkinjeon@gmail.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent fa550189
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -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 @@ cmd_rel_host:


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;