A set of patches for bug fixes and improved logging in mhi/core/boot.c.
Verified on x86 and arm64 platforms.
Bhaumik Bhatt (5):
bus: mhi: core: Handle firmware load using state worker
bus: mhi: core: WARN_ON for malformed vector table
bus: mhi: core: Return appropriate error codes for AMSS load failure
bus: mhi: core: Improve debug logs for loading firmware
bus: mhi: core: Ensure non-zero session or sequence ID values
Hemant Kumar (3):
bus: mhi: core: Cache intmod from mhi event to mhi channel
bus: mhi: core: Add range check for channel id received in event ring
bus: mhi: core: Read transfer length from an event properly
drivers/bus/mhi/core/boot.c | 74 +++++++++++++++++++++++++----------------
drivers/bus/mhi/core/init.c | 5 ++-
drivers/bus/mhi/core/internal.h | 1 +
drivers/bus/mhi/core/main.c | 17 +++++++---
drivers/bus/mhi/core/pm.c | 6 +---
include/linux/mhi.h | 2 --
6 files changed, 64 insertions(+), 41 deletions(-)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Add a bounds check in the firmware copy routine to exit if a malformed
vector table is found while attempting to load the firmware in to the
BHIe vector table.
Signed-off-by: Bhaumik Bhatt <[email protected]>
---
drivers/bus/mhi/core/boot.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c
index 17c636b..bc70edc 100644
--- a/drivers/bus/mhi/core/boot.c
+++ b/drivers/bus/mhi/core/boot.c
@@ -362,8 +362,14 @@ static void mhi_firmware_copy(struct mhi_controller *mhi_cntrl,
int i = 0;
struct mhi_buf *mhi_buf = img_info->mhi_buf;
struct bhi_vec_entry *bhi_vec = img_info->bhi_vec;
+ struct device *dev = &mhi_cntrl->mhi_dev->dev;
while (remainder) {
+ if (WARN_ON(i >= img_info->entries)) {
+ dev_err(dev, "Malformed vector table\n");
+ return;
+ }
+
to_cpy = min(remainder, mhi_buf->len);
memcpy(mhi_buf->buf, buf, to_cpy);
bhi_vec->dma_addr = mhi_buf->dma_addr;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project