Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, imx@lists.linux.dev,
	Frank.Li@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 03/12] arm64: dts: imx8qm-mek: fix dsp reserved memory node names for remoteproc
Date: Wed, 29 Jul 2026 13:20:30 +0000	[thread overview]
Message-ID: <20260729132030.AFF8F1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260729-rproc-dts-v2-3-debbe0816202@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing cancellation of `rproc_work` leads to Use-After-Free on driver unbind.
--

--- Patch [3]: [PATCH v2 03/12] arm64: dts: imx8qm-mek: fix dsp reserved memory node names for remoteproc ---
commit ccca82516c9f0cb91d5a0dd4d02b6d18ce2a6c7e
Author: Peng Fan <peng.fan@nxp.com>

arm64: dts: imx8qm-mek: fix dsp reserved memory node names for remoteproc

The imx_dsp_rproc driver checks for the name "vdev0buffer" to skip
mapping the vdev buffer region, as it is handled by
rproc_add_virtio_dev. With the node named "memory", the check fails
and the region gets unnecessarily mapped.

Rename the DSP reserved memory nodes to use proper names for
consistency with other remoteproc reserved memory regions and to
ensure the vdev0buffer check works correctly.

Rename the DSP reserved memory nodes to use the expected names so
the driver can correctly identify and handle each region.

Fixes: d0ee7ae8ce26 ("arm64: dts: imx8qm-mek: enable dsp node for rproc usage")
Signed-off-by: Peng Fan <peng.fan@nxp.com>

> diff --git a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> index 8b67fb5d670da..1afa65bd955ec 100644
> --- a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
[ ... ]
> -		dsp_vdev0buffer: memory@94300000 {
> +		dsp_vdev0buffer: vdev0buffer@94300000 {
>  			compatible = "shared-dma-pool";
>  			reg = <0 0x94300000 0 0x100000>;
>  			no-map;

[Severity: High]
This isn't a bug introduced by this patch, but is there a missing cancellation
of rproc_work in the imx_dsp_rproc driver that could lead to a use-after-free
on driver unbind?

In drivers/remoteproc/imx_dsp_rproc.c:imx_dsp_rproc_probe():

	INIT_WORK(&priv->rproc_work, imx_dsp_rproc_vq_work);

And later in imx_dsp_rproc_rx_tx_callback(), the work is scheduled:

	default:
		schedule_work(&priv->rproc_work);
		break;

Because the driver does not define a remove callback and relies entirely on
devres cleanup, the work is never explicitly cancelled (e.g., via
cancel_work_sync()).

During driver unbind, devm_rproc_alloc teardown will free the rproc structure,
along with its embedded priv. If the scheduled work executes concurrently or is
pending on the system workqueue, it will access the freed priv->rproc, leading
to a use-after-free.

Could a devres action be added to properly flush and destroy this workqueue
before the rproc is freed?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-rproc-dts-v2-0-debbe0816202@nxp.com?part=3

  reply	other threads:[~2026-07-29 13:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 13:07 [PATCH v2 00/12] arm64: dts: freescale: fix reserved memory node names for remoteproc Peng Fan (OSS)
2026-07-29 13:07 ` [PATCH v2 01/12] arm64: dts: imx8dxl-evk: " Peng Fan (OSS)
2026-07-29 13:29   ` sashiko-bot
2026-07-29 13:07 ` [PATCH v2 02/12] arm64: dts: imx8qm-mek: " Peng Fan (OSS)
2026-07-29 13:23   ` sashiko-bot
2026-07-29 13:07 ` [PATCH v2 03/12] arm64: dts: imx8qm-mek: fix dsp " Peng Fan (OSS)
2026-07-29 13:20   ` sashiko-bot [this message]
2026-07-29 13:08 ` [PATCH v2 04/12] arm64: dts: imx8qxp-mek: fix " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 05/12] arm64: dts: imx8qxp-mek: fix dsp " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 06/12] arm64: dts: imx8ulp-evk: fix " Peng Fan (OSS)
2026-07-29 13:36   ` sashiko-bot
2026-07-29 13:08 ` [PATCH v2 07/12] arm64: dts: imx93-11x11-frdm: " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 08/12] arm64: dts: imx93-14x14-evk: " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 09/12] arm64: dts: imx93-9x9-qsb: " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 10/12] arm64: dts: imx8dxl-sr-som: " Peng Fan (OSS)
2026-07-29 14:05   ` sashiko-bot
2026-07-29 13:08 ` [PATCH v2 11/12] arm64: dts: imx93-11x11-evk: " Peng Fan (OSS)
2026-07-29 13:08 ` [PATCH v2 12/12] arm64: dts: imx95-15x15-frdm: " Peng Fan (OSS)
2026-07-29 17:07 ` [PATCH v2 00/12] arm64: dts: freescale: " Frank Li

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=20260729132030.AFF8F1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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