Re: [PATCH v2] media: iris: Fix out-of-bounds read in timestamp metadata fallback

From: Vikash Garodia

Date: Fri Nov 27 2026 - 07:33:04 EST



On 11/17/2026 5:13 PM, Vishnu Reddy wrote:
inst->tss[] has VIDEO_MAX_FRAME (32) entries, so valid indexes are 0
through 31. iris_set_ts_metadata() writes at metadata_idx and then
increments it, wrapping only on the next call. After the 32nd input
buffer, metadata_idx is 32 until the next input buffer is queued.

If iris_get_ts_metadata() finds no matching timestamp in that window,
its fallback reads inst->tss[32], one entry past the end of the array.
UBSAN reports this as an array-index-out-of-bounds error.

Advance metadata_idx before the write instead, starting from the last
slot so the first write still lands in slot 0. The index then always
refers to the last written entry and is never out of range, so the
fallback read needs no special handling.

Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
Cc:stable@xxxxxxxxxxxxxxx
Tested-by: Birk Skyum<birk.skyum@xxxxx> # Lenovo Yoga Slim 7x (X1E80100)
Tested-by: Deepa Madivalara<deepa.madivalara@xxxxxxxxxxxxxxxx>
Signed-off-by: Vishnu Reddy<busanna.reddy@xxxxxxxxxxxxxxxx>
---
Changes in v2:
- Wrap metadata_idx in iris_set_ts_metadata() instead of fixing the fallback read (Bryan)
- Link to v1:https://patch.msgid.link/20261017-fix-oob-tss-v1-1- fb86f4cabf65@xxxxxxxxxxxxxxxx
---
drivers/media/platform/qcom/iris/iris_common.c | 4 ++--
drivers/media/platform/qcom/iris/iris_vidc.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Vikash Garodia <vikash.garodia@xxxxxxxxxxxxxxxx>