mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
mhi: core: Add checks for bhi and bhie offsets
Bail out if device returns invalid bhi/bhie offsets. Change-Id: Ifc92c53a4c1f7c951721cbec0b1d7285cf19cd72 Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
This commit is contained in:
parent
775e234a67
commit
d279640225
1 changed files with 14 additions and 0 deletions
|
|
@ -968,6 +968,13 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
|
|||
goto error_bhi_offset;
|
||||
}
|
||||
|
||||
if (val >= mhi_cntrl->len) {
|
||||
ret = -ENODEV;
|
||||
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 */
|
||||
|
|
@ -979,6 +986,13 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
|
|||
goto error_bhi_offset;
|
||||
}
|
||||
|
||||
if (val >= mhi_cntrl->len) {
|
||||
ret = -ENODEV;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue