All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sumit Garg" <sumit.garg@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 08/14] drm/msm: Switch to generic PAS TZ APIs
Date: Sat, 27 Jun 2026 13:42:26 +0000	[thread overview]
Message-ID: <20260627134227.41B321F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626133440.692849-9-sumit.garg@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Infinite probe deferral on platforms without PAS firmware support.
- [High] TOCTOU race leading to NULL pointer dereference or UAF due to lockless `ops_ptr` access in the generic PAS wrappers.
--

commit 58fde983bce7410af49e9cbf67e95a22f4ec47cb
Author: Sumit Garg <sumit.garg@oss.qualcomm.com>

drm/msm: Switch to generic PAS TZ APIs

Switch drm/msm client drivers over to generic PAS TZ APIs. Generic PAS TZ
service allows to support multiple TZ implementation backends like QTEE
based SCM PAS service, OP-TEE based PAS service and any further future TZ
backend service.

> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index c62c45bb0ddbb..c36382b23310a 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
[ ... ]
> @@ -146,10 +147,10 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
>  		goto out;
>  
>  	/* Send the image to the secure world */
> -	ret = qcom_scm_pas_auth_and_reset(pasid);
> +	ret = qcom_pas_auth_and_reset(pasid);

[Severity: High]
Does this new PAS API wrapper introduce a race condition?

Looking at qcom_pas_auth_and_reset() in drivers/firmware/qcom/qcom_pas.c, it
evaluates ops_ptr without try_module_get() or RCU protection:

int qcom_pas_auth_and_reset(u32 pas_id)
{
	if (!ops_ptr)
		return -ENODEV;

	return ops_ptr->auth_and_reset(ops_ptr->dev, pas_id);
}

If the backend module (like qcom-pas-tee) is unloaded concurrently, could
ops_ptr become NULL after the check but before the dereference, leading to
a NULL pointer dereference or use-after-free?

[ ... ]
> @@ -175,9 +176,9 @@ int adreno_zap_shader_load(struct msm_gpu *gpu, u32 pasid)
>  	if (!zap_available)
>  		return -ENODEV;
>  
> -	/* We need SCM to be able to load the firmware */
> -	if (!qcom_scm_is_available()) {
> -		DRM_DEV_ERROR(&pdev->dev, "SCM is not available\n");
> +	/* We need PAS to be able to load the firmware */
> +	if (!qcom_pas_is_available()) {
> +		DRM_DEV_ERROR(&pdev->dev, "Qcom PAS is not available\n");
>  		return -EPROBE_DEFER;
>  	}

[Severity: High]
Will this cause an infinite probe deferral on platforms without PAS firmware
support?

If a platform lacks both a zap shader node in the device tree and PAS
firmware support, qcom_pas_is_available() will return false. This causes
an immediate -EPROBE_DEFER before we can reach zap_shader_load_mdt(), which
is where we would normally check the device tree and gracefully return
-ENODEV.

With the previous qcom_scm implementation, the SCM subsystem would probe
and be available, allowing this check to pass so the code could proceed to
the graceful fallback.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260626133440.692849-1-sumit.garg@kernel.org?part=8

  reply	other threads:[~2026-06-27 13:42 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 13:34 [PATCH v8 00/14] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-06-26 13:34 ` Sumit Garg via OP-TEE
2026-06-26 13:34 ` [PATCH v8 01/14] firmware: qcom: Add a generic PAS service Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 02/14] firmware: qcom_scm: Migrate to " Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-26 17:05   ` Julian Braha
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 03/14] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 04/14] remoteproc: qcom_q6v5_pas: Switch over to generic PAS TZ APIs Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 05/14] remoteproc: qcom_q6v5_mss: Switch " Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 06/14] remoteproc: qcom_wcnss: " Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 07/14] remoteproc: qcom: Select QCOM_PAS generic service Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 08/14] drm/msm: Switch to generic PAS TZ APIs Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot [this message]
2026-06-26 13:34 ` [PATCH v8 09/14] media: qcom: " Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 10/14] media: qcom: Pass proper PAS ID to set_remote_state API Sumit Garg via OP-TEE
2026-06-26 13:34   ` Sumit Garg
2026-06-26 13:34 ` [PATCH v8 11/14] net: ipa: Switch to generic PAS TZ APIs Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 12/14] wifi: ath12k: " Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-27 13:42   ` sashiko-bot
2026-06-26 13:34 ` [PATCH v8 13/14] firmware: qcom_scm: Remove SCM PAS wrappers Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE
2026-06-26 13:34 ` [PATCH v8 14/14] MAINTAINERS: Add maintainer entry for Qualcomm PAS TZ service Sumit Garg
2026-06-26 13:34   ` Sumit Garg via OP-TEE

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=20260627134227.41B321F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sumit.garg@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.