mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: vikash.garodia@oss.qualcomm.com, dikshita.agarwal@oss.qualcomm.com
Cc: abhinav.kumar@linux.dev, bod@kernel.org,
	konrad.dybcio@oss.qualcomm.com, 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, dennylin0707@gmail.com
Subject: [PATCH v2 1/3] media: iris: reject packets that are smaller than the size field
Date: Thu, 26 Nov 2026 21:29:02 +0000	[thread overview]
Message-ID: <20261126212904.27207-2-dennylin0707@gmail.com> (raw)
In-Reply-To: <20261126212904.27207-1-dennylin0707@gmail.com>

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@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 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


  reply	other threads:[~2026-11-26 21:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 21:29 [PATCH v2 0/3] media: iris: add missing packet size checks Hungyu Lin
2026-11-26 21:29 ` Hungyu Lin [this message]
2026-11-26 21:29 ` [PATCH v2 2/3] media: iris: check the packet size after reading from shared memory Hungyu Lin
2026-11-26 21:29 ` [PATCH v2 3/3] 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=20261126212904.27207-2-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=hverkuil@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --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®