From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>
Cc: Abel Vesa <abelvesa@kernel.org>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] firmware: qcom_scm: handle empty PAS resource table
Date: Tue, 22 Sep 2026 12:42:57 +0200 [thread overview]
Message-ID: <03e3cd69-0d7a-4494-bc0c-d6a623f37681@oss.qualcomm.com> (raw)
In-Reply-To: <20260921195636.1925869-2-mukesh.ojha@oss.qualcomm.com>
On 9/21/26 9:56 PM, Mukesh Ojha wrote:
> The PAS resource-table query may successfully return a zero-sized
> table. kmemdup() with a zero length returns ZERO_SIZE_PTR,
> which is stored in rproc->table_ptr. The remoteproc core then
> dereferences this invalid pointer while processing resources.
>
> Treat a zero-sized result as an absent resource table and return
> NULL after releasing the TrustZone memory buffer. This allows the
> remoteproc core to skip resource-table processing.
>
> Fixes: 8b9d2050cfa0 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table")
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Changes in v2:
> - New change.
>
> drivers/firmware/qcom/qcom_scm.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index df20773dd754..b5959f833dd7 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -823,6 +823,14 @@ static void *qcom_scm_pas_get_rsc_table(struct device *dev,
> goto free_input_rt;
> }
>
> + *output_rt_size = size;
> +
> + /* A zero-sized table means that TrustZone has no resource table. */
> + if (!size) {
> + tbl_ptr = NULL;
> + goto free_output_rt;
> + }
> +
> tbl_ptr = kmemdup(output_rt_tzm, size, GFP_KERNEL);
> if (!tbl_ptr) {
> qcom_tzmem_free(output_rt_tzm);
^ this hunk can additionally be remodeled to jump to this new label
too
Konrad
next prev parent reply other threads:[~2026-09-22 10:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 19:56 [PATCH v2 1/3] firmware: qcom: tzmem: Use DO_ONCE_SLEEPABLE() in qcom_tzmem_enable() Mukesh Ojha
2026-09-21 19:56 ` [PATCH v2 2/3] firmware: qcom_scm: handle empty PAS resource table Mukesh Ojha
2026-09-22 8:41 ` Bartosz Golaszewski
2026-09-22 10:42 ` Konrad Dybcio [this message]
2026-09-22 12:00 ` Bartosz Golaszewski
2026-09-21 19:56 ` [PATCH v2 3/3] firmware: qcom_scm: align PAS resource table retry Mukesh Ojha
2026-09-22 8:33 ` Bartosz Golaszewski
2026-09-22 10:43 ` Konrad Dybcio
2026-09-25 14:15 ` (subset) [PATCH v2 1/3] firmware: qcom: tzmem: Use DO_ONCE_SLEEPABLE() in qcom_tzmem_enable() Bjorn Andersson
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=03e3cd69-0d7a-4494-bc0c-d6a623f37681@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.ojha@oss.qualcomm.com \
/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
all inboxes | Powered by JetHome®