Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anandu Krishnan E" <anandu.e@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/4] misc: fastrpc: add HPASS domain
Date: Wed, 25 Nov 2026 00:24:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-232275@kernel.org> (raw)
In-Reply-To: <20261125-fastrpc-hpass-support-v1-2-cb1d46b29e3b@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] misc: fastrpc: use-after-free due to dangling dma_mask in
  fastrpc_rpmsg_probe() [1]
--

commit 45628114d33912de02c404c2680ce4e7336df5df
Author: Anandu Krishnan E <anandu.e@oss.qualcomm.com>

misc: fastrpc: add HPASS domain

This commit adds HPASS_DOMAIN_ID for the High Performance Audio Subsystem
(HPASS), maps the "hpass" devicetree label to it, and enables reserved
remote heap memory and device registration for the domain.

> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 9e760f68bcaf2..c515097c3d3ba 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c

[ ... ]

> @@ -2761,6 +2765,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  	case ADSP_DOMAIN_ID:
>  	case MDSP_DOMAIN_ID:
>  	case SDSP_DOMAIN_ID:
> +	case HPASS_DOMAIN_ID:
>  		/* Unsigned PD offloading is only supported on CDSP and GDSP */
>  		data->unsigned_support = false;
>  		err = fastrpc_device_register(rdev, data, secure_dsp, domain);

[Severity: Critical]
This problem wasn't introduced by this patch, but can fastrpc_rpmsg_probe()
leave a dangling rdev->dma_mask pointer [1]?

drivers/misc/fastrpc.c:fastrpc_rpmsg_probe() {
    ...
	rdev->dma_mask = &data->dma_mask;
	dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32));
    ...
	err = fastrpc_cb_devices_create(rpdev);
	if (err)
		goto err_deregister_fdev;
    ...
err_free_data:
	kfree(data);
	return err;
}

fastrpc_rpmsg_probe() points rdev->dma_mask at data->dma_mask inside the
heap-allocated fastrpc_channel_ctx.  If fastrpc_cb_devices_create() fails
or the driver is later unbound via fastrpc_rpmsg_remove() ->
fastrpc_channel_ctx_put(), data is freed while rpdev->dev lives on with
rdev->dma_mask still pointing into the freed object, causing a
use-after-free on any subsequent probe or DMA API access on the device.

[1] https://sashiko.dev/#/bug/linux-3d83ea49-16e6-4a33-9f74-77e4b19335b8

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-fastrpc-hpass-support-v1-0-cb1d46b29e3b@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-25  0:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  0:06 [PATCH 0/4] misc: fastrpc: add HPASS domain support Anandu Krishnan E
2026-11-25  0:06 ` [PATCH 1/4] dt-bindings: misc: qcom,fastrpc: add hpass label Anandu Krishnan E
2026-11-25  0:06 ` [PATCH 2/4] misc: fastrpc: add HPASS domain Anandu Krishnan E
2026-11-25  0:24   ` sashiko-bot [this message]
2026-11-25  0:06 ` [PATCH 3/4] misc: fastrpc: query the dsp capabilities during probe time Anandu Krishnan E
2026-11-25  0:28   ` sashiko-bot
2026-11-25  0:06 ` [PATCH 4/4] misc: fastrpc: expose unsigned PD node for compute-capable HPASS Anandu Krishnan E

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=sashiko-outbox-232275@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anandu.e@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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