diff options
author | Vikash Garodia <quic_vgarodia@quicinc.com> | 2023-08-10 04:25:02 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-10-23 12:24:52 +0200 |
commit | b18e36dfd6c935da60a971310374f3dfec3c82e1 (patch) | |
tree | 0cc6f9cb5b1c1908699b6ba08216064dc2ce14a2 /drivers/media | |
parent | media: venus: hfi: add checks to perform sanity on queue pointers (diff) | |
download | linux-b18e36dfd6c935da60a971310374f3dfec3c82e1.tar.xz linux-b18e36dfd6c935da60a971310374f3dfec3c82e1.zip |
media: venus: hfi: fix the check to handle session buffer requirement
Buffer requirement, for different buffer type, comes from video firmware.
While copying these requirements, there is an OOB possibility when the
payload from firmware is more than expected size. Fix the check to avoid
the OOB possibility.
Cc: stable@vger.kernel.org
Fixes: 09c2845e8fe4 ("[media] media: venus: hfi: add Host Firmware Interface (HFI)")
Reviewed-by: Nathan Hebert <nhebert@chromium.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/qcom/venus/hfi_msgs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 7cab685a2ec8..0a041b4db9ef 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -398,7 +398,7 @@ session_get_prop_buf_req(struct hfi_msg_session_property_info_pkt *pkt, memcpy(&bufreq[idx], buf_req, sizeof(*bufreq)); idx++; - if (idx > HFI_BUFFER_TYPE_MAX) + if (idx >= HFI_BUFFER_TYPE_MAX) return HFI_ERR_SESSION_INVALID_PARAMETER; req_bytes -= sizeof(struct hfi_buffer_requirements); |