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

Commit 7105034e authored by Manu Gautam's avatar Manu Gautam
Browse files

mhi: core: Add checks for bhi and bhie offsets



Bail out if device returns invalid bhi/bhie offsets.

Change-Id: Ifc92c53a4c1f7c951721cbec0b1d7285cf19cd72
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 62777520
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -947,6 +947,12 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
		goto error_bhi_offset;
	}

	if (val >= mhi_cntrl->len) {
		write_unlock_irq(&mhi_cntrl->pm_lock);
		MHI_ERR("Invalid bhi offset:%x\n", val);
		goto error_bhi_offset;
	}

	mhi_cntrl->bhi = mhi_cntrl->regs + val;

	/* setup bhie offset if not set */
@@ -958,6 +964,12 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
			goto error_bhi_offset;
		}

		if (val >= mhi_cntrl->len) {
			write_unlock_irq(&mhi_cntrl->pm_lock);
			MHI_ERR("Invalid bhie offset:%x\n", val);
			goto error_bhi_offset;
		}

		mhi_cntrl->bhie = mhi_cntrl->regs + val;
	}