From: "Wachowski, Karol" <karol.wachowski@linux.intel.com>
To: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>,
dri-devel@lists.freedesktop.org
Cc: oded.gabbay@gmail.com, jeff.hugo@oss.qualcomm.com,
lizhi.hou@amd.com, dawid.osuchowski@linux.intel.com,
david.laight.linux@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] accel/ivpu: Fix signed integer truncation in IPC receive
Date: Mon, 8 Jun 2026 09:27:15 +0200 [thread overview]
Message-ID: <7218fa4b-bb09-47a8-a2ab-7d381cf7d897@linux.intel.com> (raw)
In-Reply-To: <20260601161643.229342-1-andrzej.kacprowski@linux.intel.com>
On 01-Jun-26 18:16, Andrzej Kacprowski wrote:
> Fix potential buffer overflow where firmware-supplied data_size is cast
> to signed int before being used in min_t(). Large unsigned values
> (>= 0x80000000) become negative, causing unsigned wraparound and
> oversized memcpy operations that can overflow the stack buffer.
>
> Change min_t(int, ...) to min() as both values are unsigned and can be
> handled by min() without explicit cast.
>
> Fixes: 3b434a3445ff ("accel/ivpu: Use threaded IRQ to handle JOB done messages")
> Cc: <stable@vger.kernel.org> # v6.12+
> Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
> ---
> Changes in v2:
> - Replaced min_t() with min()
Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>
>
> drivers/accel/ivpu/ivpu_ipc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
> index f47df092bb0d..9347f05a2b79 100644
> --- a/drivers/accel/ivpu/ivpu_ipc.c
> +++ b/drivers/accel/ivpu/ivpu_ipc.c
> @@ -276,7 +276,7 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
> if (ipc_buf)
> memcpy(ipc_buf, rx_msg->ipc_hdr, sizeof(*ipc_buf));
> if (rx_msg->jsm_msg) {
> - u32 size = min_t(int, rx_msg->ipc_hdr->data_size, sizeof(*jsm_msg));
> + u32 size = min(rx_msg->ipc_hdr->data_size, sizeof(*jsm_msg));
>
> if (rx_msg->jsm_msg->result != VPU_JSM_STATUS_SUCCESS) {
> ivpu_err(vdev, "IPC resp result error: %d\n", rx_msg->jsm_msg->result);
next prev parent reply other threads:[~2026-06-08 7:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b464b589-2d28-4617-baf0-eefbe14e170a@linux.intel.com>
2026-06-01 16:16 ` [PATCH v2] accel/ivpu: Fix signed integer truncation in IPC receive Andrzej Kacprowski
2026-06-08 7:27 ` Wachowski, Karol [this message]
2026-06-09 5:54 ` Wachowski, Karol
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=7218fa4b-bb09-47a8-a2ab-7d381cf7d897@linux.intel.com \
--to=karol.wachowski@linux.intel.com \
--cc=andrzej.kacprowski@linux.intel.com \
--cc=david.laight.linux@gmail.com \
--cc=dawid.osuchowski@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jeff.hugo@oss.qualcomm.com \
--cc=lizhi.hou@amd.com \
--cc=oded.gabbay@gmail.com \
--cc=stable@vger.kernel.org \
/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