mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Hungyu Lin <dennylin0707@gmail.com>,
	vikash.garodia@oss.qualcomm.com,
	dikshita.agarwal@oss.qualcomm.com
Cc: abhinav.kumar@linux.dev, bod@kernel.org, mchehab@kernel.org,
	hverkuil@kernel.org, stefan.schmidt@linaro.org,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] media: iris: check the packet size after reading from shared memory
Date: Thu, 26 Nov 2026 16:24:18 +0100	[thread overview]
Message-ID: <9bc0e617-6840-4be8-93c9-3a4429bfa3a2@oss.qualcomm.com> (raw)
In-Reply-To: <20261117204946.21359-2-dennylin0707@gmail.com>

On 11/17/26 9:49 PM, Hungyu Lin wrote:
> iris_hfi_queue_read() takes the size of a packet from the first word of
> the packet in the shared queue and then copies that many bytes, including
> that word, out of the queue. The firmware can change the word in between,
> so the size field of the copy can be larger than what was copied. The
> gen1 response handlers use that field as the length of the packet, for
> example to walk the buffer requirements in
> iris_hfi_gen1_session_property_info().
> 
> venus got the same check in commit 49befc830daa ("media: venus: Add a
> check for packet size after reading from shared memory"). Compare the
> size field of the copy with the size that was used for the copy and fail
> the read if they differ.
> 
> Fixes: fb583a214337 ("media: iris: introduce host firmware interface with necessary hooks")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>  drivers/media/platform/qcom/iris/iris_hfi_queue.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_queue.c b/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> index bf6db23b53e2..5d3315f71623 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_queue.c
> @@ -95,6 +95,8 @@ static int iris_hfi_queue_read(struct iris_iface_q_info *qinfo, void *packet)
>  			       qinfo->kernel_vaddr, residue);
>  			new_read_idx = residue;
>  		}
> +		if (*(u32 *)packet != packet_size)
> +			return -EINVAL;

Sashiko has a concern

Konrad

  reply	other threads:[~2026-11-26 15:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:49 [PATCH 0/2] media: iris: port two packet size checks from venus Hungyu Lin
2026-11-17 20:49 ` [PATCH 1/2] media: iris: check the packet size after reading from shared memory Hungyu Lin
2026-11-26 15:24   ` Konrad Dybcio [this message]
2026-11-17 20:49 ` [PATCH 2/2] media: iris: fix out-of-bounds read in gen1 sequence change event Hungyu Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bc0e617-6840-4be8-93c9-3a4429bfa3a2@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=hverkuil@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=stefan.schmidt@linaro.org \
    --cc=vikash.garodia@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®