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

Commit b0f45823 authored by Asutosh Das's avatar Asutosh Das
Browse files

mmc: core: Check for NULL pointer access in ioctl



Added checks to check if card is NULL before accessing it.

CRs-Fixed: 548450
Change-Id: Idc005b8420a78b3566164102fbeaa243a8e73c7c
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent 4a149ed1
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -638,9 +638,8 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
		return -EPERM;

	idata = mmc_blk_ioctl_copy_from_user(ic_ptr);
	if (IS_ERR(idata))
	if (IS_ERR_OR_NULL(idata))
		return PTR_ERR(idata);

	md = mmc_blk_get(bdev->bd_disk);
	if (!md) {
		err = -EINVAL;
@@ -648,7 +647,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
	}

	card = md->queue.card;
	if (IS_ERR(card)) {
	if (IS_ERR_OR_NULL(card)) {
		err = PTR_ERR(card);
		goto cmd_done;
	}
+4 −0
Original line number Diff line number Diff line
@@ -1222,6 +1222,10 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
{
	unsigned int mult;

	if (!card) {
		WARN_ON(1);
		return;
	}
	/*
	 * SDIO cards only define an upper 1 s limit on access.
	 */