public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: firmware: qcom: Add a generic PAS service
Date: Tue, 28 Apr 2026 14:49:22 +1000	[thread overview]
Message-ID: <review-patch2-20260427095603.1157963-3-sumit.garg@kernel.org> (raw)
In-Reply-To: <20260427095603.1157963-3-sumit.garg@kernel.org>

Patch Review

This is the core abstraction patch. Several observations:

**Race condition between ops access and unregistration.** Every exported function does a bare pointer check then dereferences through it:
```c
int qcom_pas_init_image(u32 pas_id, const void *metadata, size_t size,
			struct qcom_pas_context *ctx)
{
	if (!ops_ptr)
		return -ENODEV;

	return ops_ptr->init_image(ops_ptr->dev, pas_id, metadata, size, ctx);
}
```
If `qcom_pas_ops_unregister()` sets `ops_ptr = NULL` between the check and the dereference, this is a NULL pointer dereference. The `smp_load_acquire`/`smp_store_release` in `qcom_pas_is_available()` and `qcom_pas_ops_register()` only provide memory ordering, not mutual exclusion. In practice, shutdown is serialized with driver usage, so this is unlikely to trigger, but it would be more robust to use `rcu_dereference`/`rcu_assign_pointer` (with an `rcu_read_lock()` around each call) or an `srcu` approach. At minimum, each exported function should do:
```c
struct qcom_pas_ops *ops = smp_load_acquire(&ops_ptr);
if (!ops)
    return -ENODEV;
return ops->init_image(ops->dev, ...);
```
to snapshot the pointer once rather than reading the global twice.

**Stale kerneldoc reference.** The `qcom_pas_prepare_and_auth_reset()` doc says:
```
 * @ctx:	Context saved during call to qcom_scm_pas_context_init()
```
This should reference `devm_qcom_pas_context_alloc()` instead.

**`qcom_pas_ops_register()` silently fails.** If called when ops are already registered, it prints `pr_err` but otherwise does nothing and returns void. There's no way for the caller to know it failed. Consider returning an int error code, or at least using `WARN_ON`.

**`drv_name` field in `qcom_pas_ops` is never used.** It's set but never referenced -- dead code.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-28  4:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  9:55 [PATCH v4 00/15] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-04-27  9:55 ` [PATCH v4 01/15] arm64: dts: qcom: kodiak: Add EL2 overlay Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 02/15] firmware: qcom: Add a generic PAS service Sumit Garg
2026-04-28  4:49   ` Claude Code Review Bot [this message]
2026-04-27  9:55 ` [PATCH v4 03/15] firmware: qcom_scm: Migrate to " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 04/15] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 05/15] remoteproc: qcom_q6v5_pas: Switch over to generic PAS TZ APIs Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 06/15] remoteproc: qcom_q6v5_mss: Switch " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 07/15] soc: qcom: mdtloader: " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 08/15] remoteproc: qcom_wcnss: " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 09/15] remoteproc: qcom: Select QCOM_PAS generic service Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 10/15] drm/msm: Switch to generic PAS TZ APIs Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:55 ` [PATCH v4 11/15] media: qcom: " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:56 ` [PATCH v4 12/15] net: ipa: " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:56 ` [PATCH v4 13/15] wifi: ath12k: " Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:56 ` [PATCH v4 14/15] firmware: qcom_scm: Remove SCM PAS wrappers Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-27  9:56 ` [PATCH v4 15/15] MAINTAINERS: Add maintainer entry for Qualcomm PAS TZ service Sumit Garg
2026-04-28  4:49   ` Claude review: " Claude Code Review Bot
2026-04-28  4:49 ` Claude review: firmware: qcom: Add OP-TEE PAS service support Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-04 13:05 [PATCH v5 00/16] " Sumit Garg
2026-05-04 13:05 ` [PATCH v5 02/16] firmware: qcom: Add a generic PAS service Sumit Garg
2026-05-04 22:22   ` Claude review: " Claude Code Review Bot
2026-03-12  6:27 [PATCH v2 00/15] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-03-12  6:27 ` [PATCH v2 02/15] firmware: qcom: Add a generic PAS service Sumit Garg
2026-03-13  4:26   ` Claude review: " Claude Code Review Bot
2026-03-06 10:50 [PATCH 00/14] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-03-06 10:50 ` [PATCH 02/14] firmware: qcom: Add a generic PAS service Sumit Garg
2026-03-08 22:59   ` Claude review: " Claude Code Review Bot

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=review-patch2-20260427095603.1157963-3-sumit.garg@kernel.org \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.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