From: sashiko-bot@kernel.org
To: "Sumit Garg" <sumit.garg@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 02/14] firmware: qcom_scm: Migrate to generic PAS service
Date: Sat, 27 Jun 2026 13:42:29 +0000 [thread overview]
Message-ID: <20260627134229.E25EA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626133440.692849-3-sumit.garg@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removing the `if (!ctx->ptr)` check from the metadata release path causes a kernel crash when called with a `NULL` pointer on error paths or during teardown.
--
commit e2ee3fe2c5f5a59a30d27512b70afb597cba4bec
Author: Sumit Garg <sumit.garg@oss.qualcomm.com>
firmware: qcom_scm: Migrate to generic PAS service
With the availability of generic PAS service, this patch adds SCM calls as
a backend to keep supporting legacy QTEE interfaces. The exported qcom_scm*
wrappers will get dropped once all the client drivers get migrated as part
of future patches.
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index 6b601a4b89dbf..7933e55803dc2 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
[ ... ]
> -/**
> - * qcom_scm_pas_metadata_release() - release metadata context
> - * @ctx: pas context
> - */
> -void qcom_scm_pas_metadata_release(struct qcom_scm_pas_context *ctx)
> +static void __qcom_scm_pas_metadata_release(struct device *dev,
> + struct qcom_pas_context *ctx)
> {
> - if (!ctx->ptr)
> - return;
> + if (ctx->use_tzmem)
> + qcom_tzmem_free(ctx->ptr);
> else
> - dma_free_coherent(__scm->dev, ctx->size, ctx->ptr, ctx->phys);
> + dma_free_coherent(dev, ctx->size, ctx->ptr, ctx->phys);
[Severity: High]
Will this cause a kernel crash by passing a NULL pointer to
dma_free_coherent() on error paths?
If a client driver calls qcom_scm_pas_init_image() and it fails before
setting ctx->ptr (for example, if dma_alloc_coherent() fails), the
client's error handler will then call qcom_scm_pas_metadata_release().
Since the !ctx->ptr check was removed, this would execute
dma_free_coherent() with a NULL pointer.
I note that a later commit in the series (commit 823d5bd22444cb98ee7ba)
removes these SCM PAS wrappers entirely after clients are migrated.
However, does removing this safety check here break bisection for
existing client drivers in the meantime?
>
> ctx->ptr = NULL;
> }
> +
> +void qcom_scm_pas_metadata_release(struct qcom_scm_pas_context *ctx)
> +{
> + __qcom_scm_pas_metadata_release(__scm->dev,
> + (struct qcom_pas_context *)ctx);
> +}
> EXPORT_SYMBOL_GPL(qcom_scm_pas_metadata_release);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626133440.692849-1-sumit.garg@kernel.org?part=2
next prev parent 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 [this message]
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
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=20260627134229.E25EA1F000E9@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.