Re: [PATCH v2 1/3] media: iris: reject packets that are smaller than the size field

From: bod

Date: Tue Dec 01 2026 - 06:07:18 EST


On 2026-11-26 21:29 +0000, Hungyu Lin wrote:
> iris_hfi_queue_read() only rejects a packet size of zero. For a size of
> 1 to 3 it copies less than the size field, returns success and leaves
> the read index where it was, because the index counts 32-bit words. The
> gen1 response handler drops such a packet as too small and reads the
> queue again, so it gets the same entry again and again and the interrupt
> thread does not return.
>
> venus_read_queue() converts the size to words before it checks it for
> zero. Reject a size that is smaller than one word here as well.
>
> Fixes: fb583a214337 ("media: iris: introduce host firmware interface with necessary hooks")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
> ---
> drivers/media/platform/qcom/iris/iris_hfi_queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_queue.c b/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> index bf6db23b53e2..12a7fd0982c5 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> @@ -81,7 +81,7 @@ static int iris_hfi_queue_read(struct iris_iface_q_info *qinfo, void *packet)
> return -ENODATA;
>
> packet_size = *read_ptr;
> - if (!packet_size)
> + if (packet_size < sizeof(u32))
> return -EINVAL;
>
> new_read_idx = read_idx + packet_size;
> --
> 2.43.0
>
>

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
---
bod