dri-devel Archive on lore.kernel.org
 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
Subject: Re: [PATCH 2/2] misc: fastrpc: expose unsigned PD node for compute-capable ADSP
Date: Fri, 27 Nov 2026 10:20:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-237100@kernel.org> (raw)
In-Reply-To: <20261127-master-v1-2-f998ec22497b@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] misc: fastrpc: unsigned ADSP node bypasses
  is_session_rejected() on attach
- [Medium] misc: fastrpc: double misc_deregister() on
  fastrpc_register_devices() failure
--

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

misc: fastrpc: expose unsigned PD node for compute-capable ADSP

This commit registers both the secure and non-secure fastrpc device nodes
when an ADSP domain reports FASTRPC_DSP_COMPUTE_LITE in its cached DSP
attributes.

> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 48ded6080ddd6..28d29c768aad7 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c

[ ... ]

> @@ -2647,6 +2664,9 @@ static int fastrpc_register_devices(struct fastrpc_channel_ctx *cctx,
>  
>  	switch (cctx->domain_id) {
>  	case ADSP_DOMAIN_ID:
> +		if (compute_capable)
> +			goto unsigned_capable;
> +		fallthrough;

[Severity: High]
Can an untrusted application opening the non-secure /dev/fastrpc-adsp
node on a secure ADSP channel bypass is_session_rejected() and attach to
signed protection domains?

Jumping to unsigned_capable registers a non-secure node (fl->is_secure_dev
is false) on a secure ADSP channel (fl->cctx->secure is true).  While
fastrpc_init_create_process() calls is_session_rejected() to restrict
non-secure nodes to unsigned PD requests, neither
fastrpc_init_create_static_process() nor fastrpc_init_attach() checks
is_session_rejected(fl, false).  Unlike CDSP and GDSP, ADSP populates
cctx->remote_heap_addr, so an unprivileged caller holding an fd to
/dev/fastrpc-adsp can invoke FASTRPC_IOCTL_INIT_CREATE_STATIC,
FASTRPC_IOCTL_INIT_ATTACH, or FASTRPC_IOCTL_INIT_ATTACH_SNS to attach to
the static Audio PD, ROOT_PD, or SENSORS_PD and invoke remote methods in
those privileged PDs.

>  	case MDSP_DOMAIN_ID:
>  	case SDSP_DOMAIN_ID:
>  		/* Unsigned PD offloading is only supported on CDSP and GDSP */
> @@ -2657,6 +2677,7 @@ static int fastrpc_register_devices(struct fastrpc_channel_ctx *cctx,
>  		break;
>  	case CDSP_DOMAIN_ID:
>  	case GDSP_DOMAIN_ID:
> +unsigned_capable:
>  		cctx->unsigned_support = true;
>  		/* Create both device nodes so that we can allow both Signed and Unsigned PD */
>  		err = fastrpc_device_register(rdev, cctx, true, cctx->domain);

[Severity: Medium]
Can a failure when registering the second device node under
unsigned_capable cause a double misc_deregister() on
cctx->secure_fdevice->miscdev?

If the first fastrpc_device_register() succeeds and sets
cctx->secure_fdevice, and the second fastrpc_device_register() for the
non-secure node fails, err_deregister_fdev deregisters
cctx->secure_fdevice->miscdev without clearing cctx->secure_fdevice to
NULL:

drivers/misc/fastrpc.c:fastrpc_register_devices() {
	...
err_deregister_fdev:
	if (cctx->fdevice)
		misc_deregister(&cctx->fdevice->miscdev);
	if (cctx->secure_fdevice)
		misc_deregister(&cctx->secure_fdevice->miscdev);

	return err;
}

Because fastrpc_register_devices() runs asynchronously in
fastrpc_cap_query_work() after fastrpc_rpmsg_probe() has already returned
0, the rpmsg device remains bound.  When fastrpc_rpmsg_remove() later runs
on channel teardown, it sees cctx->secure_fdevice still non-NULL and calls
misc_deregister(&cctx->secure_fdevice->miscdev) a second time, freeing an
already-freed minor number.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-master-v1-0-f998ec22497b@oss.qualcomm.com?part=2

      parent reply	other threads:[~2026-11-27 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  9:56 [PATCH 0/2] misc: fastrpc: probe-time DSP capability query and unsigned ADSP node Anandu Krishnan E
2026-11-27  9:56 ` [PATCH 1/2] misc: fastrpc: query the dsp capabilities during probe time Anandu Krishnan E
2026-11-27 10:23   ` sashiko-bot
2026-12-01 10:48   ` Murali Krishna
2026-11-27  9:56 ` [PATCH 2/2] misc: fastrpc: expose unsigned PD node for compute-capable ADSP Anandu Krishnan E
2026-11-27 10:06   ` Konrad Dybcio
2026-11-27 10:20   ` sashiko-bot [this message]

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-237100@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anandu.e@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.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