[PATCH v2 0/2] media: verisilicon: av1: Fix two reference reads

Arun Iyengar via B4 Relay posted 2 patches 4 days, 5 hours ago
drivers/media/platform/verisilicon/hantro.h        |  2 +
drivers/media/platform/verisilicon/hantro_hw.h     |  3 -
.../verisilicon/rockchip_vpu981_hw_av1_dec.c       | 79 ++++++++++++++--------
3 files changed, 54 insertions(+), 30 deletions(-)
[PATCH v2 0/2] media: verisilicon: av1: Fix two reference reads
Posted by Arun Iyengar via B4 Relay 4 days, 5 hours ago
The RK3588 AV1 decoder (VPU981) can read a CAPTURE buffer freed with
VIDIOC_REMOVE_BUFS (patch 1), and reads the segmentation map past the
end of a smaller reference after a switch to a larger CAPTURE format
(patch 2).

Found by code review. Tested on an Orange Pi 5 (RK3588S, 7.3-based
kernel with KASAN): AV1 resolution-change streams (sizeup, sizedown,
svc-L2T1) and 203 AV1 conformance streams decode bit-exact;
with a reference buffer removed, or replaced by a smaller one, the
current buffer is used and the segmentation map is skipped; a map in a
smaller buffer is read at its own offset.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

---
Changes in v2:
- 1/2: Also fall back when the reference buffer holds a frame of another
  size; set the CAPTURE buffer up before the references; drop
  current_frame_index (Sashiko). Reviewed-by dropped, the patch changed.
- 2/2: Use the buffer checked in 1/2.
- Link to v1: https://patch.msgid.link/20261115-b4-vpu981-av1-refs-v1-0-c65769715db9@gmail.com

---
Arun Iyengar (2):
      media: verisilicon: av1: Find the reference buffers by timestamp
      media: verisilicon: av1: Read the segmentation map at the reference's offset

 drivers/media/platform/verisilicon/hantro.h        |  2 +
 drivers/media/platform/verisilicon/hantro_hw.h     |  3 -
 .../verisilicon/rockchip_vpu981_hw_av1_dec.c       | 79 ++++++++++++++--------
 3 files changed, 54 insertions(+), 30 deletions(-)
---
base-commit: aa0f4c41d4870a18e65772a1817af16427200371
change-id: 20261114-b4-vpu981-av1-refs-d9419af12e0d

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>