Merge "bus: mhi: Fix potential out-of-bound access" into kernel.lnx.5.4.r1-rel

This commit is contained in:
Linux Build Service Account 2024-03-11 03:51:17 -07:00 committed by Gerrit - the friendly Code Review server
commit 0cb96a3ce3

View File

@ -357,7 +357,8 @@ static struct mhi_sat_device *find_sat_dev_by_id(
static bool mhi_sat_isvalid_header(struct sat_header *hdr, int len) static bool mhi_sat_isvalid_header(struct sat_header *hdr, int len)
{ {
/* validate payload size */ /* validate payload size */
if (len >= sizeof(*hdr) && (len != hdr->payload_size + sizeof(*hdr))) if ((len < sizeof(*hdr)) ||
(len >= sizeof(*hdr) && (len != hdr->payload_size + sizeof(*hdr))))
return false; return false;
/* validate SAT IPC version */ /* validate SAT IPC version */