net: dsa: mt7530: check CORE_PLL_GROUP4 access in mt7531_setup()
Subsystems (71)
Sasha Levin
maintainerPATCH 1/1 nvme-tcp: delay nvme_tcp_reclassify_socket()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 447a7a3026eda85ac2738cbe6ee5ab066a39dad0 ]
Commit 841aee4d75f1 ("nvme-tcp: lockdep: annotate in-kernel sockets") introduced nvme_tcp_reclassify_socket() to resolve a lockdep WARN by distinguishing userspace sockets from nvme-tcp sockets. After that, TLS encryption support was introduced to nvme-tcp and it added another lock dependency on userspace socket handling by tlshd, which resulted in a new lockdep WARN. This WARN was hidden by the commit 19bdb70c77d3 ("nvme-tcp: lockdep: use dynamic lockdep keys per socket instance"). However, it turned out the commit 19bdb70c77d3 has a bug of lockdep key lifetime management, and it is to be reverted by another patch in this series. After the revert, the WARN was unveiled and observed at the blktests test case nvme/062:
WARNING: possible circular locking dependency detected
7.3.0-rc2+ #455 Tainted: G W
------------------------------------------------------
tlshd/75867 is trying to acquire lock:
ffffffff91ada5e0 (fs_reclaim){+.+.}-{0:0}, at: __kmalloc_cache_noprof+0x64/0x6d0
but task is already holding lock:
ffff888197808258 (sk_lock-AF_INET-NVME){+.+.}-{0:0}, at: do_tcp_setsockopt+0x499/0x26a0
which lock already depends on the new lock.
To fix the lockdep WARN caused by the TLS encryption support, delay the reclassification of the nvme-tcp sockets. Currently the reclassification happens before the TLS handshake starts, which pulls in the additional lock dependencies related to tlshd. Reclassify the sockets after the TLS handshake instead, to cut that dependency.
---
LLM Generated explanations, may be completely bogus:
This tree is **6.18.57** (v6.18.57-155-gcdf239ca885b2). The question is whether nvme-tcp: delay nvme_tcp_reclassify_socket() should be backported **here**. The buggy pattern is present in 6.18, the change is three lines, and it does not depend on the 7.3-era revert that accompanied it upstream.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [nvme-tcp] [delay] delay nvme_tcp_reclassify_socket() until after the TLS handshake
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- `Link: https://lore.kernel.org/lkml/CANn89i+wnTLC==UnXCpjsS4YxvEfhe5oK
[email protected]/` (Eric Dumazet report of the lockdep-key lifetime bug)
- Reviewed-by: Nilay Shroff <[email protected]>
- Signed-off-by: Eric Dumazet <[email protected]> (author)
- Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
- Signed-off-by: Keith Busch <[email protected]> (NVMe maintainer)
- No Fixes: tag (expected)
- No Cc: stable (expected)
- No Reported-by: / syzbot tag on this commit itself (the Link is the related lockdep-key discussion)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** After 841aee4d75f1 put nvme-tcp sockets in a private lock class, TLS support made tlshd operate on an already-reclassified NVME socket. That pulled userspace TLS lock dependencies into sk_lock-AF_INET-NVME.
- **Symptom:** lockdep WARNING: possible circular locking dependency detected in blktests nvme/062. tlshd holds sk_lock-AF_INET-NVME and tries to take fs_reclaim via __kmalloc_cache_noprof.
- **Hiding commit:** 19bdb70c77d3 (dynamic per-socket lockdep keys) hid the WARN, then proved buggy and is reverted by patch 1/2 of the same series.
- **Fix:** reclassify after the TLS handshake so tlshd runs against the default socket class.
- **Version in the splat:** 7.3.0-rc2+; that is the mainline observation, not a claim that 6.18 is unaffected.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is an explicit lockdep-isolation fix. nvme_tcp_reclassify_socket() is already a no-op without CONFIG_DEBUG_LOCK_ALLOC, so the runtime effect is lockdep-only.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/nvme/host/tcp.c (+2 / -1)
- Function: nvme_tcp_alloc_queue()
- Scope: single-file surgical move of one call
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** sock_create_kern → sock_alloc_file → sk_net_refcnt_upgrade → **nvme_tcp_reclassify_socket()** → sockopts/connect → optional nvme_tcp_start_tls() → nvme_tcp_init_connection()
- **After:** same path, but reclassify runs **after** TLS handshake (or after connect if TLS is not used), still **before** nvme_tcp_init_connection()
- Affected path: queue allocation / controller connect, including the TLS handshake path
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- Category: lockdep class mixing (userspace tlshd vs in-kernel nvme- tcp), same family as 841aee4d75f1
- Mechanism: early reclassify makes TLS setsockopt/kmalloc look like NVME-class sk_lock → fs_reclaim. Combined with existing NVME-class reclaim dependencies, lockdep reports a cycle.
- Fix: keep handshake on the default AF_INET class; switch to NVME class only once kernel NVMe protocol I/O begins.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: one call moved past the userspace-like handshake.
- Minimal; no API/data-structure change.
- Regression risk is low. sock_allow_reclassification() only requires the socket not to be user-owned or slocked; nvme_tcp_start_tls() waits for handshake completion before returning. Failed TLS goes to err_init_connect without reclassify, which is fine because the socket is being torn down. Reviewers accepted this; blktests nvme/062 was reported to pass.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Reclassify call introduced by 841aee4d75f1 (Chris Leech, 2022-02-15; in this tree, first appeared around 5.18).
- TLS handshake call introduced by be8e82caa6859 (Hannes Reinecke, 2023-08-24; v6.7-rc1).
- The lockdep WARN exists from TLS introduction onward whenever reclassify happens first.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Referenced commits:
- 841aee4d75f1: **is** an ancestor of this tree.
- 19bdb70c77d3: **is not** an ancestor of HEAD or of v6.18 (dated 2026-06-04, contained around 7.x). The “hiding” commit never landed here, so the TLS lockdep WARN was never suppressed in 6.18.y.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: This is **patch 2/2** of Shin'ichiro Kawasaki’s series “nvme-
tcp: do not use dynamic lockdep key for socket instances”:
1. Revert 19bdb70c77d3
2. This delay of reclassify
Patch 1 is a no-op for this tree (nothing to revert). This delay patch is standalone on 6.18.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Authored by Eric Dumazet (networking/lockdep); submitted by Shin'ichiro Kawasaki; applied by Keith Busch. Cover letter: tested on v7.3-rc2, nvme/005 and nvme/062 pass with no lockdep splat.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS** Record:
- Revert of 19bdb70c77d3: **not needed** here.
- Cover letter also cites 0ba6912f7e97 (“Revert once: don't use a work queue…”) to cut a **different** chain (sk_lock → cpu_hotplug_lock) for nvme/005. That commit is **not** in this tree, and it is **not** a prerequisite of this TLS reclassify move.
- nvme_tcp_reclassify_socket(), nvme_tcp_start_tls(), and the alloc_queue control flow all exist in v6.18 with the same ordering the patch expects.
Can this apply standalone? **Yes.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 447a7a3026eda85ac2738cbe6ee5ab066a39dad0 → https://patch.m
sgid.link/20260914074853.3990397-3- [email protected]
- Cover: https://patch.msgid.link/20260914074853.3990397-1-
[email protected]
- Single revision (v1 of a 2-patch series). Direct lore.kernel.org fetch returned 403; full thread was retrieved via b4 dig -m.
- No NAKs. Keith Busch: “Thanks, applied to nvme-7.3.”
- No reviewer Cc: stable suggestion found in the thread.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): linux-nvme, Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, Eric Dumazet, Nilay Shroff. Nilay: “Looks good to me.” / Reviewed-by. Eric reviewed the companion revert.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: Observed in blktests nvme/062 (NVMe-TCP TLS). The Link tag is Eric’s report of the *dynamic key* lifetime WARN that motivated the revert; this delay patch is the follow-up so that revert does not re- expose the TLS class-mixing splat. Severity: lockdep warning, not a reported production hang.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Companion revert is irrelevant to 6.18. A side discussion about keeping per-queue dynamic keys was dropped; Eric argued static “kernel vs user” classes are sufficient and per-instance keys hide real AB/BA bugs. That does not affect this delay patch.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: Web search of lore.kernel.org/stable for this subject did not turn up a prior stable discussion or an explicit rejection.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: nvme_tcp_alloc_queue() (call moved); helper nvme_tcp_reclassify_socket() unchanged; handshake still in nvme_tcp_start_tls().
**Step 5.2: TRACE CALLERS**
Record: nvme_tcp_alloc_queue() is called from nvme_tcp_alloc_admin_queue() and __nvme_tcp_alloc_io_queues() during controller setup. Userspace trigger: connecting an NVMe/TCP controller (nvme-cli / nvmf), including TLS PSK when CONFIG_NVME_TCP_TLS is enabled.
**Step 5.3: TRACE CALLEES**
Record: nvme_tcp_start_tls() → tls_client_hello_psk() + wait for tlshd. Reclassify → sock_lock_init_class_and_name() only under CONFIG_DEBUG_LOCK_ALLOC.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from normal NVMe/TCP connect. The lockdep splat needs lockdep + TLS + tlshd. Without lockdep the moved function is an empty stub in this tree (static void nvme_tcp_reclassify_socket(struct socket *sock) { } in the #else of CONFIG_DEBUG_LOCK_ALLOC).
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same reclassify pattern exists in sunrpc (xprtsock.c, svcsock.c), SMB client, Bluetooth. Those also guard with sock_allow_reclassification(). This is the established in-kernel socket isolation approach.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** On v6.18:
``` 1801: nvme_tcp_reclassify_socket(queue->sock); /* immediately after create */ 1885: ret = nvme_tcp_start_tls(...); /* later */ 1890: ret = nvme_tcp_init_connection(queue); ```
TLS (be8e82caa6859) and static reclassify (841aee4d75f1) are both in 6.18. Dynamic keys (19bdb70c77d3) are not, so the TLS lockdep WARN is live here, not hypothetical.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Clean apply. The hunk is a single function-call move around nvme_tcp_start_tls() / nvme_tcp_init_connection(), which have the same shape in v6.18. Later sockaddr_unsized / __fput_sync churn does not touch this call.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No equivalent delay of reclassify in 6.18 history. No other TLS lockdep isolation fix on this path.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: NVMe over Fabrics TCP host (drivers/nvme/host/tcp.c). **IMPORTANT** for NVMe/TCP users; not core mm/VFS. TLS is CONFIG_NVME_TCP_TLS (“If unsure, say N”).
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained (TLS, digest, security, reconnect). This is a targeted lockdep fix, not a refactor of new 7.3 infrastructure.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: NVMe/TCP users with CONFIG_NVME_TCP_TLS **and** CONFIG_DEBUG_LOCK_ALLOC/LOCKDEP, during TLS connect (tlshd). Production configs without lockdep: no functional change (stub function).
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Controller connect with TLS PSK, lockdep enabled. Reproduced by blktests nvme/062. Not an unprivileged syscall smash; it is a privileged NVMe fabrics connect path. Timing: every TLS queue setup, not a rare race.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: lockdep circular-dependency **WARNING** (kernel tainted W). Discussion treats it as class mixing (false cycle from tlshd vs in- kernel NVMe), not a confirmed production deadlock. The same isolation hole has existed since TLS landed in 6.7; no production hang report was found for this chain. Severity: **MEDIUM** for debug/CI kernels, **LOW** for production 6.18 users.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: restores the 841aee4d75f1 kernel-vs-user isolation for TLS; silences a real blktests splat; keeps lockdep usable on NVMe/TCP+TLS.
- Risk: very low (3-line move, no-op without lockdep, reviewed, tested).
- Ratio: favorable. The “important issue” bar is the only weak point, not correctness or applyability.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Buggy ordering exists in this 6.18 tree (reclassify before TLS).
- Tiny, obviously correct, reviewed by Nilay Shroff, applied by Keith Busch, idea from Eric Dumazet.
- Tested (blktests nvme/062).
- Applies cleanly; no missing helpers or struct changes.
- Companion revert is **not** required here because 19bdb70c77d3 never landed.
- Zero production behavioral change without lockdep.
- Same class of fix as the existing 841aee4d75f1 annotation; TLS had re-broken that isolation.
AGAINST:
- Debug-only (nvme_tcp_reclassify_socket() is empty without CONFIG_DEBUG_LOCK_ALLOC).
- Not a reported oops, hang, corruption, or CVE.
- Needs optional TLS + tlshd + lockdep to fire.
- Written as patch 2/2 of a 7.3 series whose other half does not apply here (that is not a blocker; it just explains origin).
UNRESOLVED:
- Direct lore.kernel.org HTTP fetch returned 403; thread content was still verified via b4 dig -m.
- No stable-list nomination/rejection found.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** (3-line move; Reviewed-by; blktests nvme/062)
2. Fixes a real bug that affects users? **PASS** (reproducible lockdep WARN on NVMe/TCP TLS connect; bothers debug/CI users)
3. Important issue? **PASS** (weak but acceptable: lockdep splat / “oh, that's not good”; restores lock-class isolation that this tree already relies on)
4. Small and contained? **PASS** (3 lines, one function)
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** (v6.18 has the same call sites)
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. Ordinary small bugfix.
**Step 9.4: MAKE YOUR DECISION**
Backport. The defect is in this tree, the patch is self-contained without the 7.3 revert, and the risk is negligible. Leaving early reclassify in place keeps a known lockdep isolation hole in NVMe/TCP TLS on 6.18.y.
---
### What the commit solves for this tree
On 6.18, nvme-tcp still reclassifies sockets immediately after create, then may run a TLS handshake via tlshd. That puts userspace handshake locking into the NVME socket class and produces a lockdep circular- dependency warning (blktests nvme/062). Moving reclassify to after handshake (and after connect when TLS is off) cuts that dependency. Production kernels without lockdep do not change behavior.
### Stable rules / risk
Meets the written rules: small, obviously correct, tested, no new API, applies here. Benefit is debug/CI lockdep correctness; regression risk is essentially zero.
### Concerns
Do not pull in the companion revert of 19bdb70c77d3 (absent here). Do not treat 0ba6912f7e97 as a dependency of this patch; that is a separate nvme/005 lock chain.
---
Verification:
- [Phase 1] Parsed tags: Link to Eric’s lore report; Reviewed-by Nilay Shroff; SOBs Eric Dumazet, Shin'ichiro Kawasaki, Keith Busch; no Fixes/Cc:stable
- [Phase 2] Diff: move nvme_tcp_reclassify_socket() in nvme_tcp_alloc_queue() from after sk_net_refcnt_upgrade to after optional nvme_tcp_start_tls(), +2/-1
- [Phase 2] Confirmed #else stub: function is empty without CONFIG_DEBUG_LOCK_ALLOC in this tree
- [Phase 3] git describe HEAD / Makefile: 6.18.57
- [Phase 3] git merge-base --is-ancestor 841aee4d75f1 HEAD: YES (reclassify present)
- [Phase 3] git merge-base --is-ancestor be8e82caa6859 HEAD: YES (TLS present)
- [Phase 3] git merge-base --is-ancestor 19bdb70c77d3 HEAD: NO (hiding/dynamic-key commit not in 6.18)
- [Phase 3] git grep on v6.18:drivers/nvme/host/tcp.c: reclassify at line 1801, TLS at 1885 — buggy order confirmed
- [Phase 3] git blame v6.18 -- drivers/nvme/host/tcp.c: reclassify = 841aee4d75f1, TLS = be8e82caa6859
- [Phase 3] git merge-base --is-ancestor 0ba6912f7e97 HEAD: NO; not required for this hunk
- [Phase 4] b4 dig -c 447a7a3026…: patch 2/2, msgid 20260914074853.3990397-3-…
- [Phase 4] b4 dig -a: v1 series only (cover + revert + this patch)
- [Phase 4] b4 dig -w: linux-nvme + Busch/Axboe/Hellwig/Grimberg/Dumazet/Shroff
- [Phase 4] mbox: Nilay Reviewed-by; Keith applied to nvme-7.3; no NAK; no Cc:stable
- [Phase 4] lore.kernel.org WebFetch: 403; used b4 mbox instead
- [Phase 4] stable list search: no prior discussion found
- [Phase 5] Callers: nvme_tcp_alloc_admin_queue, __nvme_tcp_alloc_io_queues (controller setup)
- [Phase 5] sock_allow_reclassification(): !sock_owned_by_user && !spin_is_locked(slock)
- [Phase 6] Apply: same surrounding symbols in v6.18; expected clean
- [Phase 8] Failure mode: lockdep WARNING on TLS connect, not a verified production deadlock
- UNVERIFIED: whether any distro 6.18 debug kernel has a live user report of this splat (commit cites blktests, not a distro bugzilla)
The patch is small, the buggy ordering is in this 6.18 tree, and it does not need the later revert series to be useful.
**YES**
drivers/nvme/host/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +2 -1
@@ -1859,7 +1859,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, }sk_net_refcnt_upgrade (queue->sock->sk); -nvme_tcp_reclassify_socket (queue->sock);/* Single syn retry */ tcp_sock_set_syncnt (queue->sock->sk,1 );
@@ -1948,6 +1947,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, goto err_init_connect; } +nvme_tcp_reclassify_socket (queue->sock); + ret =nvme_tcp_init_connection (queue);if (ret) goto err_init_connect;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] nvme-tcp: delay nvme_tcp_reclassify_socket()
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] nvme-tcp: unsafe live lock reinit in nvme_tcp_reclassify_socket() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] nvme-tcp: unsafe live lock reinit in nvme_tcp_reclassify_socket() --
commit 168d45f90ed1a7b47f62fbd5085e5e0bbb05d5a8
Author: Eric Dumazet <[email protected]>
nvme-tcp: delay nvme_tcp_reclassify_socket()
This commit delays nvme_tcp_reclassify_socket() in nvme_tcp_alloc_queue() until after kernel_connect() and the optional nvme_tcp_start_tls() handshake complete, in order to avoid pulling tlshd lock dependencies into the nvme-tcp socket lockdep class.
Quoted 13 lines
drivers/nvme/host/tcp.c +0
-1@@ -1859,7 +1859,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, }sk_net_refcnt_upgrade (queue->sock->sk); -nvme_tcp_reclassify_socket (queue->sock);/* Single syn retry */ tcp_sock_set_syncnt (queue->sock->sk,1 );
drivers/nvme/host/tcp.c static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, · line 1951
Quoted 5 lines
drivers/nvme/host/tcp.c +2
-0@@ -1948,6 +1947,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, goto err_init_connect; } +nvme_tcp_reclassify_socket (queue->sock); +
[Severity: High]
Is it safe to call nvme_tcp_reclassify_socket() here after kernel_connect() and nvme_tcp_start_tls() have already run?
When CONFIG_DEBUG_LOCK_ALLOC is enabled, nvme_tcp_reclassify_socket() checks sock_allow_reclassification() and calls sock_lock_init_class_and_name() in process context with bottom halves enabled and no lock held:
drivers/nvme/host/tcp.c:nvme_tcp_reclassify_socket() {
struct sock *sk = sock->sk;
if (WARN_ON_ONCE(!sock_allow_reclassification(sk)))
return;
switch (sk->sk_family) {
case AF_INET:
sock_lock_init_class_and_name(sk, "slock-AF_INET-NVME",
&nvme_tcp_slock_key[0],
"sk_lock-AF_INET-NVME",
&nvme_tcp_sk_key[0]);
break;
...
}And sock_lock_init_class_and_name() reinitializes sk->sk_lock in-place:
include/net/sock.h:sock_lock_init_class_and_name()
sk_owner_set(sk, THIS_MODULE); sk->sk_lock.owned = 0; init_waitqueue_head(&sk->sk_lock.wq); spin_lock_init(&(sk)->sk_lock.slock); debug_check_no_locks_freed((void *)&(sk)->sk_lock, sizeof((sk)->sk_lock)); lockdep_set_class_and_name(&(sk)->sk_lock.slock, (skey), (sname)); lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0);
At this point in nvme_tcp_alloc_queue() (reached from nvme_tcp_alloc_admin_queue() or __nvme_tcp_alloc_io_queues()), kernel_connect() has already transitioned queue->sock->sk to TCP_ESTABLISHED, hashed it into inet_ehash, and armed TCP timers. In addition, when TLS is used, handshake_nl_done_doit() -> handshake_complete() -> nvme_tcp_tls_done() completes queue->tls_complete before userspace tlshd closes its open file descriptor to queue->sock->file.
If incoming peer packets (such as TCP ACKs, window updates, TLS 1.3 post-handshake NewSessionTicket messages, or FIN/RST) trigger softirq TCP RX (tcp_v4_rcv() / tcp_v6_rcv()), or if TCP timers (tcp_write_timer() / tcp_delack_timer()) or tlshd activity coincide with nvme_tcp_reclassify_socket():
1. Can softirq or tlshd acquire sk->sk_lock.slock or sk->sk_lock right after sock_allow_reclassification(sk) succeeds, racing with spin_lock_init(), init_waitqueue_head(), sk->sk_lock.owned = 0, debug_check_no_locks_freed(), lockdep_set_class_and_name(), and lockdep_init_map() to corrupt the spinlock, waitqueue, and lockdep state?
2. If softirq or tlshd already holds sk->sk_lock.slock or sk->sk_lock.owned when sock_allow_reclassification(sk) is checked, won't this trigger WARN_ON_ONCE(!sock_allow_reclassification(sk)) and abort reclassification, leaving the socket in the default lockdep class?
Quoted 3 lines
drivers/nvme/host/tcp.c +0
-0ret =nvme_tcp_init_connection (queue);if (ret) goto err_init_connect;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 media: go7007: avoid undefined shifts in MPEG-4 headers
In reply to Sasha LevinFrom: Yousef Alhouseen <[email protected]>
[ Upstream commit 41f82777e547732460290ceb28fcc7c1b95ef192 ]
The byte-alignment paths can call CODE_ADD() with a zero bit length. The macro then shifts an int by name.b, which can be 32 after the preceding bit was flushed.
vti_bitlen() can likewise shift a signed int into its sign bit while searching for the bit length, and the package mask construction can shift by the full type width.
Make zero-length additions a no-op, derive the bit length with fls(), and build the mask with GENMASK().
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject line**
Record: [media/go7007] [avoid] undefined shifts in MPEG-4 header bit- packing. Subsystem is the WIS GO7007 USB MPEG encoder. “Avoid” is a bug-fix verb: the patch stops C undefined behavior, not adding a feature.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Yousef Alhouseen <[email protected]> (author)
- Signed-off-by: Hans Verkuil <[email protected]> (media maintainer; applied)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, Link:, or Cc: stable (absence of Fixes/Cc-stable is expected for this review)
**Step 1.3 — Body**
Record:
- Bug: CODE_ADD() can be called with bit length 0; after a flush name.b can be 32, so (val) << name.b is a 32-bit shift of a 32-bit int (C UB).
- vti_bitlen() uses (1 << i) with signed 1 and i starting at 31 (shift into the sign bit).
- Package mask (1 << vop_time_increment_bitlength) - 1 can shift by the full type width.
- Symptoms: UBSAN shift diagnostics; wrong bitstream on arches that mask the shift count; possible hang in vti_bitlen() when max_time_incr == 0.
- No version range or crash log in the message.
- Root cause as stated: unguarded shift counts in the MPEG header bitpacker.
**Step 1.4 — Hidden bug fix?**
Record: Not disguised. It is an explicit UB/correctness fix. The fls() rewrite is equivalent for every nonzero value and also stops an unsigned wrap / infinite loop when max_time_incr == 0.
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record:
- File: drivers/media/usb/go7007/go7007-fw.c (+15 / −13)
- Functions/macros: CODE_ADD, vti_bitlen(), seqhead_to_package(); plus #include <linux/bitops.h>
- Scope: single-file surgical fix
**Step 2.2 — Flow change**
Record:
1. CODE_ADD: previously always did name.b -= length; name.a |= (val) << name.b. After: if (length) wraps the body, so length-0 is a no- op.
2. vti_bitlen: previously a countdown from 31 with (1 << i) - 1 masks. After: fls(max_time_incr) with bitlen ?: 1.
3. seqhead_to_package: (1 << vop_time_increment_bitlength) - 1 → GENMASK(vop_time_increment_bitlength - 1, 0).
Affected path is firmware-image construction at MPEG-4 stream start (go7007_start_encoder()), not a generic hot path.
**Step 2.3 — Bug mechanism**
Record: **Type / undefined-shift (UBSAN class)**, with a logic/hang side effect.
Verified zero-length CODE_ADD in mpeg4_frame_header() / mpeg4_sequence_header():
```758:761:drivers/media/usb/go7007/go7007-fw.c
/* Byte-align with a zero followed by ones */
i = 8 - (CODE_LENGTH(c) % 8);
CODE_ADD(c, 0, 1);
CODE_ADD(c, (1 << (i - 1)) - 1, i - 1);
```When CODE_LENGTH % 8 == 7, i == 1, so the second call is CODE_ADD(..., 0, 0). After the 1-bit add, name.b can be 32, then (val) << 32 is UB.
Pre-fix vti_bitlen:
```c
for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i)
;
return i + 1;
```1 << 31 is a signed shift into the sign bit (UB) on every call. If max_time_incr == 0, the condition is always true, i is unsigned int, --i wraps, and the loop does not terminate.
**Step 2.4 — Fix quality**
Record: Obviously correct and minimal.
- fls(x) matches the old loop for all x > 0 (spot-checked 1, 2, 30000, 0x80000000).
- fls(0) ?: 1 returns 1 instead of hanging.
- GENMASK(n-1, 0) is the defined way to build an n-bit mask; vti_bitlen() never returns 0 after the ?: 1 guard, so GENMASK(-1, 0) cannot happen.
- Regression risk is low: no locking, no API, no data-structure change. Residual UB not in this patch: (1 << (i - 1)) in the same padding path is safe because i is in 1..8.
---
## Phase 3: Git history
**Step 3.1 — Blame**
Record: Buggy CODE_ADD / vti_bitlen / mask come from 866b8695d67e83 (“Staging: add the go7007 video driver”, 2008-10-10). Driver left staging in 7955f03d18d14. The bug is ~18 years old, not recent churn.
**Step 3.2 — Fixes: tag**
Record: No Fixes: tag. Introducer is the 2008 staging add above. git merge-base --is-ancestor 41f82777e5477 HEAD is true: this snapshot already contains the fix.
**Step 3.3 — File history**
Record: Recent go7007-fw.c commits are unrelated (min/max macros, SPDX, KASAN frame warning, sparse). Standalone, not N/M.
**Step 3.4 — Author**
Record: Yousef Alhouseen is not the media maintainer; nearby work is a series of small correctness patches. Weight comes from Hans Verkuil’s SOB (applied to media tree).
**Step 3.5 — Dependencies**
Record: Needs fls() and GENMASK(), both long-standing (<linux/bitops.h> / <linux/bits.h>). No prerequisite series. Can apply standalone to any tree that still has this file.
---
## Phase 4: Mailing list / external
**Step 4.1 — Original discussion**
Record: b4 dig -c 41f82777e5477 → https://patch.msgid.link/20260630105
[email protected]b4 dig -a: **v1 only**, one revision.
Saved mbox: single message, no replies. Hans applied it without public review comments. No NAK, no reviewer Cc: stable.
**Step 4.2 — Recipients (b4 dig -w)**
Record: Hans Verkuil, Mauro Chehab, linux-media, linux-kernel. Right maintainers were on the To/Cc list.
**Step 4.3 — Bug report**
Record: No syzbot/bugzilla/Reported-by. Inspection/UBSAN-style fix, not a user crash report.
**Step 4.4 — Series**
Record: Standalone v1. Same-day sibling media: go7007: s2250: propagate control I/O failures is a different bug.
**Step 4.5 — Stable list**
Record: lore.kernel.org/stable fetch returned 403. Web search for this subject on stable found **no** discussion. UNVERIFIED beyond that search.
---
## Phase 5: Semantic / call graph
**Step 5.1 — Functions**
Record: CODE_ADD (macro), vti_bitlen(), seqhead_to_package(). No semcode MCP in this environment; used grep.
**Step 5.2 — Callers**
Record:
- vti_bitlen() ← mpeg4_frame_header(), mpeg4_sequence_header(), seqhead_to_package()
- those ← gen_mpeg4hdr_to_package() / do_special(SPECIAL_SEQHEAD) when go->format == V4L2_PIX_FMT_MPEG4
- go7007_construct_fw_image() ← go7007_start_encoder() ← go7007_start_streaming() (vb2 start_streaming)
**Step 5.3 — Callees**
Record: After the patch, fls() and GENMASK() only. No alloc/lock in the changed lines.
**Step 5.4 — Reachability**
Record: Yes, from userspace: open the V4L2 node, VIDIOC_S_FMT MPEG-4, VIDIOC_STREAMON. Firmware construction runs with hw_lock held.
VIDIOC_S_PARM can make fps_scale huge:
```485:491:drivers/media/usb/go7007/go7007-v4l2.c
n = go->sensor_framerate *
parm->parm.capture.timeperframe.numerator;
d = 1001 * parm->parm.capture.timeperframe.denominator;
if (n != 0 && d != 0 && n > d)
go->fps_scale = (n + d/2) / d;
else
go->fps_scale = 1;
```If fps_scale > sensor_framerate (~25025–30030), max_time_incr == 0 and the old loop hangs while holding hw_lock. Needs device node access (typically video group), not a random unprivileged syscall on machines without the hardware.
**Step 5.5 — Similar patterns**
Record: MPEG-1 byte-align already skips CODE_ADD when j == 8. MPEG-4 padding is the length-0 case. No sibling drivers share this macro.
---
## Phase 6: This checkout
**Step 6.1 — Does the buggy code exist here?**
Record: Local tree is **v7.3-rc4** (7.3.0-rc4, f0100363d8c37). The driver is present. Current go7007-fw.c already has the fix (#include <linux/bitops.h>, if (length), fls(), GENMASK()). Pre-fix code lived in this file from 2008 until 41f82777e5477 (2026-07-15). Any stable kernel that still has unfixed go7007-fw.c has the bug.
**Step 6.2 — Backport difficulty**
Record: Clean apply. The bitpacker has been stable since 2008; the hunks match the historical file. Only extra include is <linux/bitops.h>.
**Step 6.3 — Related fixes already here**
Record: This *is* the fix. No earlier alternate fix in the file history.
---
## Phase 7: Subsystem context
**Step 7.1**
Record: drivers/media/usb/go7007 — USB V4L2 MPEG encoder (WIS GO7007 / Sensoray 2250, Plextor, etc.). Criticality: **PERIPHERAL** (specific old capture dongles), but not staging.
**Step 7.2**
Record: Low churn. Recent commits are small leak/error-path fixes. Mature, rarely touched encoder header generator.
---
## Phase 8: Impact and risk
**Step 8.1 — Who is affected**
Record: Users of CONFIG_VIDEO_GO7007 with MPEG-4 encode. Hardware IDs include Sensoray 2250/2251 (0x1943:0xa250) and several WIS/Plextor USB IDs. Not universal.
**Step 8.2 — Trigger**
Record:
- Common: every MPEG-4 STREAMON can hit length-0 CODE_ADD depending on header bit length (UBSAN / UB). Typical val is 0, so x86 often still produces a no-op.
- Uncommon but real: VIDIOC_S_PARM with a large time-per-frame → max_time_incr == 0 → old vti_bitlen infinite loop under hw_lock.
- Typical sensor_framerate is 25025/30000/30030, so `(1 << vti_bitlen)
- 1` is a ~15-bit shift and not the 32-bit case; the GENMASK change is defensive for that site.
**Step 8.3 — Failure mode**
Record:
- Length-0 shift: UBSAN / undefined; functional impact usually none because val == 0. Severity **MEDIUM** (UBSAN), not a proven oops.
- vti_bitlen hang: driver stuck with hw_lock held → STREAMON never finishes. Severity **HIGH** for that device, not a machine-wide panic.
- Overall: **MEDIUM–HIGH**, not core-kernel CRITICAL.
**Step 8.4 — Risk vs benefit**
Record: Benefit medium for go7007 users (defined behavior, no hang). Risk **very low** (~15 lines, equivalent fls(), maintainer-applied). Ratio favors backport.
---
## Phase 9: Synthesis
**Step 9.1 — Evidence**
For:
- Real C undefined shifts in reachable MPEG-4 header generation
- Old vti_bitlen() can livelock when fps_scale is large
- 15/13 lines, one file, obviously correct
- fls() is equivalent for all nonzero inputs
- Hans Verkuil signed off
- Bug present since 2008; applies cleanly
- No new API/feature
Against:
- Niche USB encoder, few systems
- No user/syzbot report
- Common-path length-0 add is val==0, often a practical no-op
- GENMASK site is not a 32-bit shift with real framerates
- No public review beyond maintainer apply
Unresolved:
- Could not read lore.kernel.org/stable (403)
- No sanitizer log attached to the commit (whether UBSAN actually fired is unverified)
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — equivalent rewrite; maintainer applied v1.
2. Real bug that affects users? **PASS** — UB on MPEG-4 start; hang if max_time_incr==0.
3. Important (crash/security/corruption/deadlock)? **PASS** — hang under hw_lock plus UBSAN-class UB. Not a core panic, but a real driver DoS/UB, not style cleanup.
4. Small and contained? **PASS** — one file, ~28 lines.
5. No new features/APIs? **PASS**.
6. Applies to this tree’s go7007 code? **PASS** — same file/macros; include is standard.
**Step 9.3 — Exception category**
Record: None (not a device ID/quirk/DT/build/docs). It is a normal small correctness fix.
**Step 9.4 — Decision**
This checkout is mainline 7.3-rc4, which already contains the commit; the question is whether the fix has stable technical merit for trees that still have the 2008 bitpacker. It does: small, correct, no dependencies, fixes defined-behavior bugs and a reachable livelock in go7007_start_encoder(). Risk of regression is negligible.
### What the commit solves for stable users
On MPEG-4 stream start the GO7007 firmware generator packes headers with CODE_ADD(). Padding can request a 0-bit add after a flush (name.b == 32), which is an illegal shift. vti_bitlen() always does 1 << 31 and, if userspace sets a very large frame interval, can spin forever with hw_lock held so VIDIOC_STREAMON never returns. The patch skips zero-length adds, uses fls(), and builds the mask with GENMASK().
### Risk vs benefit
Benefit is defined behavior and no encoder-start hang for remaining GO7007/Sensoray users. Risk is a few lines in a dormant driver with no API change.
### Concerns
Obscure hardware and no field report. That lowers urgency, not correctness. No backport rework needed.
---
Verification:
- [Phase 1] Parsed subject/body/tags: only author + Hans Verkuil SOBs; no Fixes/Reported-by/Link/Cc-stable
- [Phase 2] git show --numstat 41f82777e5477: 15/13, one file; read current and 41f82777e5477^ CODE_ADD / vti_bitlen / mask
- [Phase 2] Confirmed length-0 path: i = 8 - (CODE_LENGTH % 8) then CODE_ADD(..., i-1) when i==1
- [Phase 2] Confirmed fls equivalence for 1, 2, 30000, 0x80000000; fls(0)?:1 vs old wrap
- [Phase 3] git blame / git log -1 866b8695d67e83: introduced 2008 with staging driver
- [Phase 3] git merge-base --is-ancestor 41f82777e5477 HEAD → yes (already in this 7.3-rc4 snapshot)
- [Phase 3] git log --oneline --author="Yousef Alhouseen": standalone vs nearby s2250 patch
- [Phase 4] b4 dig -c/-a/-w/-m: v1 only; To Hans/Mauro/linux-media; mbox has no replies
- [Phase 4] lore.kernel.org 403; lkml.iu.edu shows the same v1 patch text
- [Phase 4] WebSearch stable archive: no hit for this subject
- [Phase 5] grep callers: vti_bitlen → MPEG-4 headers → do_special → go7007_construct_fw_image → go7007_start_encoder → go7007_start_streaming
- [Phase 5] Read vidioc_s_parm: fps_scale unbounded when n > d
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4
- [Phase 6] Current file already has the fix; parent file has the old loop/mask
- [Phase 7] Kconfig VIDEO_GO7007; USB IDs include Sensoray 2250
- [Phase 8] Failure: UB on padding; hang if max_time_incr==0 under hw_lock
- UNVERIFIED: whether UBSAN actually reported this in a boot/log; stable-list archives beyond web search (403)
**YES**
drivers/media/usb/go7007/go7007-fw.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/media/usb/go7007/go7007-fw.c +15 -13
@@ -13,6 +13,7 @@*/ #include <linux/module.h> +#include <linux/bitops.h> #include <linux/time.h> #include <linux/mm.h> #include <linux/device.h>
@@ -58,14 +59,16 @@ struct code_gen {#define CODE_GEN (name, dest) struct code_gen name = { dest, 0, 32, 0 }#define CODE_ADD (name, val, length) do { \ - name.b -= (length); \ - name.a |= (val) << name.b; \ - while (name.b <= 24) { \ - *name.p = name.a >> 24; \ - ++name.p; \ - name.a <<= 8; \ - name.b += 8; \ - name.len += 8; \ + if (length) { \ + name.b -= (length); \ + name.a |= (val) << name.b; \ + while (name.b <= 24) { \ + *name.p = name.a >> 24; \ + ++name.p; \ + name.a <<= 8; \ + name.b += 8; \ + name.len += 8; \ + } \ } \ } while (0)
@@ -707,11 +710,10 @@ static int gen_mpeg1hdr_to_package(struct go7007 *go,static int vti_bitlen (struct go7007 *go) { -unsigned int i, max_time_incr = go->sensor_framerate / go->fps_scale; +unsigned int max_time_incr = go->sensor_framerate / go->fps_scale; +int bitlen =fls (max_time_incr); -for (i =31 ; (max_time_incr & ((1 << i) -1 )) == max_time_incr; --i) - ; -return i +1 ; +return bitlen ?:1 ; } static int mpeg4_frame_header(struct go7007 *go, unsigned char *buf,
@@ -1209,7 +1211,7 @@ static int seqhead_to_package(struct go7007 *go, __le16 *code, int space,0xbf08 , fps,0xbf09 ,0 ,0xbff2 , vop_time_increment_bitlength, -0xbff3 , (1 << vop_time_increment_bitlength) -1 , +0xbff3 ,GENMASK (vop_time_increment_bitlength -1 ,0 ),0xbfe6 ,0 ,0xbfe7 , (fps /1000 ) <<8 , 0, 0,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 regulator: rt6245: Restore state on enable failure
In reply to Sasha LevinFrom: bui duc phuc <[email protected]>
[ Upstream commit e95a0a309ca02bf26dc937cdeb3fe2a235c65f63 ]
Currently, if regcache_sync() fails after the enable GPIO has been asserted, the driver returns with enable_gpio still set high and regcache_cache_only() left disabled. This leaves the device state inconsistent with the disabled state, where the enable GPIO is low and cache_only is enabled.
On failure, restore the original state by setting cache_only back to true and driving the enable GPIO low before returning the error.
---
LLM Generated explanations, may be completely bogus:
Local tree is **6.1.188** (pending-6.1). The buggy rt6245_enable() error path is present and matches the patch pre-image; this is a small, self-contained rollback of GPIO and regcache state after regcache_sync() fails.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[regulator / rt6245] [Restore] restore GPIO + regcache state when enable fails after regcache_sync()**
Subsystem prefix regulator: rt6245:. Verb “Restore” is rollback
language: incomplete error recovery, not a feature.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Signed-off-by: bui duc phuc <[email protected]> (author)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Mark Brown <[email protected]> (regulator maintainer)
- No Fixes:, no Cc: stable, no Reported-by, no Tested-by, no Reviewed-by, no syzbot
- Absence of Fixes: / Cc: stable is expected for this review and is not a negative signal
Mainline SHA (from git.kernel.org, not used as a “already selected” signal): e95a0a309ca02bf26dc937cdeb3fe2a235c65f63
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** After asserting enable_gpio and turning cache-only off, regcache_sync() can fail. The function then returns without undoing those two steps.
- **Symptom:** Software reports enable failed (enable_state stays false) while the chip enable pin stays high and regcache_cache_only() stays disabled. That does not match the disabled state (GPIO low, cache-only on).
- **Root cause:** Missing rollback on the regcache_sync() error path.
- **Version info:** None in the message. Introduced with the driver itself (2021).
- No stack trace, no reproducer, no user report.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: This is an explicit error-path fix, not a disguised cleanup. It restores hardware and cache mode so they match “disabled” before returning the error.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/regulator/rt6245-regulator.c (+4 / −1)
- Function: rt6245_enable()
- Scope: single-file surgical error-path fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Before (this tree, lines 47–56):
```47:56:drivers/regulator/rt6245-regulator.c
gpiod_direction_output(priv->enable_gpio, 1);
usleep_range(RT6245_ENTIME_IN_US, RT6245_ENTIME_IN_US + 1000);
regcache_cache_only(regmap, false);
ret = regcache_sync(regmap);
if (ret)
return ret;
priv->enable_state = true;
return 0;
```After: on regcache_sync() failure, set regcache_cache_only(regmap, true), drive GPIO low, then return ret. priv->enable_state is still not set (already false on this path).
Affected path: enable error path only, and only when enable_gpio is present (early return 0 if it is NULL).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **Error-path / incomplete rollback**, not UAF/race/leak.
Mechanism:
1. GPIO is driven high (chip powered).
2. Cache-only is disabled so I2C writes go to hardware.
3. regcache_sync() fails (I2C/NAK/timeout).
4. Function returns. Regulator core does **not** call disable() on enable failure (see Phase 5).
5. Chip stays powered; cache-only stays off; is_enabled() still reports off.
Disable already does the matching pair (cache_only true + GPIO low). The patch copies that rollback onto the failed-enable path.
Note: rt6245_disable() also calls regcache_mark_dirty(). This patch does not. For this driver that is still correct: it uses REGCACHE_FLAT, and regcache_sync() only clears map->cache_dirty on success (drivers/base/regmap/regcache.c). A failed sync leaves the cache dirty, so the next enable still resyncs. mark_dirty() is needed on disable because a *successful* enable had already cleared that flag.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: undoes exactly the two side effects performed before the failing call, in reverse order (cache-only first, then GPIO, matching disable).
- Minimal: four lines, no unrelated churn.
- Regression risk: very low. GPIO is already known non-NULL on this path. No locking change. No API change.
- gpiod_direction_output(..., 0) matches the style already used in this file’s enable/disable (this tree does not use gpiod_set_value() here).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: Buggy sequence was introduced in a747070e9b629eeb70118651dfbd500bf8bb5ebe (“regulator: rt6245: Add support for Richtek RT6245”, 2021-06-03, ChiYuan Huang). git merge-base --is-ancestor a747070e9b629 HEAD succeeds. git merge-base --is- ancestor a747070e9b629 v6.1 succeeds. Present since the driver landed, well before 6.1.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. The introducing commit is the driver add itself, and it is in this tree.
**Step 3.3: CHECK FILE HISTORY**
Record: Only two commits on this file in this tree:
- a747070e9b629 — add driver
- 508f8ccd993d1 — make func_base static (unrelated size tweak)
No later refactor, no series glue, no conflicting change. Standalone.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Author is not the subsystem maintainer (that is Mark Brown; driver author is ChiYuan Huang). Same author has similar “restore cache- only on sync failure” work already in this tree, e.g.:
- 3de4b44d5887d ASoC rockchip spdif: restore cache-only on sync failure
- 0614f2fa0998f gpio pca953x: restore cache_only/IRQ on restore_context failure
Those are the same class of error-path rollback. This rt6245 change is not in HEAD (git merge-base --is-ancestor e95a0a309ca0 HEAD fails).
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. Uses only regcache_cache_only(), regcache_sync(), gpiod_direction_output(), all present. Pre-image of the hunk matches this tree exactly. Can apply standalone.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- msgid [email protected]
- b4 dig / b4 mbox: no match / lore 404
- lore.kernel.org fetch: HTTP 403
- Patchew fetch: timeout
- LKML archive:
https://lkml.iu.edu/hypermail/linux/kernel/2607.3/10141.html — v1 patch text matches the committed diff; no review replies on that page
- Patchew summary (search): Mark Brown applied it to for-7.3 the next day
- git.kernel.org: committed 2026-07-30 by Mark Brown; tags are only author SOB + Link + maintainer SOB
- Included in “regulator updates for v7.3” pull (Mark Brown, 2026-08-17)
No NAK found. No later v2/v3 of this specific patch found. Applied as submitted.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (from Patchew mbox snippet): To Liam Girdwood and Mark Brown; Cc linux-kernel. Mark Brown applied it. No extra Reviewed-by.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No bugzilla, no syzbot, no user report. Analysis-driven error- path fix.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Single [PATCH], not N/M. Sibling Richtek drivers in this tree (rt6160, rtq6752) have similar enable+sync patterns; this commit does not depend on changing them.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: Search of lore.kernel.org/stable for this subject did not find a prior stable request or rejection. UNVERIFIED beyond search snippets (lore 403).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
Record: rt6245_enable() only. Wired as .enable in rt6245_regulator_ops.
**Step 5.2: TRACE CALLERS**
Record: Not called by name elsewhere. Invoked through regulator core _regulator_do_enable():
```2814:2817:drivers/regulator/core.c
} else if (rdev->desc->ops->enable) {
ret = rdev->desc->ops->enable(rdev);
if (ret < 0)
return ret;
```On failure the core returns immediately. It does not call ops->disable. The leftover GPIO-high / cache-only-off state persists until a later disable (which the core will not issue, because it never counted the regulator as enabled).
**Step 5.3: TRACE CALLEES**
Record: gpiod_direction_output, usleep_range, regcache_cache_only, regcache_sync. I2C writes happen inside rt6245_reg_write() during sync.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from regulator_enable() consumers and from sysfs enable of this regulator. Trigger: board has enable-gpios, someone enables the regulator, I2C regcache_sync() fails. Not every boot; it is an I2C error path. Unprivileged trigger depends on whether that regulator sysfs is exposed; kernel consumers can hit it during probe/resume.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same class in this tree: rt6160_enable() also does GPIO + regcache_sync() with no rollback (drivers/regulator/rt6160-regulator.c). rtq6752_set_vdd_enable() likewise returns on sync failure after GPIO high. Those are separate bugs, not prerequisites.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. drivers/regulator/rt6245-regulator.c rt6245_enable() lines 50–53. Introduced 2021-06-03, in v6.1. Fix is not an ancestor of HEAD.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Hunk context is identical. No refactor of this function after the driver was added. (probe_new vs later probe is unrelated.)
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No other rt6245 enable-failure rollback. File history is only the two commits above.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: **regulator / Richtek RT6245 I2C buck**. Criticality:
**PERIPHERAL** (specific PMIC/regulator, CONFIG_REGULATOR_RT6245). It is a 14A, 0.4375–1.3875 V converter, typically a CPU/core or similar rail on boards that use it.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: Regulator core in this tree is actively backported. This file itself is mature and almost untouched since 2021.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: Driver-specific / config-specific: CONFIG_REGULATOR_RT6245 plus DT enable-gpios. No in-tree .dts/.dtsi uses richtek,rt6245 (only the binding example). Real users are out-of-tree / vendor DTs. Still a shipped mainline driver.
**Step 8.2: TRIGGER CONDITIONS**
Record: Enable with GPIO, then I2C regcache_sync() fails. Uncommon compared with the happy path, but a lasting state once it happens (core will not disable). Not a race.
**Step 8.3: FAILURE MODE SEVERITY**
Record:
- Hardware enable pin left asserted on a 14 A regulator while the framework thinks it is off.
- Cache-only left disabled, so later cache/I2C behavior does not match “disabled”.
- Not a panic, UAF, or filesystem corruption.
Severity: **MEDIUM–HIGH** for this hardware (wrong power state / unexpected rail power), **LOW** for the rest of the kernel.
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** Stops a failed enable from leaving a high-current rail powered and the regmap in the wrong mode. Matches disable semantics.
- **Risk:** Four lines on an error path, same operations disable already uses. Very low.
- **Ratio:** Favorable. Cheap, contained, real rollback.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real incomplete error recovery; hardware and cache mode left inconsistent with “disabled”.
- Regulator core does not call disable on enable failure, so the leak is permanent until some other disable.
- Buggy code has been in this 6.1 tree since the driver was added (2021).
- Four-line, obviously correct, applies cleanly, no new API, no dependencies.
- Maintainer (Mark Brown) applied it; same author pattern already accepted in this tree for other cache-only rollbacks.
**AGAINST:**
- Peripheral driver; no in-tree board DT.
- I2C error path; no user/syzbot report.
- Not a crash/security/deadlock/corruption bug.
**UNRESOLVED:**
- Full lore thread unreable (403/404); no extra reviewer comments retrieved.
- No stable-list discussion found.
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — rollback is local and matches disable; applied by maintainer. No extra Tested-by.
2. Fixes a real bug that affects users? **PASS** — failed enable leaves the rail on and cache-only off.
3. Important issue? **PASS** (medium) — wrong power state on a high- current regulator, not a kernel oops. Within the “etc.” of hardware left in a bad state.
4. Small and contained? **PASS** — 4 insertions / 1 deletion, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — pre-image matches; driver present.
**Step 9.3: EXCEPTION CATEGORIES**
Record: Not a device ID / quirk / DT / build / docs exception. Ordinary driver bugfix.
**Step 9.4: DECISION**
This belongs on 6.1. The bug exists here, the fix is surgical, and leaving a 14 A enable pin high after a failed enable is a real hardware- state bug, not style cleanup. Risk of regression is negligible.
---
## What the commit solves for this tree
On CONFIG_REGULATOR_RT6245 boards that use enable-gpios, a failed regcache_sync() during enable currently returns an error while the chip stays powered and the regmap is no longer cache-only. The regulator core will not run disable for that failed enable, so the rail stays on. The patch restores cache-only and deasserts the GPIO, which is the disabled state this driver already uses.
It meets the stable rules: obviously correct, real bug, small, no new API, clean apply on 6.1.188. Benefit is restoring consistent power/cache state; risk is a four-line error path.
---
## Verification
- **[Phase 1]** Parsed subject/tags/body from the candidate message and from git.kernel.org commit e95a0a309ca0 (author SOB, Link, Mark Brown SOB; no Fixes/stable/Reported-by).
- **[Phase 2]** Diff is +4/−1 in rt6245_enable(); local file matches the pre-image (if (ret) return ret; after regcache_sync).
- **[Phase 2]** Compared with rt6245_disable(): disable already does cache-only + GPIO low; enable failure did not.
- **[Phase 2]** regcache_sync() only clears cache_dirty on success — missing mark_dirty is not required on this failure path for REGCACHE_FLAT.
- **[Phase 3]** git blame: lines from a747070e9b629 (2021-06-03). Ancestor of HEAD and of v6.1.
- **[Phase 3]** git log --oneline -- drivers/regulator/rt6245-regulator.c: only add-driver + static-array commit.
- **[Phase 3]** git merge-base --is-ancestor e95a0a309ca0 HEAD → not in this tree.
- **[Phase 4]** b4 dig/b4 mbox: no lore thread; lore HTTP 403; Patchew timeout.
- **[Phase 4]** LKML archive shows v1 matching the committed diff; v7.3 regulator pull lists this commit.
- **[Phase 4]** Recipients: Liam Girdwood, Mark Brown (Patchew mbox snippet).
- **[Phase 5]** rt6245_enable is only .enable in ops; _regulator_do_enable() returns on ops->enable failure without disable.
- **[Phase 5]** git grep richtek,rt6245 in dts/dtsi: no in-tree users; binding YAML only.
- **[Phase 6]** git describe HEAD → p-6.1-9-g27ef8181b8a64; Makefile 6.1.188; make kernelversion 6.1.188.
- **[Phase 6]** Python pre-image check: enable() does not yet restore cache-only/GPIO on sync failure.
- **[Phase 7]** Kconfig REGULATOR_RT6245 present; Makefile builds rt6245-regulator.o.
- **[Phase 8]** Failure mode verified from code: GPIO left high + cache- only left false + enable_state still false.
- **UNVERIFIED:** Full lore review comments (fetch blocked); whether any out-of-tree board actually hits the I2C-fail path in production.
The patch is small, applies cleanly to this 6.1 tree, and fixes a real enable-failure rollback for hardware that this tree already ships.
**YES**
drivers/regulator/rt6245-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/rt6245-regulator.c +4 -1
@@ -49,8 +49,11 @@ static int rt6245_enable(struct regulator_dev *rdev)regcache_cache_only (regmap, false); ret =regcache_sync (regmap); -if (ret) +if (ret) { +regcache_cache_only (regmap, true); +gpiod_direction_output (priv->enable_gpio,0 );return ret; + } priv->enable_state = true;return 0 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 sctp: auth: propagate HMAC calculation errors to callers
In reply to Sasha LevinFrom: Qing Luo <[email protected]>
[ Upstream commit 5d3ae80ecddeb82b492a2cf31ac3e44412b426f4 ]
sctp_auth_calculate_hmac() can fail when building the association secret under memory pressure, but its void return silently leaves the HMAC digest zeroed. On the receive path, sctp_sf_authenticate() compares this zeroed digest against the peer-supplied one using crypto_memneq(), potentially accepting an all-zero HMAC from the peer if the allocation failed. On the send path, sctp_packet_pack() transmits a packet with a zeroed HMAC that the peer would reject.
Improve error handling by making sctp_auth_calculate_hmac() return int:
- sctp_sf_authenticate() returns SCTP_IERROR_NOMEM instead of accepting a zero HMAC.
- sctp_packet_pack() drops the packet on failure instead of transmitting a zeroed HMAC.
Update the declaration in auth.h accordingly.
---
LLM Generated explanations, may be completely bogus:
This is a real SCTP-AUTH fail-open under memory pressure, and the buggy void HMAC helper is present in this 6.12 tree. The fix is small, reviewer-acked, and backportable with a trivial auth.c context tweak.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [sctp/auth] [propagate] HMAC calculation errors to callers — turn sctp_auth_calculate_hmac() from void into an int so ENOMEM is not swallowed.
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Assisted-by: LLM (author used an LLM)
- Signed-off-by: Qing Luo <[email protected]> (author)
- Acked-by: Xin Long <[email protected]> (SCTP maintainer)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Paolo Abeni <[email protected]> (netdev)
- No Reported-by, Tested-by, Reviewed-by on the committed message
- No Fixes: / Cc: stable on the committed v4 text (expected for this review queue; see Phase 4 — they were present on v2/v3, and Xin Long re-added Fixes: when acking v4)
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: sctp_auth_calculate_hmac() can fail while building the association secret; it still returns void and leaves the HMAC field zeroed.
- Receive symptom: sctp_sf_authenticate() compares that zero digest to the peer HMAC with crypto_memneq(), so an all-zero HMAC can be accepted.
- Send symptom: sctp_packet_pack() ships a packet with a zero HMAC, which the peer rejects.
- Root cause: silent early return on sctp_auth_asoc_create_secret() failure.
- No kernel-version range in the message.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a disguised cleanup. It is an explicit error-propagation fix for a fail-open AUTH path. v1 understated it as “wrong error code (BAD_SIG vs NOMEM)”; later revisions correctly describe acceptance of a zero HMAC.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- include/net/sctp/auth.h: void → int for sctp_auth_calculate_hmac()
- net/sctp/auth.c: return -ENOMEM on secret allocation failure; return 0 on success
- net/sctp/output.c: drop packed skb on HMAC failure; treat pkt_count <= 0 as transmit failure
- net/sctp/sm_statefuns.c: on HMAC failure, kfree(save_digest) and return SCTP_IERROR_NOMEM
- Scope: ~24 insertions / 13 deletions, four files, surgical, SCTP-only
- Functions: sctp_auth_calculate_hmac, sctp_packet_pack, sctp_packet_transmit, sctp_sf_authenticate
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- HMAC helper: allocation failure used to return; with digest untouched → now -ENOMEM.
- Receive: digest is memset to 0, then HMAC is computed into it. On failure, compare is skipped; NOMEM is returned instead of comparing against zeros.
- Send: HMAC failure frees packet->auth, frees the GSO fragment if needed, returns -ENOMEM. Non-GSO nskb == head, so nskb is not freed there (avoids double-free); sctp_packet_transmit frees head when pkt_count <= 0.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: logic / correctness with security impact (AUTH fail-open), plus missing error-path handling.
- Mechanism: RFC 4895 requires the AUTH HMAC field to be zero during computation. The receive path zeros it, then writes the computed MAC. If computation is skipped, the field stays zero, so crypto_memneq(peer_hmac, zeros) succeeds when the peer sent zeros.
- Trigger: key_id != asoc->active_key_id (non-active configured shared key) plus sctp_auth_asoc_create_secret() GFP_ATOMIC failure.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct: callers already have NOMEM handling (sctp_sf_eat_auth → SCTP_DISPOSITION_NOMEM; transmit already drops on pack failure).
- Minimal: no API for userspace, no new features.
- Regression risk: low. Send path drops the packet instead of emitting a MAC the peer would reject. Receive path no longer accept-on-OOM.
- Residual in this tree: crypto_shash_setkey() failure still goto free without an error (mainline HMAC helpers no longer have that path). That is preexisting and outside this commit.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record: Silent return on failed sctp_auth_asoc_create_secret() is from 1f485649f52929 (“[SCTP]: Implement SCTP-AUTH internals”, Vlad Yasevich, 2007-10-09), first in v2.6.24-rc1. Present for the entire life of SCTP-AUTH.
Step 3.2: FOLLOW THE FIXES: TAG
Record: Committed v4 has no Fixes: line. Xin Long added `Fixes:1f485649f529 ("[SCTP]: Implement SCTP-AUTH internals") on ack. That commit **is** an ancestor of this tree (git merge-base --is-ancestor 1f485649f52929 HEAD succeeded). Mainline fix 5d3ae80ecdde` is **not** in this tree.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent SCTP work here is unrelated (INIT leaks, ASCONF, TOCTOU, STALE_COOKIE). No prior attempt to propagate HMAC errors. hmac_sha1_usingrawkey is **not** in this tree; this tree still uses crypto_shash.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Qing Luo is not the SCTP maintainer. Xin Long **is** (recent net/sctp commits, and he acked this). That ack is the quality signal.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: No functional prerequisite. Mainline auth.c later switched to hmac_sha*_usingrawkey; this tree still has crypto_shash. The error- return change does not need that conversion. Standalone after a small context adapt in auth.c.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c 5d3ae80ecdde →
https://patch.msgid.link/[email protected]
- Series: v1 net-next (2026-07-30), v2 net (2026-08-04), v3 net (2026-08-04), v4 net-next (2026-08-07, applied)
- v1 changelog only mentioned BAD_SIG vs NOMEM.
- Jakub Kicinski forwarded an AI review he treated as valid: the real bug is **accepting an all-zero HMAC**, reachable from the wire via a configured non-active key id, including delayed COOKIE-ECHO AUTH; asked for Fixes: and Cc: stable.
- v2/v3 retargeted to net, added security wording, Fixes:, `Cc:
stable, and a sctp_auth_chunk_verify()` refactor.
- Xin Long on v3: “This patch is intended as a **fix**”; drop the sctp_auth_chunk_verify() churn (send that kind of cleanup to net- next). Returning -ENOMEM from pack is fine because transmit already treats non-positive pack results as drop.
- v4 dropped the verify refactor and was sent to net-next; Xin Long acked and re-added Fixes:. Paolo applied it to net-next (5d3ae80ecdde).
- No NAKs. Applied version is v4 (latest).
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): netdev maintainers (davem, edumazet, kuba, pabeni, horms), linux-sctp@, [email protected]. Xin Long acked. Jakub’s review drove the security description.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No syzbot/bugzilla/user crash report. Bug was found by code review (LLM-assisted, then confirmed on the list). Unverified: whether any production user has hit the zero-HMAC accept path.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Single patch, not 2/N. v3’s sctp_auth_chunk_verify() NOMEM vs BAD_SIG split was deliberately **not** merged. Without it, delayed COOKIE-ECHO treats HMAC-calc ENOMEM as auth failure (sctp_auth_chunk_verify still returns bool / false) and discards — fail-closed, which is the safe direction.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable search returned 403. From the netdev thread, v2/v3 carried Cc: stable; v4 dropped it only because the author retargeted after Xin Long asked to strip the verify refactor.
Unverified: no separate stable@ thread found.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: sctp_auth_calculate_hmac, sctp_packet_pack, sctp_packet_transmit, sctp_sf_authenticate. (semcode MCP not available; used grep + reads.)
Step 5.2: TRACE CALLERS
Record: sctp_auth_calculate_hmac has exactly two call sites in this tree:
- sctp_sf_authenticate() — receive AUTH, GFP_ATOMIC, reachable from the wire
- sctp_packet_pack() — transmit path sctp_sf_authenticate is used by sctp_sf_eat_auth and by sctp_auth_chunk_verify (delayed COOKIE-ECHO). Softirq/packet receive context.
Step 5.3: TRACE CALLEES
Record: sctp_auth_asoc_create_secret() allocates key vectors (sctp_auth_make_local_vector / peer_vector / sctp_auth_asoc_set_secret) with the caller’s gfp. Receive uses GFP_ATOMIC.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Userspace/peer can trigger this: enable SCTP AUTH (net.sctp.auth_enable is **0 by default**, but applications/sysctl can turn it on; ADD-IP needs AUTH), configure more than one shared key, send AUTH with a non-active key id and an all-zero HMAC while the host is under atomic-allocation pressure. Reachable from the network, not a local-only path.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: No other sctp_auth_calculate_hmac copies. Same fail-open exists on both send and receive via the single helper.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. Tree is pending-6.12 / 6.12.111
(p-6.12-3-gc504cf0baa3d8).
```707:731:net/sctp/auth.c
void sctp_auth_calculate_hmac(...)
{
...
asoc_key = sctp_auth_asoc_create_secret(asoc, ep_key,
gfp);
if (!asoc_key)
return;
```Receive still zeros the digest then compares unconditionally (net/sctp/sm_statefuns.c ~4426–4433). Bug introduced in v2.6.24, long before 6.12.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Mainline auth.c uses hmac_sha1_usingrawkey / hmac_sha256_usingrawkey; this tree uses crypto_shash_setkey + crypto_shash_tfm_digest. Exact mainline hunk context in auth.c will not match. The signature change, -ENOMEM return, return 0, and both caller sites match this tree. An adapted patch (void→int, return -ENOMEM, return 0 after the existing free: label, plus the output/statefuns hunks) applies (git apply --check succeeded on that adaptation). Difficulty: **minor conflicts / trivial rework**, not a rewrite.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: git merge-base --is-ancestor 5d3ae80ecdde HEAD failed. No “propagate HMAC” commit. sctp_auth_calculate_hmac is still void. No substitute fix.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: net/sctp — IMPORTANT (transport protocol; not mm/core). AUTH is optional but is the integrity mechanism for SCTP-AUTH / ADD-IP.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Actively maintained (Xin Long and others still landing SCTP fixes on this branch). Mature protocol; this bug is old, not a new- subsystem artifact.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Config/protocol-specific: CONFIG_IP_SCTP plus AUTH enabled (net->sctp.auth_enable defaults to 0 in net/sctp/protocol.c). Users who enable AUTH (telecom, WebRTC data-channel stacks, ADD-IP) are the population that matters.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- AUTH enabled and a non-active shared key configured
- Peer uses that key id
- sctp_auth_asoc_create_secret() fails (GFP_ATOMIC on receive)
- Peer HMAC is all zeros
Allocation failure is not attacker-controlled; key id and zero HMAC are. Unprivileged remote peer on an AUTH-enabled association can attempt this. Commonness: uncommon; severity if it hits: high.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record:
- Receive: AUTH bypass (chunk->auth = 1) for chunks that should have been rejected — **HIGH** (security / integrity). Not a panic, but fail-open authentication.
- Send: packet with zero HMAC dropped by peer — **LOW/MEDIUM** (failed send under OOM; already broken).
Overall: **HIGH** because of the receive fail-open.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: high for AUTH users — stops accepting unauthenticated chunks under OOM.
- Risk: very low — ~20 lines, error paths only, existing NOMEM/drop handling.
- Ratio: strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real AUTH fail-open: zeroed digest compared to peer HMAC after silent HMAC-calc failure (verified in sctp_sf_authenticate).
- Present in this 6.12 tree since 1f485649f529 (v2.6.24).
- Small, obviously correct; NOMEM already handled on the eat-AUTH path.
- SCTP maintainer acked it as a fix and supplied Fixes:.
- Jakub’s review explicitly called for stable.
- Two call sites only; no new APIs.
AGAINST:
- AUTH off by default; needs extra keys + atomic ENOMEM + zero HMAC.
- No syzbot/user crash report.
- Merged via net-next as v4 without Cc: stable in the commit text.
- Exact mainline auth.c context differs (crypto_shash vs hmac_sha*).
- Delayed COOKIE-ECHO still maps NOMEM to “auth failed” (fail-closed; acceptable, and what was merged).
UNRESOLVED:
- No stable@ archive confirmation (lore 403).
- No evidence of a real-world exploit/report.
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — logic is local; acked by Xin Long; applied to net-next.
2. Fixes a real bug that affects users? **PASS** — fail-open AUTH on a wire-reachable path when AUTH is enabled.
3. Important issue? **PASS** — authentication bypass / integrity failure (HIGH), not a crash. Narrow trigger, but security-class.
4. Small and contained? **PASS** — four files, ~24 lines, one helper + two callers.
5. No new features or APIs? **PASS** — return type only, internal.
6. Can apply to the local tree? **PASS** — buggy code is here; caller hunks match; auth.c needs a 3-line adapt around crypto_shash (not a missing subsystem).
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: None (not a device ID/quirk/DT/build/doc exception). It qualifies as a normal security/correctness fix.
Step 9.4: MAKE YOUR DECISION
Backport to this 6.12 tree. The bug exists here, the fix is surgical, and leaving AUTH fail-open under OOM is worse than dropping the packet / returning NOMEM.
Verification:
- [Phase 1] Tags parsed from the provided message and from the lore
mbox: Acked-by Xin Long; no Fixes on v4 commit text; v2/v3 had Fixes +
Cc: stable
- [Phase 2] Diff: void→int, -ENOMEM on secret alloc, receive NOMEM + kfree(save_digest), send drop + pkt_count <= 0
- [Phase 2] Confirmed receive zeros digest then crypto_memneq in sm_statefuns.c 4426–4433
- [Phase 3] git blame net/sctp/auth.c: silent return from 1f485649f52929 (2007); git describe --contains → v2.6.24-rc1
- [Phase 3] git merge-base --is-ancestor 1f485649f52929 HEAD succeeded; 5d3ae80ecdde is not an ancestor
- [Phase 3] hmac_sha1_usingrawkey absent in this tree; HMAC still via crypto_shash
- [Phase 4] b4 dig -c 5d3ae80ecdde: v1–v4; Jakub review identified zero-HMAC accept and asked for stable; Xin Long: “intended as a fix”, drop verify refactor; acked v4 with Fixes
- [Phase 4] lore.kernel.org/stable WebFetch 403 — UNVERIFIED whether stable@ discussed it separately
- [Phase 5] grep: only two sctp_auth_calculate_hmac call sites; sctp_sf_eat_auth already handles SCTP_IERROR_NOMEM
- [Phase 5] net->sctp.auth_enable = 0 by default (protocol.c:1382)
- [Phase 6] git describe HEAD → p-6.12-3-gc504cf0baa3d8; make kernelversion → 6.12.111
- [Phase 6] Adapted patch git apply --check succeeded; exact mainline auth.c context would conflict
- [Phase 8] Failure mode: AUTH bypass under ENOMEM + zero HMAC + non- active key — HIGH; send of zero HMAC — LOW
- UNVERIFIED: real-world exploitation; whether crypto_shash_setkey failure is practically reachable for HMAC-SHA1/256 (not required for this verdict)
**YES**
include/net/sctp/auth.h | 6 +++--- net/sctp/auth.c | 10 ++++++---- net/sctp/output.c | 12 +++++++++--- net/sctp/sm_statefuns.c | 9 ++++++--- 4 files changed, 24 insertions(+), 13 deletions(-)
include/net/sctp/auth.h +3 -3
@@ -84,9 +84,9 @@ int sctp_auth_send_cid(enum sctp_cid chunk, const struct sctp_association *asoc);int sctp_auth_recv_cid (enum sctp_cid chunk,const struct sctp_association *asoc); -void sctp_auth_calculate_hmac (const struct sctp_association *asoc, -struct sk_buff *skb,struct sctp_auth_chunk *auth, -struct sctp_shared_key *ep_key,gfp_t gfp); +int sctp_auth_calculate_hmac (const struct sctp_association *asoc, +struct sk_buff *skb,struct sctp_auth_chunk *auth, +struct sctp_shared_key *ep_key,gfp_t gfp);void sctp_auth_shkey_release (struct sctp_shared_key *sh_key);void sctp_auth_shkey_hold (struct sctp_shared_key *sh_key);
net/sctp/auth.c +6 -4
@@ -613,9 +613,9 @@ int sctp_auth_recv_cid(enum sctp_cid chunk, const struct sctp_association *asoc)* zero (as shown in Figure 6) followed by all chunks that are placed * after the AUTH chunk in the SCTP packet. */ -void sctp_auth_calculate_hmac (const struct sctp_association *asoc, -struct sk_buff *skb,struct sctp_auth_chunk *auth, -struct sctp_shared_key *ep_key,gfp_t gfp) +int sctp_auth_calculate_hmac (const struct sctp_association *asoc, +struct sk_buff *skb,struct sctp_auth_chunk *auth, +struct sctp_shared_key *ep_key,gfp_t gfp) {struct sctp_auth_bytes *asoc_key;__u16 key_id, hmac_id;
@@ -636,7 +636,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,/* ep_key can't be NULL here */ asoc_key =sctp_auth_asoc_create_secret (asoc, ep_key, gfp);if (!asoc_key) -return ; +return -ENOMEM ; free_key =1 ; }
@@ -654,6 +654,8 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,if (free_key)sctp_auth_key_put (asoc_key); + +return 0 ; }/* API Helpers */
net/sctp/output.c +9 -3
@@ -517,8 +517,14 @@ static int sctp_packet_pack(struct sctp_packet *packet, }if (auth) { -sctp_auth_calculate_hmac (tp->asoc, nskb, auth, - packet->auth->shkey, gfp); +if (sctp_auth_calculate_hmac (tp->asoc, nskb, auth, + packet->auth->shkey, gfp)) { +sctp_chunk_free (packet->auth); + packet->auth =NULL ; +if (gso) +kfree_skb (nskb); +return -ENOMEM ; + }/* free auth if no more chunks, or add it back */ if (list_empty (&packet->chunk_list))sctp_chunk_free (packet->auth);
@@ -619,7 +625,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)/* pack up chunks */ pkt_count =sctp_packet_pack (packet, head, gso, gfp); -if (!pkt_count) { +if (pkt_count <=0 ) {kfree_skb (head); goto out; }
net/sctp/sm_statefuns.c +6 -3
@@ -4457,9 +4457,12 @@ static enum sctp_ierror sctp_sf_authenticate(memset (digest,0 , sig_len); -sctp_auth_calculate_hmac (asoc, chunk->skb, - (struct sctp_auth_chunk *)chunk->chunk_hdr, - sh_key,GFP_ATOMIC ); +if (sctp_auth_calculate_hmac (asoc, chunk->skb, + (struct sctp_auth_chunk *)chunk->chunk_hdr, + sh_key,GFP_ATOMIC )) { +kfree (save_digest); +return SCTP_IERROR_NOMEM ; + }/* Discard the packet if the digests do not match */ if (crypto_memneq (save_digest, digest, sig_len)) {
Signature · 1 line
2.53.0
Re: [PATCH AUTOSEL 6.18-5.10] sctp: auth: propagate HMAC calculation errors to callers
Quoted 3 lines · Sasha Levin
- Residual in this tree:
crypto_shash_setkey()failure stillgoto freewithout an error (mainline HMAC helpers no longer have that path). That is preexisting and outside this commit.
I don't think this backport can be considered complete without handling that case.
- Eric
Xin Long
maintainerRe: [PATCH AUTOSEL 6.18-5.10] sctp: auth: propagate HMAC calculation errors to callers
Quoted 9 lines · Eric Biggers
Quoted 3 lines · Sasha Levin
- Residual in this tree:
crypto_shash_setkey()failure stillgoto freewithout an error (mainline HMAC helpers no longer have that path). That is preexisting and outside this commit.I don't think this backport can be considered complete without handling that case.
Agreed. We should return the error from crypto_shash_setkey() when it fails in sctp_auth_calculate_hmac().
Thanks.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.18-5.10] sctp: auth: propagate HMAC calculation errors to callers
Quoted 6 lines · Xin Long
Quoted 2 lines · Eric Biggers
I don't think this backport can be considered complete without handling that case.
Agreed. We should return the error from
crypto_shash_setkey()when it fails insctp_auth_calculate_hmac().
I've dropped it from all trees. If you'd like it in stable, I'm happy to take backports that also return the crypto_shash_setkey() error.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 1/1 vdpa: alibaba: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 7eeda5e2487276ed87960655fdae1c97d9779a0e ]
The driver has a match table for the pci bus wired into its driver structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the driver registration structure, and the missing module alias publication.
Message-ID: <[email protected]>
---
LLM Generated explanations, may be completely bogus:
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [vdpa: alibaba:] [add] [missing MODULE_DEVICE_TABLE() so PCI aliases are generated for autoload]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
From upstream commit 7eeda5e2487276ed87960655fdae1c97d9779a0e (verified with git show):
- Signed-off-by: Pengpeng Hou <[email protected]> (author)
- Signed-off-by: Michael S. Tsirkin <[email protected]> (virtio/vDPA maintainer)
- Message-ID: <[email protected]>
No Fixes:, no Reported-by:, no Tested-by:, no Reviewed-by:, no Acked-by:, no Cc: stable, no Link: (besides Message-ID). Absence of Fixes:/Cc: stable is expected for this review pipeline.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: eni_pci_ids[] is wired into eni_vdpa_driver.id_table but never exported via MODULE_DEVICE_TABLE().
- Symptom: modpost/file2alias never emits pci:v...d... aliases, so depmod/udev will not autoload alibaba-eni-vdpa when the PCI device appears.
- Version info: none in the message. Driver itself dates to v5.16-rc1.
- Root cause: missing alias publication, not a runtime logic error. Author explicitly calls it a source-level fix (build-time module metadata).
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is an autoload/hardware-enablement
bug: the match table exists and is used for probe matching, but is not published for module loading. Same pattern as device-ID publication.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/vdpa/alibaba/eni_vdpa.c (+1 / -0)
- Function: none. Insert after eni_pci_ids[], before eni_vdpa_driver.
- Scope: single-file, one-line surgical change.
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record: Before, eni_pci_ids is only referenced by .id_table (in- kernel PCI matching after the module is already loaded). After, MODULE_DEVICE_TABLE(pci, eni_pci_ids) also creates __mod_pci__eni_pci_ids_device_table, which scripts/mod/file2alias.c (do_pci_entry) turns into PCI aliases. No probe/remove/runtime path changes. Built-in (!MODULE) the macro is a no-op (include/linux/module.h).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: Category **(h) hardware enablement / missing device-ID publication**. Mechanism: without MODULE_DEVICE_TABLE, udev never loads the module on device discovery. Sibling PCI vDPA drivers (ifcvf, snet) already export their tables.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct; matches the established PCI-driver pattern. Minimal. Regression risk is negligible: no locks, no APIs, no data- structure changes, no runtime control-flow change. linux/module.h is already included (line 12).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: git blame -L 540,560 shows the ID table and pci_driver come entirely from e85087beedcae (“eni_vdpa: add vDPA driver for Alibaba ENI”, Wu Zongyong, 2021-10-29). Contained in v5.16-rc1. Present and unchanged in this tree. Bug has existed for the entire life of the driver.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. The introducing commit is e85087beedcae. git merge-base --is-ancestor e85087beedcae HEAD succeeded. No later commit in this tree added MODULE_DEVICE_TABLE for this driver.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent history is e85087beedcae → probe simplify → vDPA API updates → probe error-path fix → get_vq_size. None of those touch the PCI ID table. Standalone; not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Pengpeng Hou is not the vDPA maintainer. Same day they sent an identical MODULE_DEVICE_TABLE fix for can: ctucanfd, which **is already in this 6.12 tree** as 877e99535dfb9 (Cc: [email protected], Fixes:, Greg KH). Maintainer of this driver is Michael S. Tsirkin, who applied the vDPA patch.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: No new helpers or structs. MODULE_DEVICE_TABLE has existed for decades. Applies standalone. git show 7eeda5e2487276ed87960655fdae1c97d9779a0e | git apply --check succeeded (exit 0).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 7eeda5e2487276ed87960655fdae1c97d9779a0e →
https://patch.msgid.link/[email protected]
- b4 dig -a: single revision (v1 only).
- Thread (saved mbox): MST replied the same day asking what the “source- level fix” boilerplate paragraph meant. No NAK, no requested code change. He later SOB’d and applied it (CommitDate 2026-08-19). No reviewer asked for Cc: stable.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc were Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez, [email protected], linux- [email protected]. Right maintainers. Only MST replied.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by, no bugzilla/syzbot. Author found it by inspecting the driver-owned match table vs missing alias export. No evidence of a live user report.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Same-day batch of missing-MODULE_DEVICE_TABLE patches (ctucanfd, octeon_ep vDPA, cadence PCI, this one). ctucanfd already landed in this stable tree. octeon_ep in *this* checkout also still lacks MODULE_DEVICE_TABLE (octep_pci_vdpa_map at drivers/vdpa/octeon_ep/octep_vdpa_main.c); that is a separate candidate and is not a dependency of this patch.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable searches returned 403; web search found no stable-list discussion of this specific Alibaba patch. The related ctucanfd patch *was* sent to stable and is in this tree. UNVERIFIED: no positive evidence this exact SHA was discussed on stable@; no evidence it was rejected either.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: No functions modified. Added MODULE_DEVICE_TABLE(pci, eni_pci_ids) next to eni_pci_ids[] / eni_vdpa_driver.
**Step 5.2: TRACE CALLERS**
Record: eni_pci_ids is used as .id_table of eni_vdpa_driver, registered via module_pci_driver(). PCI core matches on enumeration/hotplug. The new alias is consumed at module-install time by depmod, then at runtime by udev/systemd-udevd. Not an interrupt or syscall path.
**Step 5.3: TRACE CALLEES**
Record: Macro only. Expands to an alias symbol for file2alias.c. No allocations, locks, or I/O.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable when CONFIG_ALIBABA_ENI_VDPA=m and a matching PCI device appears (Red Hat Qumranet vendor 0x1af4, transitional virtio- net VIRTIO_TRANS_ID_NET, subsystem virtio-net). Userspace does not need a special syscall; PCI discovery is enough. Built-in builds are unaffected (macro is empty).
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: In-tree vDPA PCI drivers ifcvf and snet already have MODULE_DEVICE_TABLE(pci, ...). eni_vdpa and octeon_ep do not. Systematic omission, not unique to Alibaba.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. Local tree is **6.12.111** (git describe HEAD → p-6.12-3-gc504cf0baa3d8; VERSION=6 PATCHLEVEL=12 SUBLEVEL=111). Current eni_vdpa.c has eni_pci_ids and .id_table = eni_pci_ids with **no** MODULE_DEVICE_TABLE. git merge-base --is-ancestor 7eeda5e2487276ed87960655fdae1c97d9779a0e HEAD failed (fix not in this tree). Bug introduced in e85087beedcae (v5.16-rc1), well before 6.12.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Surrounding lines match the upstream hunk exactly. git apply --check clean. Expected difficulty: **clean apply**.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: git log --grep='alibaba: add missing MODULE_DEVICE_TABLE' on this file is empty. No alternate autoload fix. ctucanfd’s analogous fix is already here, which shows this class is accepted on 6.12.y.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: drivers/vdpa/alibaba/ — vDPA PCI driver for Alibaba ENI. **PERIPHERAL** (cloud-specific, depends on PCI_MSI && X86). Not core mm/net, but a real distro-shipped driver.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: vDPA is actively maintained (recent ifcvf/mlx5/octeon_ep/vduse fixes). The Alibaba file itself is mature; last functional commits are API follow-ups plus a probe error-path fix. This is a long-standing omission, not churn from new code.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Config- and driver-specific: CONFIG_ALIBABA_ENI_VDPA=m on x86 with Alibaba ENI (legacy virtio 0.9.5 transitional net PCI IDs). Built- in (=y) already probes via the in-kernel id_table.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Trigger is ordinary PCI enumeration with the module not preloaded. Common for distro modular kernels. Unprivileged users cannot exploit it; the failure is “device never binds until someone modprobes”.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Failure mode: driver never autoloads → vDPA/ENI NIC does not come up. Not a panic, UAF, or corruption. Severity **MEDIUM** for affected hardware (device non-functional until manual load). Matches the device-ID/quirk exception, not a crash-class bug.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: restores autoload for a driver that already exists in 6.12; hardware that distros already ship a module for actually binds.
- Risk: **very low** (one line, build-time metadata only).
- Ratio: strongly favorable. Same class already taken into this tree (877e99535dfb9).
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real functional bug: PCI match table present, aliases unpublished.
- One-line, obviously correct, applies cleanly to this 6.12 tree.
- Buggy code has been here since the driver was added (v5.16); the upstream fix is not an ancestor of HEAD.
- Device-ID / autoload publication is an established stable exception.
- Identical pattern from the same author already backported here (ctucanfd).
- Sibling vDPA PCI drivers already export MODULE_DEVICE_TABLE.
- Applied by the vDPA maintainer (MST) after seeing the patch.
- Zero runtime regression surface.
AGAINST:
- Not a crash, UAF, deadlock, or security issue.
- Niche (Alibaba ENI, x86, modular builds only).
- No user Reported-by.
- Author did not Cc: stable (expected for this review set; not a negative).
- MST questioned the boilerplate wording, not the code.
UNRESOLVED:
- Could not fetch lore.kernel.org/stable HTML (403). No evidence of rejection.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — one-line standard pattern; maintainer applied it.
2. Fixes a real bug that affects users? **PASS** — modular autoload fails for matching PCI devices.
3. Important issue? **PASS** under the device-ID / hardware-enablement exception (severity MEDIUM, not crash-class).
4. Small and contained? **PASS** — +1 line, one file.
5. No new features or APIs? **PASS** — publishes IDs the driver already matches on.
6. Can apply to the local tree? **PASS** — buggy code present; git apply --check clean.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **Device ID / module alias publication for an existing driver.** Equivalent to adding PCI IDs so hardware actually binds when built as a module.
**Step 9.4: DECISION**
This should be backported to this 6.12 tree. The driver is already here, the omission is real, the fix is trivial and has no runtime risk, and this tree already accepted the same class of fix.
---
### What the commit solves and why it matters here
Without MODULE_DEVICE_TABLE(pci, eni_pci_ids), file2alias never emits PCI aliases for alibaba-eni-vdpa. On 6.12 systems that build CONFIG_ALIBABA_ENI_VDPA=m, udev will not load the module when the ENI virtio-net PCI device appears, so the vDPA device never probes unless something else loads the module. The in-kernel id_table still works after a manual modprobe; autoload is what is broken.
### Stable rules and risk
The change is one line, matches the PCI driver idiom used by ifcvf/snet, and does not alter probe/remove. Risk is essentially zero. Benefit is limited to Alibaba ENI modular users, but that is the same justification used for PCI ID additions and for the ctucanfd autoload fix already on this branch.
### Concerns
None material for this tree. No prerequisites. No backport rewrite needed. octeon_ep has the same omission locally; that is independent.
---
Verification:
- [Phase 1] Parsed tags from git show 7eeda5e2487276ed87960655fdae1c97d9779a0e: SOB Hou, SOB Tsirkin, Message-ID; no Fixes/Reported-by/Cc:stable
- [Phase 2] Diff: +1 line MODULE_DEVICE_TABLE(pci, eni_pci_ids) in eni_vdpa.c; no function body change
- [Phase 2] Confirmed MODULE_DEVICE_TABLE expansion in include/linux/module.h (alias for modules, empty if built-in)
- [Phase 2] Confirmed do_pci_entry() in scripts/mod/file2alias.c generates pci: aliases from exported tables
- [Phase 3] git blame -L 540,560: ID table from e85087beedcae (v5.16-rc1)
- [Phase 3] git merge-base --is-ancestor e85087beedcae HEAD: yes (bug present)
- [Phase 3] git merge-base --is-ancestor 7eeda5e2487276ed87960655fdae1c97d9779a0e HEAD: no (fix absent)
- [Phase 3] Same-author ctucanfd fix 877e99535dfb9 already in this tree
- [Phase 4] b4 dig -c 7eeda5e…:
https://patch.msgid.link/[email protected]
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] b4 dig -w: MST, Jason Wang, Xuan Zhuo, Eugenio Pérez, virtualization@, lkml
- [Phase 4] mbox: MST asked about boilerplate wording; no NAK; later applied
- [Phase 4] lore.kernel.org HTML fetches returned 403; used b4 mbox + openwall copy instead
- [Phase 5] Callers: module_pci_driver → PCI probe; aliases consumed by depmod/udev
- [Phase 5] Sibling drivers ifcvf/snet already have MODULE_DEVICE_TABLE; octeon_ep still missing (independent)
- [Phase 6] git describe HEAD / make kernelversion: 6.12.111 (p-6.12-3-gc504cf0baa3d8)
- [Phase 6] Current eni_vdpa.c lines 540–559: table present, MODULE_DEVICE_TABLE absent
- [Phase 6] git apply --check of the commit: success
- [Phase 7] Kconfig: ALIBABA_ENI_VDPA tristate, depends on PCI_MSI && X86
- [Phase 8] Failure mode: module autoload skip → device does not bind; severity MEDIUM; risk very low
- UNVERIFIED: no stable@ thread found (lore/stable HTTP 403); did not drive the decision
The fix is small, surgical, present as a real autoload bug in this 6.12 tree, and meets the device-ID/hardware-enablement exception.
**YES**
drivers/vdpa/alibaba/eni_vdpa.c | 1 + 1 file changed, 1 insertion(+)
drivers/vdpa/alibaba/eni_vdpa.c +1 -0
@@ -545,6 +545,7 @@ static struct pci_device_id eni_pci_ids[] = { VIRTIO_ID_NET) }, { 0 }, }; +MODULE_DEVICE_TABLE (pci, eni_pci_ids);static struct pci_driver eni_vdpa_driver = { .name = "alibaba-eni-vdpa",
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.1] vdpa: alibaba: add missing MODULE_DEVICE_TABLE()
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] vdpa: alibaba: exporting generic virtio-net PCI ID breaks virtio_pci binding --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vdpa: alibaba: exporting generic virtio-net PCI ID breaks virtio_pci binding --
commit 56e367c85e2f18386c5a07775af8ff1e3da0457f
Author: Pengpeng Hou <[email protected]>
vdpa: alibaba: add missing MODULE_DEVICE_TABLE()
This commit adds MODULE_DEVICE_TABLE(pci, eni_pci_ids) to the Alibaba ENI vDPA driver so that PCI module alias entries are generated for automatic module loading.
drivers/vdpa/alibaba/eni_vdpa.c static struct pci_device_id eni_pci_ids[] = { · line 551
Quoted 12 lines
drivers/vdpa/alibaba/eni_vdpa.c +1
-0@@ -545,6 +545,7 @@ static struct pci_device_id eni_pci_ids[] = { VIRTIO_ID_NET) }, { 0 }, }; +MODULE_DEVICE_TABLE (pci, eni_pci_ids);static struct pci_driver eni_vdpa_driver = { .name = "alibaba-eni-vdpa",
[Severity: High]
Will exporting eni_pci_ids via MODULE_DEVICE_TABLE() cause eni_vdpa to auto-load on standard non-Alibaba x86 VMs and race with virtio_pci for generic transitional or legacy virtio-net PCI devices?
In drivers/vdpa/alibaba/eni_vdpa.c, eni_pci_ids matches the generic Virtio 0.9.5 / transitional Virtio 1.0 network device IDs rather than an Alibaba-specific PCI ID:
drivers/vdpa/alibaba/eni_vdpa.c:
static struct pci_device_id eni_pci_ids[] = {
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
VIRTIO_TRANS_ID_NET,
PCI_SUBVENDOR_ID_REDHAT_QUMRANET,
VIRTIO_ID_NET) },
{ 0 },
};These are the same PCI IDs (vendor 0x1af4, device 0x1000, subvendor 0x1af4, subdevice 0x0001) exposed by default virtio-net-pci devices in QEMU/KVM and matched by virtio_pci_id_table in drivers/virtio/virtio_pci_common.c:
static const struct pci_device_id virtio_pci_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) },
{ 0 }
};MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
Previously, omitting MODULE_DEVICE_TABLE() prevented eni_vdpa from publishing a modalias for 1af4:1000, so it was only loaded when explicitly requested by userspace on Alibaba instances. With MODULE_DEVICE_TABLE() added, udev/kmod will auto-load eni_vdpa on any x86 guest with a transitional or legacy virtio-net-pci device when CONFIG_ALIBABA_ENI_VDPA=m and CONFIG_VIRTIO_PCI=m.
In eni_vdpa_probe(), there is no hardware check distinguishing an Alibaba ENI device from a standard QEMU virtio-net-pci device:
drivers/vdpa/alibaba/eni_vdpa.c:eni_vdpa_probe() {
...
ldev = &eni_vdpa->ldev;
ldev->pci_dev = pdev;
ret = vp_legacy_probe(ldev);
if (ret) {
ENI_ERR(pdev, "failed to probe legacy PCI device\n");
goto err;
}
...
}If eni_vdpa probes the PCI device before virtio_pci, eni_vdpa_probe() -> vp_legacy_probe() succeeds and claims the device into the vDPA subsystem via vdpa_register_device(), preventing virtio_pci from binding and causing the guest to lose its standard virtio_net network interface.
Was MODULE_DEVICE_TABLE() intentionally omitted here to avoid hijacking generic legacy/transitional virtio-net PCI devices from virtio_pci?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 iommu/tegra241-cmdqv: Rate-limit the error ISR's log message
In reply to Sasha LevinFrom: Nicolin Chen <[email protected]>
[ Upstream commit a86c36163c9722545d27e92bdad8418fdcaa8b1d ]
tegra241_cmdqv_isr() logs the error-map registers on every error interrupt. A malfunctioning device, or a guest deliberately faulting its own VCMDQs, can raise these interrupts rapidly, and the unconditional dev_warn() then floods the kernel log.
Rate-limit the message with dev_warn_ratelimited(), and pass the error-map registers straight to it so their four MMIO reads run only when the limiter prints, instead of building the string on every interrupt.
---
LLM Generated explanations, may be completely bogus:
The local checkout is **v7.3-rc4**. The driver and the unconditional ISR dev_warn() are present here; the change is a small, self-contained log-flood / guest-DoS mitigation, so it belongs in this tree.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[iommu/tegra241-cmdqv] [Rate-limit] [stop the error ISR from printing on every interrupt]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Fixes:** none (expected)
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by / Acked-by:** none on the commit itself
- **Link:** none
- **Cc: stable:** none on this patch
- **Assisted-by:** Claude:claude-opus-4-8
- **Signed-off-by:** Nicolin Chen (NVIDIA; author), Will Deacon (arm- smmu maintainer; applied it)
- Pipeline markers such as Sasha Levin SOB / “[Upstream commit]” were not on the real commit (a86c36163c972)
Notable: no user/syzbot report. The cover letter says the series came from **Sashiko** (LLM) review, not a production crash.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** tegra241_cmdqv_isr() logs error-map registers with unconditional dev_warn() on every error interrupt.
- **Symptom:** kernel log flood.
- **Trigger (stated):** malfunctioning device, or a **guest deliberately faulting its own VCMDQs**, raising interrupts rapidly.
- **Root cause:** every interrupt builds a 256-byte string (including four extra MMIO reads) and prints it.
- **Fix:** dev_warn_ratelimited(), and pass the MMIO reads as printk args so they run only when the limiter actually prints.
- **Version info:** none in the message.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is an explicit flood/DoS mitigation. It does not fix a UAF, leak, or crash by itself.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c (+7 / −9)
- Function: tegra241_cmdqv_isr()
- Scope: **single-file surgical** (one logging site)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** ISR always snprintf()s into char err_str[256], always does four CMDQ_ERR_MAP MMIO reads, always dev_warn().
- **After:** no stack buffer; dev_warn_ratelimited(...) with the four readl_relaxed() calls as arguments.
- Path: **error interrupt path** (threaded IRQ). Error *handling* after the log is unchanged.
Verified dev_level_ratelimited() in include/linux/dev_printk.h: the __VA_ARGS__ are only substituted inside if (__ratelimit(&_rs)), so those MMIO reads run only when a line is printed.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** ISR log flood / availability (guest-triggered printk storm), plus extra MMIO on every interrupt.
- **Not:** UAF, leak, deadlock, OOB, or NULL deref.
- **Hardware workaround?** No.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: standard *_ratelimited pattern already used in other IOMMU fault paths (arm-smmu-v3.c, virtio-iommu.c, AMD/Intel, etc.).
- Minimal; no unrelated edits.
- Regression risk: **very low**. Worst case is fewer error-map dumps in dmesg (intended). Error recovery is untouched.
- Red flags: LLM-assisted; no Fixes:/Reported-by. Not a new API.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Unconditional dev_warn() + snprintf were in the original driver:
918eb5c856f6 (“Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV”), **2024-08-30**, first in **v6.12-rc1**.
- This tree is **v7.3-rc4**, so that code is in this lineage.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. N/A. The logging has been there since the driver was added.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: This is **v2 11/11** of “Fix error-interrupt races and VINTF lifecycle bugs” (Nicolin Chen, 2026-07-14). Cover letter: ordered **most-critical-first**; this is the last, smallest issue (“ISR flooding the kernel log under repeated guest errors”).
Standalone: it only changes the log line and does **not** need the earlier UAF/lifecycle patches to be correct.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Nicolin Chen is the NVIDIA CMDQV contributor for this file; Will Deacon applied the series. Same-day siblings are real lifecycle/UAF/bounds fixes. This one is the leftover logging hardening.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None required. dev_warn_ratelimited is old. The hunk applies to the original ISR as well as the post-series ISR.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c a86c36163c972 → https://patch.msgid.link/2e9d088c059037d5f
[email protected]
- **v1** (2026-07-02) and **v2** (2026-07-14); committed version is **v2 11/11**.
- No NAK on this patch. Review noise in the thread was about **patch 10/11** (dropped); Will applied 01–09 and 11.
- No reviewer asked for Cc: stable on *this* patch. Patch 07/11 in the same series did have Cc: stable (unrelated vSID check).
- WebFetch to lore returned **403**; thread was read from the b4 mbox instead.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): Nicolin Chen, Will Deacon, Robin Murphy, Joerg Roedel, Jason Gunthorpe; lists iommu@, linux-arm-kernel, linux- tegra. Maintainer **Will Deacon applied it** (“Applied (apart from patch 10)”).
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot/bugzilla link. Origin is **Sashiko** static review, described in the cover letter. Nicolin also noted Sashiko false positives (including a wrong “level-triggered / kdump storm” claim); CMDQV is **edge-triggered**, so an *unacked* pending error does not re- assert. **Each new error still fires the ISR**, which is the remaining flood path this patch addresses.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: 11-patch series; this patch is independent logging. Not blocked on the dropped 10/11.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: **UNVERIFIED** via lore.kernel.org/stable (HTTP 403). The submitted 11/11 message itself has no Cc: stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
semcode MCP: **not available**. Used git grep / file reads.
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: tegra241_cmdqv_isr() only.
**Step 5.2: TRACE CALLERS**
Record: Registered in __tegra241_cmdqv_probe() via request_threaded_irq(..., tegra241_cmdqv_isr, IRQF_ONESHOT, ...). Not a hardirq; still a hot error path. Hardware: NVIDIA Tegra241 (Grace) CMDQ-V (CONFIG_TEGRA241_CMDQV).
**Step 5.3: TRACE CALLEES**
Record: readl_relaxed of VINTF/CMDQ error maps; dev_warn_ratelimited; then tegra241_vintf0_handle_error / tegra241_vintf_user_handle_error. Those handlers are unchanged.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable when CMDQV is enabled (Grace SMMU). A guest with a user VINTF/VCMDQ can generate command-queue errors; each new error latches and interrupts. That is a userspace/VM-reachable path, not a theoretical internal-only site.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Rate-limited IOMMU fault logs are the normal pattern elsewhere. This driver was the outlier with a raw dev_warn() in the ISR.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Record:
- git describe HEAD → **v7.3-rc4-27-gf0100363d8c37**
- make kernelversion → **7.3.0-rc4**
- Driver file exists; original ISR logging from 918eb5c856f6 (v6.12).
- git merge-base --is-ancestor a86c36163c972 HEAD → **yes** (already merged here). That is not used as “already selected for stable”; it only confirms this lineage has the driver and the fix.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** on this tree (already applied). The hunk does not depend on later ISR locking. On a tree that still has the original snprintf/dev_warn ISR, it would apply with at most trivial context.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No earlier equivalent rate-limit. a2ee315db4261 only uses WARN_ON_ONCE for out-of-bounds map bits; it does not throttle the “unexpected error reported” line.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **drivers/iommu/arm/arm-smmu-v3** (NVIDIA Grace CMDQ-V). **PERIPHERAL/IMPORTANT for that platform**: only CONFIG_TEGRA241_CMDQV / Tegra241 (Grace) systems, including virtualization hosts using user VINTFs.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively developed in 2026 (large Sashiko fix series + iommufd work). Logging bug itself is old (v6.12).
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **platform-specific / config-specific** — NVIDIA Grace + CONFIG_TEGRA241_CMDQV. Hosts that expose guest VCMDQs are the interesting population.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: CMDQV error IRQ. Commonness: rare on healthy HW; can be **frequent** if a device malfunctions or a **guest injects VCMDQ errors**. Unprivileged guest with VCMDQ access can trigger it. Not every boot.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Direct effect: dmesg/console flood; extra MMIO + snprintf on every interrupt.
- Indirect: printk/console contention, lost messages, possible stalls on a slow console.
- Not an oops, UAF, or data corruption.
- **Severity: MEDIUM** (availability / “oh, that’s not good”), with a stated guest DoS path.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** medium for Grace virtualization hosts; low for everyone else.
- **Risk:** very low (7 lines, logging only).
- **Ratio:** favorable. Official stable rules allow “oh, that’s not good” and require an exploit explanation for “could be a problem” issues; the message gives that explanation.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real, described flood: guest or bad device can fire the error IRQ repeatedly; each new error still interrupts (edge-triggered, latched per event).
- Tiny, obviously correct, matches other IOMMU drivers.
- Error handling unchanged; MMIO for the log runs only when printing.
- Driver and buggy logging exist in **this** 7.3-rc4 tree (since v6.12).
- Applied by the arm-smmu maintainer; no NAK on this patch.
- Official rules: not a trivia cleanup; exploit path is written down.
AGAINST:
- No production Reported-by; LLM-found.
- Least-critical patch in its series (11/11).
- Threaded IRQ (IRQF_ONESHOT), so not a hardirq printk.
- Unacked-guest *storm* was already ruled out as a false positive; this only limits *new*-error spam.
- Not a crash/corruption/UAF.
UNRESOLVED:
- Could not query lore.kernel.org/stable (403).
- No Tested-by.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — standard ratelimit; maintainer applied. No extra tester tag.
2. Fixes a real bug that affects users? **PASS** — log flood / guest- driven interrupt spam on Grace CMDQV; users of that hardware exist.
3. Important issue? **PASS** (low end) — not oops/corruption; it is an explained availability issue (“oh, that’s not good” / guest printk DoS), which the documented rules allow.
4. Small and contained? **PASS** — ~16 lines, one function.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — pre-image exists here; apply is clean.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID, quirk table, DT, build, or docs fix). Qualifies as a normal small bugfix, not via an exception.
**Step 9.4: MAKE YOUR DECISION**
This tree contains the Tegra241 CMDQV driver and the original unconditional ISR dev_warn(). The patch is a 7-line, obviously correct rate-limit that closes a guest-reachable log flood without touching recovery logic. Benefit is limited to Grace CMDQV, but risk is negligible, so it meets the bar for this tree.
What it solves for users here: a VM or failing CMDQ can spam the host log and extra MMIO on every error IRQ. That is not a panic, but it is a real host-side availability nuisance on this platform.
Verification:
- [Phase 1] Tags: Assisted-by Claude; SOB Nicolin Chen + Will Deacon; no Fixes/Reported-by/Cc: stable on this commit
- [Phase 2] Diff: tegra241_cmdqv_isr() snprintf+dev_warn → dev_warn_ratelimited; +7/−9
- [Phase 2] Confirmed dev_level_ratelimited only evaluates args when __ratelimit() allows print
- [Phase 3] git blame / original file: logging from 918eb5c856f6 (v6.12-rc1)
- [Phase 3] git describe --contains 918eb5c856f6 → v6.12-rc1~149^2^2~19
- [Phase 3] Series: v2 11/11; parent is VINTF0 leak fix, not a functional prereq
- [Phase 4] b4 dig -c a86c36163c972: lore/patch.msgid.link match; v1 then v2
- [Phase 4] b4 dig -a: v1 2026-07-02, v2 2026-07-14 (applied)
- [Phase 4] b4 dig -w: iommu maintainers on To/Cc; Will applied 11/11, dropped 10/11
- [Phase 4] mbox: cover letter lists log flood; no comments/NAK on 11/11; Cc: stable only on 07/11
- [Phase 4] WebFetch lore/stable: 403; stable-list search UNVERIFIED
- [Phase 5] Caller: request_threaded_irq in __tegra241_cmdqv_probe; CONFIG_TEGRA241_CMDQV
- [Phase 6] git describe HEAD → v7.3-rc4-27-gf0100363d8c37; make kernelversion → 7.3.0-rc4
- [Phase 6] git merge-base --is-ancestor a86c36163c972 HEAD → ancestor (code exists here)
- [Phase 8] Failure mode: printk flood / guest DoS, severity MEDIUM
- UNVERIFIED: lore.kernel.org/stable discussion (HTTP 403)
**YES**
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +7 -9
@@ -350,21 +350,19 @@ static irqreturn_t tegra241_cmdqv_isr(int irq, void *devid) {struct tegra241_cmdqv *cmdqv = (struct tegra241_cmdqv *)devid;void __iomem *reg_vintf_map =REG_CMDQV (cmdqv,VINTF_ERR_MAP ); -char err_str[256 ];u64 vintf_map;/* Use readl_relaxed() as register addresses are not 64-bit aligned */ vintf_map = (u64 )readl_relaxed (reg_vintf_map +0x4 ) <<32 | (u64 )readl_relaxed (reg_vintf_map); -snprintf (err_str,sizeof (err_str), -"vintf_map: %016llx, vcmdq_map %08x:%08x:%08x:%08x" , vintf_map, -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (3 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (2 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (1 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (0 )))); - -dev_warn (cmdqv->dev,"unexpected error reported. %s\n" , err_str); +dev_warn_ratelimited ( + cmdqv->dev, +"unexpected error reported. vintf_map: %016llx, vcmdq_map %08x:%08x:%08x:%08x\n" , + vintf_map,readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (3 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (2 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (1 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (0 ))));/* Handle VINTF0 and its LVCMDQs */ if (vintf_map &BIT_ULL (0 )) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: usb-audio: Add iD14 MkI to monitor-mix volume quirk
In reply to Sasha LevinFrom: Will Porter <[email protected]>
[ Upstream commit 17056a36d276a740f09dca723de1bc6aa3eb4ef9 ]
Add the iD14 MkI USB ID to the existing audient_id14_map. This names feature unit 12 Monitor Mix Playback Volume.
Live meter A/B testing on MkI USB ID 2708:0002 reproduced the same asymmetric attenuation seen on MkII. At ALSA value 104, the right channel was 23.07 dB below the left. At 127, both channels were equal.
The misleading Speaker Playback Volume name causes PipeWire to adopt FU12 as the stream master. Reuse the existing map to keep the control available while preventing that selection.
Hardware-tested on Bazzite 7.2.0-ogc4.1.fc44.x86_64 with this change backported. ALSA exposed Monitor Mix Playback Volume after module load and USB reconnect. PipeWire volume changes from 100% to 35% and back left all four FU12 values at 127. Channel-isolated left/right playback remained balanced after reconnect.
Build-tested with CONFIG_SND_USB_AUDIO=m using the focused sound/usb target.
---
LLM Generated explanations, may be completely bogus:
I have the local-tree, prerequisite, and mailing-list evidence. Writing the full nine-phase analysis next.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[ALSA / usb-audio] [Add] Add iD14 MkI USB ID to the existing monitor-mix volume name map**
- Subsystem: ALSA: usb-audio
- Action verb: **Add** (USB ID / quirk-table entry, not a new API)
- Intent: extend audient_id14_map so MkI feature unit 12 is named “Monitor Mix Playback Volume” instead of “Speaker Playback Volume”
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Fixes:** none (expected for this review pipeline)
- **Reported-by:** none
- **Tested-by:** none as a tag; body describes first-party hardware test
- **Reviewed-by:** none
- **Acked-by:** none
- **Link:** https://patch.msgid.link/20260823015353.686080-1- [email protected]
- **Cc: stable:** none (expected; not a negative signal)
- **Assisted-by:** Codex:gpt-5
- **Signed-off-by:** Will Porter <[email protected]>
- **Signed-off-by:** Takashi Iwai <[email protected]> (ALSA maintainer; ignore any Sasha Levin SOB)
- **Upstream commit** markers: ignore per instructions
Notable: no syzbot, no multi-user Reported-by. Strength comes from hardware measurement and maintainer apply.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** FU 12 is walked through to the Speaker output terminal, so ALSA exports it as “Speaker Playback Volume”. PipeWire then uses that control as the stream hardware master.
- **Symptom:** asymmetric attenuation. On MkI 2708:0002, ALSA value 104 → right channel **23.07 dB** below left; at 127 both channels match.
- **Root cause:** misleading default name, not a kernel crash path. Same class of bug already described for MkII.
- **Fix:** reuse audient_id14_map so the control is “Monitor Mix Playback Volume” and is no longer chosen as stream master, while remaining reachable.
- **Version info:** tested as a backport on Bazzite 7.2.0-ogc4.1.fc44.x86_64; build-tested with CONFIG_SND_USB_AUDIO=m.
- **Hidden vs explicit:** this is an explicit hardware-quirk / name-map fix, not cleanup disguised as a fix.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not a hidden fix.** The message states the imbalance, the userspace trigger, and the map reuse. It is a USB mixer name-map quirk.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** sound/usb/mixer_maps.c only
- **Scope:** +13 / −8 (comment rewrite + one usbmix_ctl_maps[] entry)
- **Functions / objects:** audient_id14_map[] comment; usbmix_ctl_maps[] (adds USB_ID(0x2708, 0x0002))
- **Classification:** single-file surgical USB-ID / quirk addition
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before (mainline, MkII-only):** audient_id14_map remaps unit 12 → "Monitor Mix Playback" for 0x2708:0x0008 only. MkI 0x2708:0x0002 still gets the default “Speaker Playback Volume” name.
- **After:** same map is also bound to 0x2708:0x0002. snd_usb_create_mixer() walks usbmix_ctl_maps[], matches chip->usb_id, and check_mapped_name() supplies the mapped name. Because mapped_name is set, mixer.c does **not** append " Playback"; it still appends " Volume" → "Monitor Mix Playback Volume".
- **Path:** mixer probe / control-creation only. Not a hot path, error path, or locking change.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** **(h) Hardware workaround** + **(g) logic/correctness of exported control name**
- **Mechanism:** default terminal-derived name makes PipeWire treat a monitor-mix FU as master volume. That FU does not apply equally to all channels (MkI: imbalance inside the stereo pair; MkII: 4 of 6 channels). Remapping the name stops that selection without dropping the control (dropping it would strand a persisted attenuated FU12).
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** obviously correct and matches an established usbmix_name_map pattern already used throughout this file.
- **Regression risk:** very low. The new entry is keyed by USB ID 0x2708:0x0002 only. Other devices are untouched. The control remains present under a different name.
- **Red flags:** none for APIs, locking, or size. Dependency: the commit **assumes** audient_id14_map and the MkII 0x2708:0x0008 entry already exist.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- In **this** 6.12 tree, audient_id14_map and the 0x2708:0x0008 ctl- map entry **do not exist**.
- The buggy *behavior* is the long-standing default in __build_feature_ctl() (sound/usb/mixer.c): if there is no map, volume is named from the output terminal (“Speaker”) + " Playback" + " Volume". That logic is in this tree (verified at mixer.c:1740–1786).
- MkI already has a **different** quirk here since 2021: df0380b9539b0 (“ALSA: usb-audio: Add quirk for Audient iD14”) adds DEVICE_FLG(0x2708, 0x0002, QUIRK_FLAG_IGNORE_CTL_ERROR) in sound/usb/quirks.c:2374. That is control-message error ignoring, not this name-map.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Not applicable.
The functional prerequisite is the MkII map, submitted 2026-08-13 by Neil Andrews: “ALSA: usb-audio: Rename the Audient iD14 monitor mix volume control” (adds audient_id14_map + USB_ID(0x2708, 0x0008)). Takashi applied that to for-next on 2026-08-14. That commit is **not** in this 6.12 checkout.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record (this tree, sound/usb/mixer_maps.c):
- Recent entries are the same class of quirk: Corsair Virtuoso later revision, Razer Barracuda dB map, Corsair HS80, Gigabyte B450, MSI boards, etc.
- This candidate is **standalone relative to a series** (not “N/M”), but it **depends** on the Aug 13 MkII map commit.
- Same-class commits **already backported into this 6.12 tree**:
- 0d928648172c3 Corsair Virtuoso later revision — adds USB IDs to an existing mixer map
- c74de4e57685d Corsair HS80 — new mixer map so PulseAudio/PipeWire do not grab the wrong volume
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record:
- Will Porter has **no** other usb-audio commits in this tree.
- Neil Andrews has none here either.
- Takashi Iwai is the ALSA/usb-audio maintainer and applied both the MkII and MkI patches immediately (“Applied now. Thanks.” / “Applied to for-next branch.”).
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record:
- **Prerequisite:** MkII audient_id14_map (Neil Andrews, 2026-08-13). Missing from HEAD, from master in this repo (tip ~7.2-rc7, 2026-08-08), and from linux-rolling-stable / linux-rolling-lts mixer_maps.c.
- **Can this SHA apply standalone here?** No. Context hunks (the map comment and the 0x2708:0x0008 entry) are absent.
- **Can a backport stand alone?** Yes. usbmix_name_map / usbmix_ctl_maps / find_map() / check_mapped_name() already exist. A 6.12 backport is: add the 4-line map plus the MkI (and optionally MkII) USB ID. That is the same shape as HS80/Virtuoso maps already in this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c <sha>: candidate SHA is **not in this repo** (applied after current master tip). Used msgid instead.
- b4 mbox msgid [email protected]:
**2-message thread**.
- Lore/LKML: https://lkml.iu.edu/2608.2/12083.html
- **Revisions:** single version (v1). `base-commit:
7e77c09e23dae1ff8bd8598c3c96f9db6862eddd` (object exists here but is **not** an ancestor of this 6.12 HEAD).
- **Reviewer feedback:** Takashi Iwai, 2026-08-23: “Applied now. Thanks.” No NAK, no requested changes, no stable nomination in-thread.
- MkII prerequisite thread: https://lists.openwall.net/linux-
kernel/2026/08/13/2036 — Takashi: “Applied to for-next branch. Thanks.”
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To/Cc on the MkI mail includes the ALSA path; Takashi (subsystem maintainer) applied it the next morning. No other review comments.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record:
- No bugzilla/syzbot link.
- Evidence is the author’s live-meter A/B test on MkI 2708:0002, reproducing the MkII imbalance (Neil Andrews measured 20.00 dB on MkII via digital loopback).
- **Users affected:** owners of Audient iD14 MkI (USB 2708:0002) using PipeWire (default on modern desktops). MkI has been quirked in-tree since 2021, so this population exists on 6.12.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Not a numbered series. Follow-up to the MkII rename (different author, 10 days later). For this tree, a useful backport is **map + MkI ID** (MkII ID optional).
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable returned 403; WebSearch on site:lore.kernel.org/stable for this subject found **no** iD14 monitor-mix discussion. No recorded reason to exclude it. The 2021 IGNORE_CTL_ERROR quirk **was** sent to stable ([PATCH 5.15 12/12]).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS IN THE DIFF**
Record: no function bodies changed. Data only: audient_id14_map, usbmix_ctl_maps[].
**Step 5.2: TRACE CALLERS**
Record:
- snd_usb_create_mixer() (mixer.c:3272) walks usbmix_ctl_maps[] and sets state.map on USB ID match.
- find_map() / check_mapped_name() / __build_feature_ctl() consume that map when creating feature-unit kcontrols.
- Context: USB audio probe / mixer build. Not IRQ, not a syscall hot path.
**Step 5.3: TRACE CALLEES**
Record: map is data. Naming uses check_mapped_name() → strscpy(), then append_ctl_name(..., " Volume"). No alloc/lock/I/O in the new code.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: userspace-reachable: plug in iD14 MkI → snd-usb-audio probe → mixer controls appear → PipeWire enumerates “Speaker Playback Volume” as hardware master. **Yes, reachable from normal desktop use.** Unprivileged users can trigger it by moving the session volume.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: this file is full of the same pattern (Corsair, Gigabyte, MSI, Bose, …). This 6.12 tree already backported sibling “wrong mixer name → userspace grabs the wrong volume” quirks.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record:
- **Tree:** git describe HEAD = p-6.12-3-gc504cf0baa3d8; make kernelversion = **6.12.111**.
- **Buggy default naming:** yes, sound/usb/mixer.c __build_feature_ctl().
- **MkI device:** yes, QUIRK_FLAG_IGNORE_CTL_ERROR for 0x2708:0x0002.
- **audient_id14_map / MkII ID 0x2708:0x0008:** **no**.
- Bug is **not** “introduced after 6.12 branched”. The hardware + default namer have been here for years. The *fix table* is what is new (2026).
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **needs a small backport, not a clean git am.** Insertion point still exists (MAYA44 USB+ then KEF X300A at mixer_maps.c:586–595). Add audient_id14_map after gigabyte_b450_connector_map and a usbmix_ctl_maps[] entry for 0x2708:0x0002. Line numbers differ slightly from mainline; no structural conflict.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: no monitor-mix / audient_id14 name map. The 2021 IGNORE_CTL_ERROR quirk is unrelated and does not fix imbalance.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: **ALSA USB-audio mixer maps** (sound/usb/mixer_maps.c).
Criticality: **PERIPHERAL / device-specific**, but the driver is common (CONFIG_SND_USB_AUDIO). Same class as USB/codec quirks that stable accepts routinely.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: actively maintained; this 6.12 tree continues to take mixer-map USB ID and naming quirks (Virtuoso, HS80, etc.).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: **driver-specific / USB-ID-specific** — Audient iD14 MkI (2708:0002). MkII (2708:0008) is not even listed in this tree; this commit’s MkI ID is the one that matters here.
**Step 8.2: TRIGGER CONDITIONS**
Record:
- Trigger: PipeWire (or similar) adopts “Speaker Playback Volume” as stream master and the user sets volume below 0 dB / 100%.
- **How common:** every volume change below unity on a typical desktop, once the device is plugged in.
- **Unprivileged:** yes (session volume). Not a privilege-escalation issue; it is broken stereo.
**Step 8.3: FAILURE MODE SEVERITY**
Record:
- **Failure:** large L/R imbalance (measured **23.07 dB** at ALSA 104). Audio is effectively wrong; not a panic/UAF.
- **Severity: HIGH for affected hardware** (serious functional/hardware bug), **not CRITICAL** (no crash/corruption/security).
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** high for MkI owners on 6.12 (device already quirked here since 2021; PipeWire is the usual stack).
- **Risk:** very low (ID-keyed name map; ~10-line backport).
- **Ratio:** strongly favors backporting, matching Virtuoso/HS80 precedent **in this same tree**.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real, measured 23 dB channel imbalance on MkI; same class as the MkII bug.
- Hardware-tested, including a backport; maintainer applied v1 immediately.
- Classic USB mixer name-map / hardware quirk (stable exception).
- This 6.12 tree already ships the same kind of mixer_maps USB-ID quirks.
- MkI is already a supported ID here; the namer bug is present.
- Tiny, ID-scoped, no new API, no locking.
**AGAINST:**
- audient_id14_map is not in this tree; the patch does not apply as- is.
- Depends on the Aug 2026 MkII map commit (18 lines).
- Not a crash/security/corruption bug.
- Affects one USB audio interface.
**UNRESOLVED:**
- Exact mainline SHA is not in this clone (master stops at ~2026-08-08). Thread + msgid confirm apply.
- Stable list search could not be fetched (403); no positive or negative stable-list signal.
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — map reuse; hardware + build tested; maintainer applied.
2. Fixes a real bug that affects users? **PASS** — 23 dB imbalance under PipeWire.
3. Important issue? **PASS** under the hardware-quirk exception (severe broken output on a supported device). Not a kernel crash.
4. Small and contained? **PASS** — one file; backport is a small map + ID.
5. No new features or APIs? **PASS** — rename existing control via existing map machinery.
6. Can apply to the local tree? **PASS with backport** — not a clean apply; fold in audient_id14_map (and optionally the MkII ID). Infrastructure is already here.
**Step 9.3: EXCEPTION CATEGORIES**
Record: **Hardware quirk / USB ID addition** to the existing usb-audio mixer map tables. Same exception as USB quirks and HDA SND_PCI_QUIRK entries.
**Step 9.4: DECISION**
This is a device-specific name-map quirk for hardware this 6.12 tree already supports. The missing MkII map is a packaging dependency, not a missing subsystem: a few lines of usbmix_name_map plus USB_ID(0x2708, 0x0002) are enough. That is exactly the class of mixer_maps change this tree already takes (HS80, Virtuoso). Benefit for MkI + PipeWire users is large; regression risk is confined to that USB ID.
---
### What the commit solves (for this tree)
On Audient iD14 MkI, feature unit 12 is exported as “Speaker Playback Volume”. PipeWire treats that as hardware master and, below 0 dB, attenuates channels unequally (23 dB L/R error in the author’s test). Remapping unit 12 to “Monitor Mix Playback Volume” stops that selection and keeps the monitor gain usable.
### Risk vs benefit
Benefit is restoring correct stereo for an interface already quirked in 6.12 since 2021. Risk is a few ID-keyed lines in mixer_maps.c. The only extra work is including audient_id14_map because the Aug 2026 MkII commit is not here.
### Concerns
- Do not git am the mainline diff as-is; add the map (and the MkI ID) by hand.
- MkII 0x2708:0x0008 is optional on 6.12 (that ID is not present here).
---
### Verification
- **[Phase 1]** Parsed subject/tags/body from the provided commit and the b4 mbox. Tags: Link msgid, Assisted-by Codex, SOB Will Porter + Takashi Iwai. No Fixes/Reported-by/Cc:stable.
- **[Phase 2]** Diff is comment rewrite + one usbmix_ctl_maps[] entry for 0x2708:0x0002 in sound/usb/mixer_maps.c.
- **[Phase 2]** Verified naming in this tree: mixer.c:1740–1786 — mapped name suppresses " Playback", still appends " Volume".
- **[Phase 2]** Verified map attach: mixer.c:3272–3278 matches usbmix_ctl_maps[].id to chip->usb_id.
- **[Phase 3]** git describe HEAD / make kernelversion: **6.12.111** (p-6.12-3-gc504cf0baa3d8).
- **[Phase 3]** git grep on sound/usb: no audient_id14, no Monitor Mix; only DEVICE_FLG(0x2708, 0x0002) in quirks.c:2374.
- **[Phase 3]** git show df0380b9539b0: 2021 IGNORE_CTL_ERROR quirk; git merge-base --is-ancestor → present. Different bug.
- **[Phase 3]** git log --grep=iD14 -- sound/usb/: only that 2021 quirk plus an unrelated subject match. No monitor-mix map.
- **[Phase 3]** Similar 6.12 backports: 0d928648172c3 (Virtuoso USB IDs), c74de4e57685d (HS80 mixer map, cc: stable).
- **[Phase 3]** git merge-base --is-ancestor 7e77c09e23dae1... HEAD → **not** an ancestor; object type is commit.
- **[Phase 3]** master / linux-rolling-stable / linux-rolling-lts:
still no audient_id14_map (master tip ~2026-08-08, before both patches).
- **[Phase 4]** b4 mbox MkI thread (2 msgs): submission + Takashi “Applied now.”
- **[Phase 4]** b4 mbox MkII thread (2 msgs): Neil Andrews map + Takashi “Applied to for-next.”
- **[Phase 4]** WebFetch LKML/openwall confirmed both diffs. lore.kernel.org 403; stable-list search found nothing relevant.
- **[Phase 5]** Call chain: probe → snd_usb_create_mixer → __build_feature_ctl → PipeWire. Userspace-reachable.
- **[Phase 6]** Insertion neighbors MAYA44 / KEF X300A exist at mixer_maps.c:586–595; map array itself missing.
- **[Phase 8]** Failure mode verified from commit text + MkII loopback measurements in the prerequisite mail (20 dB MkII / 23 dB MkI).
- **UNVERIFIED:** mainline SHA of the applied MkI commit (not in this clone). Not used as a reason to reject; thread + maintainer apply are verified.
The missing MkII map is a few lines to include in the backport, not a missing subsystem. This is a hardware quirk this tree already accepts.
**YES**
sound/usb/mixer_maps.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
sound/usb/mixer_maps.c +13 -8
@@ -505,13 +505,13 @@ static const struct usbmix_connector_map gigabyte_b450_connector_map[] = { {} }; -/* Audient iD14: FU 12 advertises Volume on only 4 of its 6 logical channels -* and sits on the monitor mixer branch, but it is traced through to the -* Speaker output terminal and gets named "Speaker Playback Volume". Userspace -* then adopts it as the stream's hardware volume, and any setting below 0 dB -* attenuates some channels but not others (20 dB imbalance at 80%). Give it a -* non-standard name so that it is no longer taken for the stream's master -* volume, while remaining reachable for anyone who wants the monitor gain. +/* Audient iD14 MkI and MkII: FU 12 sits on the monitor mixer branch but is +* traced through to the Speaker output terminal, so it is named "Speaker +* Playback Volume". On MkII it controls only 4 of 6 playback channels. MkI +* testing found asymmetric attenuation within the main stereo pair. Userspace +* adopts this control as the stream's hardware volume, causing imbalance below +* 0 dB. Give it a non-standard name so that userspace no longer treats it as +* the stream master, while keeping the monitor gain reachable. */ static const struct usbmix_name_map audient_id14_map[] = { {12 ,"Monitor Mix Playback" },/* FU, partial coverage */
@@ -602,7 +602,12 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .map = maya44_map, }, { -/* Audient iD14 */ + /* Audient iD14 MkI */ + .id = USB_ID(0x2708, 0x0002), + .map = audient_id14_map, + }, + { + /* Audient iD14 MkII */ .id = USB_ID(0x2708, 0x0008), .map = audient_id14_map, },
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: cx88: fix memory leak in cx8802_register_driver() error path
In reply to Sasha LevinFrom: Chen Changcheng <[email protected]>
[ Upstream commit e228b8b1a5b47a72b265671dc6d864c0da5528d0 ]
In cx8802_register_driver(), when drv->probe(driver) fails (non-zero), the allocated cx8802_driver struct is freed neither in the else branch nor later in cx8802_unregister_driver() (which only frees entries that were added to dev->drvlist on success). Each failed probe leaks the driver struct.
Add kfree(driver) in the else branch to fix the leak.
---
LLM Generated explanations, may be completely bogus:
This is a one-line leak fix in a long-standing cx88 error path. Local tree is **7.3.0-rc4** (v7.3-rc4-27-gf0100363d8c37). The buggy code has been in this lineage since 2006, and the patch is self-contained.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[media/cx88] [fix] [free leaked cx8802_driver when drv->probe() fails in cx8802_register_driver()]**
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- **Signed-off-by:** Chen Changcheng <[email protected]> (author)
- **Signed-off-by:** Hans Verkuil <[email protected]> (media maintainer; applied the patch)
- **No Fixes:** tag (expected for this review pipeline)
- **No Cc: [email protected]** (expected; not a negative signal)
- **No Reported-by / Tested-by / Reviewed-by / Acked-by / Link**
- Ignore any pipeline “Upstream commit” / Sasha Levin SOB (none on this commit object itself)
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- **Bug:** In cx8802_register_driver(), kzalloc/kzalloc_obj of a cx8802_driver is not freed when drv->probe(driver) returns non- zero. cx8802_unregister_driver() only kfrees entries that were list_add_tail’d onto dev->drvlist after a successful probe.
- **Symptom:** Each failed probe leaks one cx8802_driver object until reboot (or forever across module reload).
- **Version info:** none in the message. History shows the allocation+else-without-free pattern dates to 2006.
- **Root cause (author):** failed probes never join drvlist, so unregister cannot reclaim them; the else branch must kfree(driver).
Step 1.4: DETECT HIDDEN BUG FIXES
Record: **Not hidden.** Subject and body say “fix memory leak”. The diff is exactly that: add kfree(driver) on the probe-failure path.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- **File:** drivers/media/pci/cx88/cx88-mpeg.c — **+1 / -0**
- **Function:** cx8802_register_driver()
- **Scope:** single-file, single-line, surgical error-path fix
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record: Before (verified at e228b8b1a5b47^):
```
err = drv->probe(driver);
if (err == 0) {
i++;
list_add_tail(&driver->drvlist, &dev->drvlist);
} else {
pr_err("cx8802 probe failed, err = %d\n", err);
}
```After: same, plus kfree(driver) in the else branch. Only the **probe- failure path** changes. Success path, ENOMEM goto out, and unregister of successful entries are unchanged.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: **[Error path / resource leak]** Mechanism: per-device snapshot of struct cx8802_driver is allocated, probe fails, pointer is dropped. Unregister walks dev->drvlist only, so the object is unreachable. Fix:
free it immediately on failure. This is **adding a put/free (leak fix)**, not removing one.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- **Obviously correct:** allocation is kzalloc_obj(*drv) (historically kzalloc(sizeof(*drv), GFP_KERNEL)); matching kfree(driver) on the only path that neither lists it nor returns it.
- **Minimal:** one statement; no unrelated edits.
- **Regression risk: very low.** Probe callbacks (cx8802_dvb_probe, cx8802_blackbird_probe) return errors without stashing drv on a list. kfree under core->lock is safe. No API/locking/refcount changes.
- **No red flags.**
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Loop, alloc, memcpy, probe, else-pr_err introduced by **6c5be74c86f102** (“V4L/DVB (4676): Dynamic cx88 mpeg port management…”, Steven Toth, **2006-12-10**).
- pr_err conversion: 65bc2fe86e6670 (2016).
- Alloc API later became kzalloc_obj via **69050f8d6d075** (Kees Cook, 2026) then **bf4afc53b77ae**.
- The **missing free is original**, not a recent regression. Present since ~v2.6.20-era, so it exists in every current stable series.
Step 3.2: FOLLOW THE FIXES: TAG
Record: **No Fixes: tag.** Introducer is 6c5be74c86f102, confirmed by blame of the alloc/probe/else block. git merge-base --is-ancestor e228b8b1a5b47 HEAD → **IS_ANCESTOR** (commit is in this checkout). No intermediate “same leak” fixes on this file besides this one.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent cx88-mpeg.c commits are PCI_DEVICE macros, kmalloc_obj conversion, IRQ status clear, dma_ API switch — not prerequisites of this kfree. Older related leak: **96df988bb9359** “[media] cx88: Fix possible leak in cx8802_probe()” (different function: PCI probe of the mpeg manager, not this subdriver register path). **Standalone; not part of a series.**
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Chen Changcheng has **only this commit** under drivers/media/pci/cx88/. Applied by **Hans Verkuil**, linux-media maintainer. Subsystem listed as **“Odd fixes”** in MAINTAINERS (CX88 VIDEO4LINUX DRIVER, Mauro Chehab).
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: **None.** The hunk only needs the existing else { pr_err("cx8802 probe failed..."); } block. Allocation style (kzalloc vs kzalloc_obj) is **outside** the hunk, so the one-line add applies on older trees. **Can apply standalone.**
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- **b4 dig -c e228b8b1a5b47…:** https://patch.msgid.link/2026072402521
[email protected]
- **b4 dig -a:** **v1 only** (2026-07-24). Applied 2026-07-28. No v2/v3.
- **b4 dig -m:** thread is **the patch itself only** — no replies, NAKs, or reviewer Cc: stable in the saved mbox.
- Lore HTML via WebFetch: **403 Forbidden** (could not read the web UI). Content recovered from the mbox; it matches the committed message and diff.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): To **[email protected]**, **[email protected]**; Cc **linux-media**, **linux-kernel**. Appropriate lists. No on-list Reviewed-by; **Hans Verkuil committed it** (implicit maintainer acceptance). Kees was CC’d (likely due to recent allocator work); no recorded reply.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: **No Reported-by / Link / syzbot / bugzilla.** Bug is from **code inspection**, not a user crash report. Still a real leak (see Phase 5/8).
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Standalone [PATCH], not n/m. No sibling cx88 leak patches in file history besides the old cx8802_probe() leak.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: WebFetch of https://lore.kernel.org/stable/?q=cx8802_register_driver returned **403**. **UNVERIFIED** whether stable@ already discussed this. Not used to drive the verdict.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: **cx8802_register_driver()** only. (semcode MCP not available; used hunk headers + grep.)
Step 5.2: TRACE CALLERS
Record:
- cx88-dvb.c dvb_init() → cx8802_register_driver(&cx8802_dvb_driver) (module_init)
- cx88-blackbird.c blackbird_init() → cx8802_register_driver(&cx8802_blackbird_driver) (module_init)
- Autoload from PCI probe: cx8802_probe() → request_modules() → request_module("cx88-dvb") / "cx88-blackbird" when board.mpeg has the corresponding bit.
Context: **module init / device probe**, not IRQ/hot path.
Step 5.3: TRACE CALLEES
Record: cx8802_check_driver(), kzalloc_obj, memcpy, mutex_lock(&drv->core->lock), **drv->probe(driver)**, list_add_tail on success, pr_err + (now) kfree on failure.
Probe implementations:
- cx8802_dvb_probe: **returns -ENODEV immediately** if !(core->board.mpeg & CX88_MPEG_DVB); also fails on vp3054_i2c_probe, cx8802_alloc_frontends, vb2_queue_init, dvb_register.
- cx8802_blackbird_probe: same **-ENODEV if not BLACKBIRD**; also cx2341x_handler_init / vb2_queue_init.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Userspace/module load of cx88-dvb or cx88-blackbird (or udev via cx8802_probe) → register walks **cx8802_devlist (every MPEG function-2 device)** → alloc + probe. **Reachable from normal driver load, not an obscure config.** Type-mismatch -ENODEV is a **designed, common** failure: register does not filter by type_id first.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Unregister already kfree(d) after successful remove. Success path is balanced; **only the failure path was missing the free.** No duplicate of this bug in sibling functions beyond the historical cx8802_probe() leak that was already fixed.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: **Yes, in this lineage.** Pre-fix source at e228b8b1a5b47^ still has the else branch **without** kfree. HEAD already contains the fix (e228b8b1a5b47 is an ancestor). Bug introduced **2006** (6c5be74c86f102), long before 7.3. The pr_err else block and leak exist on all current LTS kernels.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply / trivial.** Context line pr_err("cx8802 probe failed, err = %d\n", err); has been stable since 2016. Adjacent kzalloc_obj vs older kzalloc(sizeof(*drv), GFP_KERNEL) is **not in this hunk**.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: This exact kfree **is** already in HEAD. That is the candidate commit, not a different prior fix. No competing rewrite of the error path. (96df988bb9359 is a different leak.)
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: **drivers/media/pci/cx88** — Conexant CX2388x analog/DVB TV capture. **PERIPHERAL** (specific PCI TV cards). Maintainer status:
**Odd fixes**. Still in-tree and used on remaining hardware.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Low churn; mostly treewide/API conversions plus occasional bugfixes. **Mature.** A 20-year leak in a quiet driver is still a leak for those cards.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Driver-specific / config-specific:** CONFIG_VIDEO_CX88 plus VIDEO_CX88_DVB and/or VIDEO_CX88_BLACKBIRD. Not universal. Distros that ship these modules (common in desktop kernels) can hit it on CX88 MPEG hardware.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- **Primary realistic trigger:** subdriver init probes **every** cx8802_dev. A DVB-only card + cx88-blackbird load (or mixed cards in one machine) takes the -ENODEV path **every boot / every module load**.
- **Also:** genuine probe errors (vb2_queue_init, frontend alloc, etc.).
- **Module reload** leaks again (unregister never sees the object).
- Unprivileged users cannot typically trigger it unless they can load modules; **not a UAF/security primitive**, a leak.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: **Memory leak of one struct cx8802_driver (~pointers + enums, small) per failed probe.** Not a panic/UAF. **Severity: MEDIUM** (init/error path, small object, can repeat on reload / multi-device mismatch). Still a real, permanent leak of kernel memory for affected users.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- **Benefit:** stops a real leak on a path that is not purely theoretical (type-mismatch -ENODEV is intentional). Helps CX88 users and anyone who reloads these modules.
- **Risk:** **very low** (1 line, kfree of an unlisted object, maintainer-applied).
- **Ratio:** strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
**FOR backporting:**
- Real leak: alloc without free when probe fails; unregister cannot recover it (verified in both functions).
- Failure path includes **common -ENODEV type mismatch**, not only rare ENOMEM.
- One-line, obviously correct kfree; maintainer (Hans Verkuil) applied it.
- Bug present since 2006 — all stable trees that have cx88 have the bug.
- Applies cleanly; no new API, no locking change, no series dependency.
- Matches the stable “error-path leak / missing kfree” pattern.
**AGAINST:**
- Peripheral old TV capture driver; small object; not a crash/security/data-corruption bug.
- No user/syzbot report; no Fixes/Cc: stable (expected here).
- Not a hot-path unbounded leak unless modules are reloaded or many devices mismatch.
**UNRESOLVED:**
- Lore web UI and stable@ search returned HTTP 403; on-list review comments beyond the patch email could not be read (mbox had no replies).
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — code inspection; applied by media maintainer (no extra Tested-by).
2. Fixes a real bug that affects users? **PASS** — leaked kzalloc on failed/mismatched probe.
3. Important issue? **PASS** (medium: resource leak on driver load; not panic-level, but a genuine leak stable regularly takes).
4. Small and contained? **PASS** — +1 line, one function.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — same else-branch context; no missing helpers.
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Not an exception category** (not a device ID/quirk/DT/build/doc). It is a normal **error-path leak fix**.
Step 9.4: MAKE YOUR DECISION
The leak is real, old, and fixed with a single obviously-correct kfree. Risk is negligible. It belongs in this tree’s stable backports:
CX88 still probes every MPEG device, and failed probes (including designed -ENODEV) drop the allocation on the floor.
**What it solves for stable users:** loading cx88-dvb/cx88-blackbird (or mixed CX88 cards) no longer leaks a cx8802_driver per failed probe, including across module reload.
**Risk vs benefit:** one-line free on an object that is not on any list — benefit clearly wins.
**Concerns:** none for apply/prereqs. Severity is “leak” not “oops”; still within stable practice for missing kfree on error paths.
Verification:
- [Phase 1] Subject/tags: leak fix; SOBs Chen Changcheng + Hans Verkuil; no Fixes/Reported-by/Cc:stable
- [Phase 1] Body matches the mechanism verified in source
- [Phase 2] git show e228b8b1a5b47: +1 line kfree(driver) in else of cx8802_register_driver()
- [Phase 2] git show e228b8b1a5b47^: else branch logs error and does not free
- [Phase 2] cx8802_unregister_driver() only kfrees dev->drvlist entries after successful remove
- [Phase 3] git describe HEAD / make kernelversion:
v7.3-rc4-27-gf0100363d8c37, 7.3.0-rc4
- [Phase 3] git merge-base --is-ancestor e228b8b1a5b47 HEAD:
IS_ANCESTOR
- [Phase 3] git blame: leaky alloc/probe/else from 6c5be74c86f102 (2006-12-10)
- [Phase 3] Author log: only this cx88 commit; file not a series
- [Phase 4] b4 dig -c/-a/-w/-m: lore msgid 20260724025218.32318-1; v1 only; To mchehab+kees; mbox has no replies
- [Phase 4] WebFetch lore.kernel.org: 403 — UNVERIFIED web thread/stable@ discussion
- [Phase 5] grep callers: only cx88-dvb.c and cx88-blackbird.c module_init
- [Phase 5] Read cx8802_dvb_probe / cx8802_blackbird_probe:
-ENODEV if MPEG type bit unset
- [Phase 5] cx8802_probe → request_modules() autoloads matching subdrivers
- [Phase 6] Pre-fix function present; hunk independent of kzalloc_obj (69050f8d6d075)
- [Phase 7] MAINTAINERS: CX88 VIDEO4LINUX DRIVER, Odd fixes, Mauro Chehab
- [Phase 8] Failure mode: kernel memory leak, MEDIUM, driver-specific
- UNVERIFIED: on-list reviewer comments (mbox empty of replies; lore HTTP 403)
- UNVERIFIED: whether stable@ already queued this elsewhere (not used for the verdict)
**YES**
drivers/media/pci/cx88/cx88-mpeg.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/cx88/cx88-mpeg.c +1 -0
@@ -640,6 +640,7 @@ int cx8802_register_driver(struct cx8802_driver *drv)list_add_tail (&driver->drvlist, &dev->drvlist); }else {pr_err ("cx8802 probe failed, err = %d\n" , err); +kfree (driver); }mutex_unlock (&drv->core->lock); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda: Force resume if acomp notified during system suspend
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit c0933934d5d96fc641e8d0025f9099e554a7b47a ]
Currently if an HDMI cable is connected while the system is suspended, the HDMI audio jack status stays off after resume.
This is due to the jack state not being synced by the HDA HDMI codec device's runtime resume, as that never happens if the device was runtime suspended before the system suspended, or by the acomp notification triggered from the DRM side if that happens before the HDA HDMI codec device has resumed.
To fix this, if snd_hda_hdmi_acomp_pin_eld_notify() gets called before the HDA HDMI codec device has resumed, mark it to be forcefully runtime resumed at the next PM complete time.
Do this using a separate acomp_requested_resume flag that can be temporarily set without overwriting forced_resume for drivers that always want to force resume.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.18.y** (v6.18.53). The candidate is a small HDMI jack-sync fix for AMD/Nvidia HDA; the buggy skip-during-suspend path is present at v6.18.53 and the patch applies there cleanly.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [ALSA: hda] [Force] Force a runtime resume if the DRM audio component (acomp) notifies HDMI pin/ELD state during system suspend.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Assisted-by: Copilot:claude-sonnet-4.6 (authoring aid; not a quality verdict)
- Signed-off-by: Nícolas F. R. A. Prado <[email protected]> (author)
- `Link: https://patch.msgid.link/20260626-hda-force-resume-eld-
[email protected]`
- Signed-off-by: Takashi Iwai <[email protected]> (ALSA maintainer applied it)
- Pipeline-added tags ignored: [Upstream commit ...], `Signed-off-by:
Sasha Levin`
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence expected)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** Plug an HDMI cable while the system is suspended; after resume the HDMI audio jack stays off.
- **Symptom:** Userspace sees HDMI audio disconnected until a later unplug/replug or some other codec resume.
- **Root cause:** Two missed sync paths: (1) HDA HDMI runtime resume never runs if the codec was already runtime-suspended before system suspend (direct-complete); (2) DRM pin_eld_notify during that window is dropped because power_state.event == PM_EVENT_SUSPEND.
- **Fix:** Remember the notify and force pm_request_resume() in hda_codec_pm_complete(). Use a dedicated flag so forced_resume is not overwritten for codecs that keep it set (Intel KAE / Realtek).
- **Version info:** None in the message. Author date is 2026-06-26 (after 6.18).
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. It is an explicit functional fix for stale HDMI jack state after suspend.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- include/sound/hda_codec.h: +1 (acomp_requested_resume bitfield)
- sound/hda/codecs/hdmi/hdmi.c: +3/-1 in snd_hda_hdmi_acomp_pin_eld_notify()
- sound/hda/common/codec.c: +4/-1 in hda_codec_pm_complete()
- Scope: 8 insertions, 2 deletions; single-purpose surgical change across HDMI notifier + codec PM
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **hdmi.c:** Previously, acomp notify during system suspend returned immediately (comment: “state will be updated at resume”). After: same early return, but sets codec->acomp_requested_resume = 1.
- **codec.c hda_codec_pm_complete():** Previously requested runtime resume only for jackpoll, hda_codec_need_resume(), or forced_resume. After: also if acomp_requested_resume, then clear the flag.
- Path: system-sleep complete of an already runtime-suspended HDMI codec, after DRM notified during HDA’s PM_EVENT_SUSPEND window.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **Logic / correctness (missed jack sync after suspend/resume).**
- HDMI acomp codecs set relaxed_resume when the DRM notifier is bound (generic_acomp_notifier_set()), so hda_codec_need_resume() is false.
- Direct-complete (hda_codec_pm_prepare/complete, Kai-Heng Feng 2020) keeps a runtime-suspended codec suspended through S3.
- Notify is dropped; resume never runs snd_hda_hdmi_generic_resume() → hdmi_present_sense() / sync_eld_via_acomp().
- Jack kcontrol stays off.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct and minimal. Runtime resume already jacks- syncs all pins (hda_call_codec_resume() → ops->resume → hdmi_present_sense per pin, plus snd_hda_jack_report_sync()), so a boolean “something changed” is enough. Separate flag avoids clobbering forced_resume. Regression risk is low: extra pm_request_resume() only when DRM notified during the suspend window; at worst a short extra wake before runtime suspend. Does not change userspace APIs. Intel’s intel_pin_eld_notify() still skips without this flag (same class of bug, different notifier); that gap does not make this AMD/Nvidia-path fix incorrect.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Skip-during-suspend introduced in ade49db337a9d (“ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI”, Takashi Iwai, 2018; contained in v5.4-rc1).
- hda_codec_pm_complete() forced-resume conditions from 215a22ed31a13 (direct-complete, 2020) and forced_resume from a6e7d0a4bdb02 (2020).
- Buggy combination (drop notify + stay runtime-suspended because of relaxed_resume) has been in the tree for years, including 6.18.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Not applicable. Introducer of the skip is ade49db337a9d; it is in this tree.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent HDMI/codec PM work is unrelated (Lisuan IDs, __force cleanup, power-pm error check). No series (v1-1 standalone). No follow-up on these three files that extends this flag.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Only this HDA commit from Nícolas Prado in this tree. ALSA maintainer Takashi Iwai applied it. Author is a regular kernel contributor (Collabora), not the HDA maintainer; maintainer SOB is the stronger signal.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Uses existing forced_resume / hda_codec_pm_complete() / snd_hda_hdmi_acomp_pin_eld_notify(). All present at v6.18.53. Standalone. File layout sound/hda/codecs/hdmi/hdmi.c exists in 6.18 (6014e9021b28e reorg is already in this tree).
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c c0933934d5d96… → https://patch.msgid.link/20260626-hda-
[email protected]
- b4 dig -a: **v1 only**, no later revisions.
- Thread (mbox): submission + Takashi Iwai “Applied to for-next branch now. Thanks.” No NAKs, no requested changes, no reviewer Cc: stable.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To Jaroslav Kysela, Takashi Iwai; Cc linux- sound, linux-kernel, Collabora. Maintainer applied v1 as-is.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by / bugzilla / syzbot. Description is a concrete user-visible HDMI jack failure. Severity from the author: HDMI audio jack stays off after a plug-during-S3. User count unverified beyond the author.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone v1. Intel intel_pin_eld_notify() still has the old skip; no sibling Intel patch in this tree.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search returned 403; web search did not find a stable-list thread for this subject. UNVERIFIED whether anyone already nominated or rejected it for stable. That absence is not used as a NO.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: snd_hda_hdmi_acomp_pin_eld_notify(),hda_codec_pm_complete(). Struct fieldhda_codec.acomp_requested_resume.
**Step 5.2: TRACE CALLERS**
Record:
- snd_hda_hdmi_acomp_pin_eld_notify is the .pin_eld_notify op for AMD (atihdmi.c) and Nvidia (nvhdmi.c). DRM calls it via amdgpu_dm_audio_eld_notify(), radeon_audio, nouveau dispnv50. Typical context: display modeset / connector ELD change (hotplug or resume modeset), not a syscall on the ALSA side.
- hda_codec_pm_complete is .complete in hda_codec_driver_pm (system sleep complete for every HDA codec).
- Intel uses a separate intel_pin_eld_notify() and is **not** covered.
**Step 5.3: TRACE CALLEES**
Record: Notify still returns during suspend (no verbs). Complete path calls existing pm_request_resume(). Runtime resume → hda_call_codec_resume() → HDMI snd_hda_hdmi_generic_resume() → hdmi_present_sense() (sync_eld_via_acomp when acomp is bound).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable without privilege: physical HDMI/DP plug while the machine is suspended, then resume. Common laptop/dock path. Not a fuzzer/syscall crash path.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same skip remains in sound/hda/codecs/hdmi/intelhdmi.c intel_pin_eld_notify(). Same forced_resume pattern already used for jack/KAE. This patch copies that idea for acomp.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** git describe HEAD / make kernelversion → **6.18.53**. At v6.18.53:
- snd_hda_hdmi_acomp_pin_eld_notify() still returns on PM_EVENT_SUSPEND with no flag.
- hda_codec_pm_complete() has no acomp_requested_resume.
- hda_codec has forced_resume but not the new bit.
Bug introduced ~2018/2020; present in 6.18. Upstream SHA c0933934d5d96 is **not** an ancestor of v6.18.53.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** git diff v6.18.53 6a484c2d8404d on the three files is exactly this patch. Context lines match.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No other 6.18 fix for “acomp notify during suspend” / this jack- stays-off sequence. Intel skip is still unfixed; not a substitute.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: ALSA HD-audio HDMI (AMD/Nvidia acomp). **IMPORTANT** (common dGPU/APU HDMI audio), not core mm/vfs. Affects AMD/Nvidia HDMI jack kcontrols/PCM availability after S3.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Active (quirks, HDMI, PM). The skip itself has been stable since 2018; this is a late correctness fix, not churn for new infrastructure.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific: AMD ATI HDMI (atihdmi) and Nvidia HDMI (nvhdmi) with DRM audio-component binding. Intel HDMI notifier is unchanged.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: HDMI/DP cable (or dock) attached while the system is in S3, then resume, **and** the HDMI codec was runtime-suspended before suspend (normal with relaxed_resume). Unprivileged physical hotplug; not a syscall exploit. Timing: DRM notify before HDA complete().
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: HDMI audio jack stays reported off; HDMI PCM/jack userspace does not see the display. No oops, deadlock, or filesystem corruption. **MEDIUM** functional suspend/resume bug (audio device missing until another resume/replug).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** High for AMD/Nvidia HDMI users who dock/plug during suspend (common). Jack state is restored via the existing resume path.
- **Risk:** Very low (8 lines, existing PM helper, 1-bit flag still inside the same unsigned int bitfield group of 26 bits). Possible extra runtime resume if DRM notifies on every GPU resume while HDA is still PM_EVENT_SUSPEND; that is transient power, not a functional break.
- **Ratio:** Benefit outweighs risk for 6.18.y.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real user-visible bug: HDMI audio jack stays off after plug-during- suspend.
- Mechanism verified in 6.18 code: skip notify + relaxed_resume + direct-complete.
- Tiny, obviously correct, maintainer-applied v1 with no NAKs.
- Applies cleanly to this tree; all helpers exist.
- Existing resume path already resyncs ELD/jacks; this only ensures that path runs.
- Same class of PM/jack workaround already used (forced_resume).
AGAINST:
- Not a crash, UAF, or security issue.
- No independent Reported-by / Tested-by.
- Intel HDMI notifier still has the skip (incomplete coverage, not a regression of this patch).
- Possible extra runtime resume after S3 if DRM notifies during the HDA suspend window.
UNRESOLVED:
- Could not fetch lore.kernel.org/stable (403); no verified stable-list discussion.
- Could not quantify how often AMD/Nvidia DRM notifies during HDA’s suspend window on every resume vs only on true hotplug.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — logic matches the resume path; maintainer applied v1. No extra Tested-by, but the change is reviewable from the code.
2. Fixes a real bug that affects users? **PASS** — stale HDMI jack after a common plug-during-S3.
3. Important issue? **PASS** — not panic/corruption, but a suspend/resume hardware-functional bug that leaves HDMI audio unavailable; this class is routinely taken in stable.
4. Small and contained? **PASS** — 8 insertions / 2 deletions, three files, one flag.
5. No new features or APIs? **PASS** — internal bitfield; no UAPI.
6. Can apply to the local tree? **PASS** — identical context at v6.18.53.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. It is a normal small functional PM/jack fix.
**Step 9.4: MAKE YOUR DECISION**
This should be backported to this 6.18.y tree. The buggy skip and complete-path exist here, the fix is surgical, and the user impact (HDMI audio missing after docking/plugging in suspend) is real.
### What the commit solves and why it matters here
On 6.18, AMD/Nvidia HDMI codecs using acomp set relaxed_resume and can stay runtime-suspended across system sleep. DRM may notify pin/ELD while the codec is still PM_EVENT_SUSPEND; that notify is dropped, and hda_codec_pm_complete() does not wake the codec. HDMI jack kcontrols stay off after resume. Forcing a one-shot runtime resume when such a notify arrived restores the existing ELD/jack sync in hda_call_codec_resume().
### Stable rules / risk vs benefit
Meets the stable bar: real bug, small, no new API, clean apply, low regression risk. Benefit is restoring HDMI audio after a common suspend hotplug; risk is an extra runtime resume in that window.
### Concerns
Intel HDMI still skips notify during suspend (separate function). No Fixes:/Cc: stable (expected). No third-party test tag. Neither is a reason to withhold this AMD/Nvidia-path fix from 6.18.y.
Verification:
- [Phase 1] Parsed tags: author SOB, Takashi Iwai SOB, msgid Link; no Fixes/Reported-by/Cc:stable
- [Phase 1] Body: HDMI jack stays off after plug-during-suspend; skipped acomp notify + no runtime resume
- [Phase 2] Diff: +1 bitfield, set flag in snd_hda_hdmi_acomp_pin_eld_notify, test/clear in hda_codec_pm_complete (8+/2-)
- [Phase 2] hda_codec_need_resume() is !relaxed_resume && jacktbl.used; acomp sets relaxed_resume
- [Phase 3] blame: skip from ade49db337a9d (v5.4-rc1); complete path from 215a22ed31a13 (2020)
- [Phase 3] git merge-base --is-ancestor c0933934d5d96 HEAD → not in v6.18.53; buggy code is
- [Phase 3] No series/prereqs; files exist at 6.18 paths
- [Phase 4] b4 dig -c: lore msgid; b4 dig -a: v1 only; mbox: Takashi “Applied to for-next”; no NAK
- [Phase 4] b4 dig -w: To Iwai/Kysela, Cc linux-sound
- [Phase 4] UNVERIFIED: stable@ discussion (lore 403)
- [Phase 5] Callers: atihdmi/nvhdmi ops; DRM amdgpu/radeon/nouveau pin_eld_notify; Intel uses different function
- [Phase 5] Resume callee chain verified: hda_codec_runtime_resume → hda_call_codec_resume → HDMI generic_resume → hdmi_present_sense
- [Phase 6] git describe HEAD / Makefile: 6.18.53; git show v6.18.53:... has pre-fix code; diff vs candidate is this patch only
- [Phase 7] ALSA HDA HDMI, important, AMD/Nvidia
- [Phase 8] Trigger: HDMI plug in S3 then resume; failure: jack stays off; severity MEDIUM; risk very low
- UNVERIFIED: how often DRM notifies on every GPU resume vs only hotplug; Intel still buggy (out of scope of this commit)
**YES**
include/sound/hda_codec.h | 1 + sound/hda/codecs/hdmi/hdmi.c | 4 +++- sound/hda/common/codec.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-)
include/sound/hda_codec.h +1 -0
@@ -257,6 +257,7 @@ struct hda_codec { unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ unsigned int forced_resume:1; /* forced resume for jack */ + unsigned int acomp_requested_resume:1; /* resume requested by acomp */ unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */ unsigned int ctl_dev_id:1; /* old control element id build behaviour */ unsigned int eld_jack_detect:1; /* Machine jack-detection by ELD */
sound/hda/codecs/hdmi/hdmi.c +3 -1
@@ -2236,8 +2236,10 @@ void snd_hda_hdmi_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id)/* skip notification during system suspend (but not in runtime PM); * the state will be updated at resume */ -if (codec->core.dev.power.power_state.event ==PM_EVENT_SUSPEND ) +if (codec->core.dev.power.power_state.event ==PM_EVENT_SUSPEND ) { + codec->acomp_requested_resume =1 ;return ; + }snd_hda_hdmi_check_presence_and_report (codec, pin_nid, dev_id); }
sound/hda/common/codec.c +4 -1
@@ -2949,8 +2949,11 @@ static void hda_codec_pm_complete(struct device *dev) dev->power.power_state =PMSG_RESUME ;if (pm_runtime_suspended (dev) && (codec->jackpoll_interval || -hda_codec_need_resume (codec) || codec->forced_resume)) +hda_codec_need_resume (codec) || codec->forced_resume || + codec->acomp_requested_resume)) { + codec->acomp_requested_resume =0 ;pm_request_resume (dev); + } }static int hda_codec_pm_suspend (struct device *dev)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net/rds: fix rds_message leak in the rds_send_xmit() drop path
In reply to Sasha LevinFrom: Sharath Srinivasan <[email protected]>
[ Upstream commit eb8a59a17f4a8b6f2afb4a8063e99dd96cc3fab0 ]
When rds_send_xmit() picks the next message off cp_send_queue it takes its own reference with rds_message_addref(). If the message then hits the never-retransmit check (RDS_MSG_FLUSH, or an RDMA op that was already retransmitted), it is moved to the local to_be_dropped list and that reference is dropped after the batch.
However, if RDS_MSG_ON_CONN has already been cleared, the message is not added to to_be_dropped and the reference taken above is never
dropped: cp_xmit_rm has not been set at this point, so the loop simply abandons rm and the rds_message (and everything it pins: pages, MRs, notifiers) leaks after an RDMA error.
The only other places that clear RDS_MSG_ON_CONN are rds_send_path_drop_acked() and rds_send_drop_to(), and both can run while rds_send_xmit() has dropped cp_lock between moving the message to cp_retrans and re-taking the lock in the never-retransmit check:rds_send_path_drop_acked() can ack away a message that already sat on cp_retrans - the RDS_MSG_RETRANSMITTED case above - and rds_send_drop_to() runs on socket close. Both unlink the message under cp_lock and put their own reference, leaving the xmit-path reference stranded.
Drop the reference directly in that case.
This mirrors Oracle UEK commit "net/rds: fix rds_message memleak in rds_send_xmit".
---
LLM Generated explanations, may be completely bogus:
This is a real, long-standing rds_message leak in rds_send_xmit() that exists in this 5.10.270 tree. The fix is small, matches the local code, and does not need the rest of its series.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[net/rds] [fix] [rds_message leak in rds_send_xmit() drop path]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
From the candidate message:
- Signed-off-by: Gerd Rausch <[email protected]> (original author)
- Signed-off-by: Sharath Srinivasan <[email protected]> (UEK/port author)
- [achender: port to net-next; update commit message, checkpatch nits]
- Signed-off-by: Allison Henderson <[email protected]> (RDS maintainer-side porter)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Jakub Kicinski <[email protected]> (netdev merge)
No Reported-by, Tested-by, Reviewed-by, or Acked-by in the candidate text. Absence of Fixes: / Cc: stable is expected here.
Mailing-list v4 (same msgid) **did** carry:
- Fixes: 2ad8099b58f2 ("RDS: rds_send_xmit() locking/irq fixes")
Oracle UEK source (94549e4732d8) carried:
- Fixes: fbbe0610d057 ("RDS: add support for atomic messages over the wire") — that SHA is **not** in this tree
- Reviewed-by: William Kucharski <[email protected]>
- Orabug: 38923495 (internal production bug)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** rds_send_xmit() takes an extra rds_message_addref() when dequeuing. On the never-retransmit path (RDS_MSG_FLUSH or already- retransmitted RDMA), that ref is only dropped if the message is moved onto to_be_dropped. If RDS_MSG_ON_CONN was already cleared, the extra ref is abandoned.
- **Symptom:** leak of rds_message plus pinned pages, MRs, and notifiers after an RDMA error / reconnect / socket close.
- **Root cause:** rds_send_path_drop_acked() (ACK of a message already on cp_retrans) and rds_send_drop_to() (socket close) can clear RDS_MSG_ON_CONN and put **their** refs in the window where xmit has dropped cp_lock. They do not put the xmit-path extra ref. cp_xmit_rm is not set yet, so the success-path put never runs.
- **Version info:** bug traces to 2010 locking change; present in this 5.10 tree.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not hidden.** Subject and body are an explicit leak/refcount fix.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: net/rds/send.c only (~+12/−3 in rds_send_xmit())
- Scope: **single-file surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** test_and_clear_bit(RDS_MSG_ON_CONN) → if set, list_move to to_be_dropped; always unlock; continue. If the bit was already clear, no put.
- **After:** same if the bit is set; **else** unlock then rds_message_put(rm) for the extra xmit ref.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **Reference-counting / resource leak.** Extra rds_message_addref() at dequeue (local tree net/rds/send.c:265) is not balanced when RDS_MSG_ON_CONN is already clear. Verified in this
tree: only rds_send_path_drop_acked() (clear_bit at line 707) and rds_send_drop_to() (test_and_clear_bit at line 774) plus this drop path itself clear that bit. rds_send_path_reset() does **not** (v4 commit message correction vs v1–v3).
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Obviously correct.** Queueing takes a conn-list ref (rds_send_queue_rm addref + RDS_MSG_ON_CONN). Xmit takes a second ref. Concurrent drop/ack puts the conn-list ref. Xmit must put its own.
- rds_send_remove_from_sock() documents that it puts the list-position ref; drop_acked uses that. Xmit’s extra ref is separate.
- After continue, the next loop iteration does rm = cp->cp_xmit_rm (still NULL), so the local pointer is not used after put.
- Put happens after spin_unlock_irqrestore, same as the existing success-path put at line 423. The “irqs on here, so we can put()” comment is about not putting **under** cp_lock.
- **Regression risk: low.** Does not change locking order or APIs. Follow-up reinitialize to_be_dropped on restart is documented hardening with **no known user-visible bug**; this else-path does not even enqueue on to_be_dropped.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Drop-path structure from 5c11559046c4b3 (“RDS: send.c”, 2009).
- Leak introduced by 2ad8099b58f27 (“RDS: rds_send_xmit() locking/irq fixes”, 2010): that commit **removed** an unconditional rds_message_put(rm) on this path and only put messages that made it onto to_be_dropped.
- FLUSH clause: 905dd4184e0732 (2016). Multipath cp_ conversion:
1f9ecd7eacfd9e (2016).
- Buggy pattern has been in-tree for ~16 years; first appeared long before 5.10.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record:
- Mailing-list Fixes: 2ad8099b58f2 — **is an ancestor of this HEAD** (git merge-base --is-ancestor exit 0).
- git show 2ad8099b58f27 confirms the put was moved to the batch-end to_be_dropped walk only.
- UEK Fixes: fbbe0610d057 is **not** in this tree (exit 128); that tag is a red herring for 5.10. The real introducer here is 2ad8099b58f2.
**Step 3.3: CHECK FILE HISTORY**
Record: Recent net/rds/send.c work in this tree is locking/xmit serialization (acquire_in_xmit, shutdown races), not this drop path. No prior fix for this leak (rg for “already off the conn list” is empty). **Standalone**, not a refactor prerequisite.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Gerd Rausch / Sharath Srinivasan / Allison Henderson are established RDS contributors. Henderson has many RDS stable backports in this tree. This is a UEK→upstream port of a production Orabug.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: v4 series is four **independent** bugs (sleep-in-atomic unpin, MR socket UAF, **this leak**, IB MR pin leak). This hunk only needs existing rds_message_put() / RDS_MSG_ON_CONN / to_be_dropped, all present. **Applies standalone.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c on the candidate SHA was not possible (commit is not in this checkout). b4 dig -c 5c11559046c4b3 only found the 2009 original.
- lore.kernel.org fetches returned **403**. Used openwall mirrors.
- Thread: https://lists.openwall.net/netdev/2026/07/30/65 (v4 3/4), cover https://lists.openwall.net/netdev/2026/07/30/62
- Revisions: v1 (2026-07-11) → v3 → v4 (2026-07-30). **Code of this patch unchanged after v3**; v4 only corrected the commit message to name drop_acked/drop_to instead of rds_send_path_reset().
- Merged by Jakub Kicinski. No NAK found.
- v1–v3 incorrectly named rds_send_path_reset() as a clearer of RDS_MSG_ON_CONN; verified **false** in this tree (rds_send_path_reset only sets RDS_MSG_RETRANSMITTED and splices queues).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: Sent to netdev, linux-rdma, Kicinski, Dumazet, Abeni, Horms. RDS lists historically include [email protected]. No extra Reviewed-by on the upstream version; UEK had William Kucharski. Maintainer-side porter is Allison Henderson.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: Oracle UEK Orabug 38923495; no public syzbot/bugzilla report found. Production bug inside Oracle RDS, not theoretical.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Independent of series 1/4, 2/4, 4/4. Later “reinitialize to_be_dropped on restart” is **hardening only** (“no user-visible bug is known”).
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search **403**; web search found **no** stable-list discussion of this leak. UNVERIFIED whether anyone already requested/rejected it for 5.10.y.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
semcode MCP is **not** available; used read/grep.
**Step 5.1: KEY FUNCTIONS**
Record: rds_send_xmit() only.
**Step 5.2: TRACE CALLERS**
Record (this tree):
- rds_sendmsg() → rds_send_xmit() (send.c:1385) — syscall
- rds_send_worker() (threads.c:200) — rds_wq work
- rds_ib_tasklet_fn_send() (ib_cm.c:334) — IB send tasklet
**Step 5.3: TRACE CALLEES**
Record: rds_message_addref / rds_message_put (message.c); last put runs rds_message_purge() (pages, rds_rdma_free_op, MR krefs).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: **Userspace-reachable** via RDS sendmsg. Also on IB completion and reconnect. Race: xmit drops cp_lock after moving to cp_retrans; recv/ACK path (rds_send_path_drop_acked) or close/RDS_CANCEL_SENT_TO (rds_send_drop_to) can run then.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same file already balances other refs carefully (drop_to skips if ON_CONN already clear). This path is the missing counterpart. No duplicate of this exact leak elsewhere in net/rds/.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** pending-5.10, make kernelversion = **5.10.270**, git describe = p-5.10-1-gce56b7a73b64b.
```287:294:net/rds/send.c
if (test_bit(RDS_MSG_FLUSH, &rm->m_flags) ||
(rm->rdma.op_active &&
test_bit(RDS_MSG_RETRANSMITTED,
&rm->m_flags))) {
spin_lock_irqsave(&cp->cp_lock, flags);
if (test_and_clear_bit(RDS_MSG_ON_CONN,
&rm->m_flags))
list_move(&rm->m_conn_item,
&to_be_dropped);
spin_unlock_irqrestore(&cp->cp_lock,
flags);
continue;
}
```Introduced in 2010 (2ad8099b58f2); present for the entire 5.10 lifetime.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** (trivial fuzz at most). Local drop-path text matches the hunk exactly. Nearby comment still has the old “We cold possibly” typo; that line is context only.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: Fix **not** present. No other send.c commit in this tree plugs this hole.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: **net/rds** — Reliable Datagram Sockets (Oracle RAC / InfiniBand and TCP). MAINTAINERS: Supported (Santosh Shilimkar / Oracle). **IMPORTANT** (not core mm/VFS; not staging). CONFIG_RDS depends on INET; RDMA ops need CONFIG_RDS_RDMA.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: Actively maintained in this 5.10 tree (recent shutdown/xmit locking, TCP corruption, NULL-deref fixes). Mature send path; this leak is old, not a new-feature bug.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: **Config/driver-specific** — CONFIG_RDS users, especially RDMA/IB reconnect and TCP peer-generation flush (RDS_MSG_FLUSH in recv.c). Enterprise RDS/RAC deployments.
**Step 8.2: TRIGGER CONDITIONS**
Record:
1. Xmit dequeues a message (addref, move to cp_retrans, drop cp_lock).
2. Never-retransmit: RDS_MSG_FLUSH (peer gen change) or RDMA + RDS_MSG_RETRANSMITTED (after rds_send_path_reset).
3. Concurrent ACK (drop_acked) or socket close (drop_to) already cleared ON_CONN.
Not every packet; **error/reconnect/close**. Unprivileged RDS sockets can drive send/close; RDMA/reconnect is the realistic production case (Orabug).
**Step 8.3: FAILURE MODE SEVERITY**
Record: **Memory/resource leak** of message, pages, MRs, notifiers. Not a panic. Repeated reconnects accumulate pinned memory → **HIGH** for RDS users, not a universal crash.
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** high for RDS/RDMA users; stops leaking pinned pages/MRs after errors that already happen in production.
- **Risk:** very low (~12 lines, one else-put, same pattern as existing puts).
- **Ratio:** favor backport.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real refcount leak; objects pin pages/MRs/notifiers
- Present in this 5.10 tree since 2010 (2ad8099b58f2)
- Small, obviously correct, one function
- Clean apply; no prerequisites
- RDS maintainer port; netdev merge; Oracle production Orabug
- Userspace-reachable via RDS send + close/reconnect
**AGAINST:**
- RDS is not universal
- Error-path race, not every send
- Not a crash/CVE
- No public syzbot report
**UNRESOLVED:**
- Stable-list history (lore 403)
- Whether last-ref rds_message_put() from IB **tasklet** can sleep via unpin_user_pages_dirty_lock() — **already true** for the success- path and to_be_dropped puts in this tree; this patch does not create that class of bug (series 1/4 is a separate sleep-in-atomic fix)
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — refcount math checks out; UEK + netdev merge
2. Real bug affecting users? **PASS** — Orabug 38923495; leak is in this tree
3. Important (crash/security/corruption/deadlock)? **PASS** — leak of pinned pages/MRs after RDMA error/reconnect; severity HIGH for RDS
4. Small and contained? **PASS** — ~12 lines, one file
5. No new features/APIs? **PASS**
6. Can apply to this tree? **PASS**
**Step 9.3: EXCEPTION CATEGORIES**
Record: None (not an ID/quirk/DT/build/docs exception). Qualifies as a normal leak/refcount fix.
**Step 9.4: DECISION**
Backport to **this** 5.10.270 tree. The buggy code is here, the fix is surgical, and there is no missing prerequisite.
What it fixes for 5.10 users: after RDMA QP error / reconnect (RDS_MSG_RETRANSMITTED) or peer generation flush (RDS_MSG_FLUSH), racing ACK or socket close can clear RDS_MSG_ON_CONN in the xmit lock gap. The extra rds_message_addref() is then never dropped, leaking the message and everything it pins. Adding rds_message_put(rm) in that else branch restores the balance 2ad8099b58f2 broke.
---
## Verification
- **[Phase 1]** Tags: SOBs Rausch/Srinivasan/Henderson/Kicinski; Link msgid 3512480-4; ML Fixes: 2ad8099b58f2; UEK Orabug 38923495
- **[Phase 2]** Diff: else-branch rds_message_put(rm) in rds_send_xmit() never-retransmit path
- **[Phase 2]** Confirmed rds_send_remove_from_sock() puts the conn- list ref; xmit extra ref is separate (send.c:605-674)
- **[Phase 2]** Confirmed only drop_acked (707) and drop_to (774) plus this path clear RDS_MSG_ON_CONN
- **[Phase 3]** git blame: leak from 2ad8099b58f27 (2010), which removed unconditional put
- **[Phase 3]** git merge-base --is-ancestor 2ad8099b58f2 HEAD → yes; fbbe0610d057 → no
- **[Phase 3]** git show 2ad8099b58f27: put moved to to_be_dropped only
- **[Phase 4]** openwall v4 0/4 and 3/4; v4 commit-message correction; Kicinski merge
- **[Phase 4]** Follow-up to_be_dropped reinit is hardening only, not required
- **[Phase 4]** UNVERIFIED: lore.kernel.org 403; b4 dig could not target the 2026 SHA (not in this tree)
- **[Phase 5]** Callers: sendmsg, rds_send_worker, rds_ib_tasklet_fn_send
- **[Phase 5]** No semcode MCP
- **[Phase 6]** git describe HEAD = p-5.10-1-gce56b7a73b64b; make kernelversion = 5.10.270
- **[Phase 6]** Buggy hunk present at send.c:287-294; fix text absent
- **[Phase 8]** Failure mode: leak of message + pages + MRs; HIGH for RDS, not a panic
- **UNVERIFIED:** stable@ discussion of this specific backport
**YES**
net/rds/send.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
net/rds/send.c +15 -3
@@ -288,9 +288,21 @@ int rds_send_xmit(struct rds_conn_path *cp) (rm->rdma.op_active && test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags))) {spin_lock_irqsave (&cp->cp_lock, flags); -if (test_and_clear_bit (RDS_MSG_ON_CONN , &rm->m_flags)) -list_move (&rm->m_conn_item, &to_be_dropped); -spin_unlock_irqrestore (&cp->cp_lock, flags); +if (test_and_clear_bit (RDS_MSG_ON_CONN , + &rm->m_flags)) { +/* our ref is put after the batch */ +list_move (&rm->m_conn_item, + &to_be_dropped); +spin_unlock_irqrestore (&cp->cp_lock, + flags); + }else { +/* already off the conn list; drop +* the ref taken above ourselves +*/ +spin_unlock_irqrestore (&cp->cp_lock, + flags); +rds_message_put (rm); + }continue ; }
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] net/rds: fix rds_message leak in the rds_send_xmit() drop path
Sashiko has reviewed this patch and found no issues.
Quoted 15 lines
From: Sharath Srinivasan <[email protected]>
[ Upstream commit
eb8a59a17f4a8b6f2afb4a8063e99dd96cc3fab0]When
rds_send_xmit()picks the next message offcp_send_queueit takes its own reference withrds_message_addref(). If the message then hits the never-retransmit check (RDS_MSG_FLUSH, or an RDMA op that was already retransmitted), it is moved to the localto_be_droppedlist and that reference is dropped after the batch.However, if
RDS_MSG_ON_CONNhas already been cleared, the message is not added toto_be_droppedand the reference taken above is never
dropped:cp_xmit_rmhas not been set at this point, so the loop simply abandons rm and therds_message(and everything it pins: pages, MRs, notifiers) leaks after an RDMA error.
Quoted 6 lines
[ ... ][achender: port to net-next; update commit message, checkpatch nits]Signed-off-by Allison Henderson <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 mmc: sdhci-of-ma35d1: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 9b3732cce41d177acac731e0b8024d72f0dfde38 ]
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading.
---
LLM Generated explanations, may be completely bogus:
# Stable backport analysis: mmc: sdhci-of-ma35d1: add missing MODULE_DEVICE_TABLE()
Local tree: **v7.3-rc4** (7.3.0-rc4, VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4).
Candidate: 9b3732cce41d177acac731e0b8024d72f0dfde38.
The driver and the missing-alias bug exist in this tree; the one-line fix is already present here as a mainline commit.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[mmc / sdhci-of-ma35d1] [add] [export OF match table via MODULE_DEVICE_TABLE so the module can autoload]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Fixes:** none (expected)
- **Reported-by / Tested-by / Reviewed-by / Acked-by:** none
- **Link:** none in the committed message
- **Cc: stable:** none (expected)
- **Signed-off-by:** Pengpeng Hou (author); Ulf Hansson (MMC maintainer, applied it)
- Ignore any pipeline SOBs
Notable: maintainer SOB; no user report; no syzbot.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** OF match table is wired to .of_match_table but not exported with MODULE_DEVICE_TABLE(of, ...).
- **Symptom:** depmod/modinfo get no of: aliases, so udev/kmod will not autoload sdhci-ma35 when DT has compatible = "nuvoton,ma35d1-sdhci". Built-in (=y) matching still works.
- **Version info:** none in the message. Driver introduced in v6.12-rc1.
- **Root cause:** missing MODULE_DEVICE_TABLE so file2alias.c never publishes the table.
Original mailing-list body (stripped before commit) said this is a source-level fix with no hardware reproduction; evidence is the table itself.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not hidden.** It is an explicit autoload/alias fix. Same class as “add a device ID”: the ID exists; userspace was never told.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/mmc/host/sdhci-of-ma35d1.c — **+1 / −0**
- Function: none; one statement after sdhci_ma35_dt_ids[]
- Scope: **single-file, one-line surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** sdhci_ma35_dt_ids is only used as .of_match_table (in- kernel match when the module is already loaded or built-in).
- **After:** same, plus MODULE_DEVICE_TABLE(of, sdhci_ma35_dt_ids) so modpost emits MODULE_ALIAS("of:N*T*Cnuvoton,ma35d1-sdhci").
- Path: **module build / autoload**, not probe/error/init runtime logic.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[Hardware enablement / missing module alias]** — category **(h) plus logic for autoload**. Not UAF, leak, race, or crash. Without the macro, a modular build never gets OF aliases. Confirmed by include/linux/module.h: MODULE_DEVICE_TABLE creates a used alias so scripts/mod/file2alias.c can find the table.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** obviously correct; this is the documented way to export OF IDs.
- **Regression risk:** negligible. Macro only adds a static alias symbol; no locking, no API, no runtime path change except autoload starts working.
- **Red flags:** none on the diff. Author is doing a wide MODULE_DEVICE_TABLE sweep (rtc, vdpa, gpio, iio, …); that does not make *this* line wrong. MMC maintainer applied it after trimming the disclaimer.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Table and driver: addc9ecb9ddb3 (“Add Nuvoton MA35D1 SDHCI driver”), Shan-Chun Hung, 2024-07-16, committed 2024-08-26.
- First appeared: **v6.12-rc1** (git describe --contains addc9ecb9ddb3 → v6.12-rc1~158^2~42).
- Original driver had the match table and .of_match_table and **no** MODULE_DEVICE_TABLE from day one.
- Bug age: ~v6.12 through this July 2026 fix.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Buggy commit is the original driver add, verified by blame and by git show addc9ecb9ddb3 (tail of the file has the table without the macro). That commit **is** an ancestor of this tree.
**Step 3.3: CHECK FILE HISTORY**
Record (this file only):
- addc9ecb9ddb3 — add driver
- 078e548af9c3a — remove_new → remove
- 01bc623f9a5c2 — drop sdhci_pltfm_free()
- 995832b2cebe6 — include-header churn
- 9b3732cce41d1 — this fix
No prerequisite refactor for this one line. **Standalone.**
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Pengpeng Hou is not the MMC maintainer; many similar “add missing MODULE_DEVICE_TABLE()” commits across subsystems. Ulf Hansson applied this one. Related MMC precedent by others: 6e540da4c1db7 (“mmc: sdhci-of-aspeed: fix module autoloading”) is the same one-line change **and had Fixes: + Cc: [email protected]**.
**Step 3.5: DEPENDENT/PREREQUISITE COMMITS**
Record: **None.** Only needs sdhci_ma35_dt_ids and module.h (already included). Can apply standalone on any tree that has this driver.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 9b3732cce41d1 →
https://patch.msgid.link/[email protected]
- b4 dig -a: **v1 only** (2026-07-04). Applied version is that v1 (commit message cleaned).
- Thread (mbox): Ulf Hansson, 2026-07-06: **“Applied for next (by cleanup of the commit message a bit), thanks!”**
- No NAK, no reviewer-requested Cc: stable, no risk discussion.
- lore.kernel.org HTTP fetch returned 403 (Anubis); thread recovered via b4 dig -m.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc included Ulf Hansson (MMC), Adrian Hunter (SDHCI), Nuvoton (Jacky Huang, Shan-Chun Hung), linux-mmc, linux-arm- kernel. Right people. Only maintainer reply was “applied”.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: **No user/syzbot/bugzilla report.** Author stated it was inferred from source. The failure mode is still deterministic for =m builds.
**Step 4.4: RELATED PATCHES AND SERIES**
Record: **Standalone 1/1.** Same-week author activity is a tree-wide missing-alias sweep, not a multi-patch MMC series.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: **UNVERIFIED** via lore.kernel.org/stable (Anubis 403). No `Cc:
stable on this patch. Closest analogue in-tree (sdhci-of-aspeed` autoload) *was* explicitly nominated for stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
Record: **No function body changed.** Touches sdhci_ma35_dt_ids and the sdhci_ma35_driver registration site.
**Step 5.2: TRACE CALLERS**
Record:
- .probe = ma35_probe — driver-core platform probe.
- .of_match_table = sdhci_ma35_dt_ids — OF matching when the driver is present.
- MODULE_DEVICE_TABLE is not a runtime caller; it feeds **modpost**.
- Impact surface: modular CONFIG_MMC_SDHCI_OF_MA35D1=m on nuvoton,ma35d1-sdhci DT.
**Step 5.3: TRACE CALLEES**
Record: Unchanged. ma35_probe still does sdhci_pltfm_init / host setup. Macro expands to a static alias (verified in include/linux/module.h).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: DT node compatible = "nuvoton,ma35d1-sdhci" → kmod alias lookup → load sdhci-ma35 → ma35_probe. Reachable on MA35D1 boot if the driver is a module. Not a syscall/UAF path. **Userspace-visible:** missing MMC/SD host until manual modprobe.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Other sdhci-of-*.c drivers already have MODULE_DEVICE_TABLE(of, ...). Historical MMC autoload fixes: aspeed, am654, at91, mediatek. This driver was the outlier.
Kconfig: MMC_SDHCI_OF_MA35D1 is **tristate** (depends on ARCH_MA35 || COMPILE_TEST), so =m is a supported config. Help text: “say Y or M here.”
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** File exists; table and .of_match_table exist; the missing alias was the original 6.12 code. This checkout already contains the fix line at drivers/mmc/host/sdhci-of-ma35d1.c:293. git merge- base --is-ancestor addc9ecb9ddb3 HEAD and 9b3732cce41d1 HEAD both succeed. Bug introduced **v6.12**, not after this tree.
**Step 6.2: BACKPORT COMPLICATIONS**
Record: **Clean apply.** One added line next to a table that has been there since the driver was added. Later churn (remove, sdhci_pltfm_free, includes) does not conflict with this hunk.
**Step 6.3: RELATED FIXES ALREADY HERE**
Record: This *is* the fix. No earlier equivalent. Sibling OF SDHCI drivers already export their tables.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: **MMC host / SDHCI platform driver.** Criticality:
**PERIPHERAL** (Nuvoton MA35D1 only), but it is the SD/MMC host for that SoC — root-on-SD/eMMC is a realistic layout.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: drivers/mmc/host/ is active (many recent fixes). This particular file is low-churn (five commits total).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: **Platform-specific / config-specific:** ARCH_MA35 + CONFIG_MMC_SDHCI_OF_MA35D1=m. Built-in (=y) is unaffected. Distro- style modular kernels are the users who benefit.
**Step 8.2: TRIGGER CONDITIONS**
Record: Every boot/enumeration of nuvoton,ma35d1-sdhci when the driver is a module. Not a race. Unprivileged users do not trigger it; **boot/udev does**. Common *on that hardware* if distros ship the driver as =m.
**Step 8.3: FAILURE MODE SEVERITY**
Record: **Missing driver autoload → SD/MMC host never probes → no card/root disk until manual load.** Not oops/UAF. Severity **MEDIUM**, **HIGH** if root is on that host and the module is not in the initramfs by name. Same user-visible class as a missing device ID.
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** medium for MA35D1 modular builds (storage may not appear).
- **Risk:** **very low** (1 line, alias-only).
- **Ratio:** favorable. Same pattern already taken for stable on other SDHCI OF drivers.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: EVIDENCE**
**For backporting:**
- Real, deterministic autoload bug when MMC_SDHCI_OF_MA35D1=m.
- One-line, obviously correct, no new API.
- Driver has been in this lineage since v6.12; table was never exported.
- MMC maintainer applied it; SDHCI/Nuvoton were on Cc; no NAK.
- Same change as mmc: sdhci-of-aspeed: fix module autoloading, which carried Cc: stable.
- Matches the stable-rules “device ID” / hardware-enablement exception in spirit: publish an ID the driver already matches.
- Applies cleanly; no prerequisites.
**Against:**
- No Reported-by / no hardware reproduction (author said so).
- Peripheral SoC, not a core path.
- Not a crash, UAF, or corruption.
- No Cc: stable on this specific patch (Ulf took it for *next*, not as an urgent fix).
- Author is running a tree-wide alias sweep (quality of *this* hunk is still fine).
**Unresolved:**
- Whether linux-stable already discussed this (lore.kernel.org/stable blocked).
- How many shipping MA35D1 kernels use =m vs =y (unverified).
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — standard macro; maintainer applied. “Tested” is source-level, not lab hardware.
2. Fixes a real bug that affects users? **PASS** — modular autoload is broken; Kconfig allows =m.
3. Important issue? **PASS** (as device-ID / hardware-enablement, not as a crash). Storage host may never appear on boot.
4. Small and contained? **PASS** — +1 line, one file.
5. No new features or APIs? **PASS** — only module aliases for an existing compatible string.
6. Can apply to the local tree? **PASS** — driver present; hunk is the existing table site.
**Step 9.3: EXCEPTION CATEGORIES**
Record: **Device ID / module alias publication for an existing driver** (same practical class as adding PCI/USB/OF IDs). Not a new driver.
**Step 9.4: DECISION**
This tree has the MA35D1 SDHCI driver and had the missing alias from introduction until this commit. The patch is a one-line, zero-runtime- risk fix that makes the already-supported compatible string autoload when the driver is a module. That is stable-appropriate hardware enablement, not a feature or refactor.
---
## What the commit solves for stable users
On Nuvoton MA35D1, sdhci-of-ma35d1 already matches nuvoton,ma35d1-sdhci **if loaded**. Without MODULE_DEVICE_TABLE, a modular kernel never generates the OF alias, so the MMC/SD controller is silent until someone runs modprobe. Backporting restores autoload. Risk is essentially zero.
---
## Verification
- [Phase 1] Parsed commit 9b3732cce41d1: no Fixes/Reported- by/Cc:stable; SOBs Pengpeng Hou + Ulf Hansson
- [Phase 2] Diff: +1 line MODULE_DEVICE_TABLE(of, sdhci_ma35_dt_ids) in sdhci-of-ma35d1.c
- [Phase 2] MODULE_DEVICE_TABLE expansion verified in include/linux/module.h:255-257
- [Phase 3] git blame: table from addc9ecb9ddb3 (v6.12-rc1), no MODULE_DEVICE_TABLE until this commit
- [Phase 3] git show addc9ecb9ddb3: original driver had .of_match_table only
- [Phase 3] git merge-base --is-ancestor addc9ecb9ddb3 HEAD and 9b3732cce41d1 HEAD: both true
- [Phase 3] File log: 5 commits; no extra prereqs for this line
- [Phase 3] Precedent 6e540da4c1db7 (aspeed autoload): same one-liner, had Cc: stable
- [Phase 4] b4 dig -c/-a/-w/-m: v1-only; lore msgid [email protected]; Ulf “Applied for next”
- [Phase 4] WebFetch lore/patch.msgid.link: 403; thread read from mbox instead
- [Phase 5] Kconfig: MMC_SDHCI_OF_MA35D1 is tristate, depends on ARCH_MA35 || COMPILE_TEST
- [Phase 5] Other sdhci-of-*.c already have MODULE_DEVICE_TABLE
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4
- [Phase 6] Current file line 293 already has the macro
- [Phase 8] Failure mode: module not autoloaded; no oops
- UNVERIFIED: linux-stable list discussion (Anubis); how common =m is on MA35D1 distro kernels
**YES**
drivers/mmc/host/sdhci-of-ma35d1.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-of-ma35d1.c +1 -0
@@ -291,6 +291,7 @@ static const struct of_device_id sdhci_ma35_dt_ids[] = { { .compatible = "nuvoton,ma35d1-sdhci" }, {} }; +MODULE_DEVICE_TABLE (of, sdhci_ma35_dt_ids);static struct platform_driver sdhci_ma35_driver = { .driver = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 comedi: dt2811: Fix sanity check in interrupt handler
In reply to Sasha LevinFrom: Ian Abbott <[email protected]>
[ Upstream commit 8dda63825752ab19fcbc2a19ecab91d128112415 ]
The driver requests an interrupt handler for the device, after setting device registers to disable interrupt generation. The interrupt handler should not be called prematurely unless the user-configured I/O port base address and/or IRQ number are incorrect or the hardware is bad.
For safety, the interrupt handler checks the dev->attached flag to ensure the device is fully set up, but it currently does that after dereferencing dev->read_subdev, which may be NULL if dev->attached is false. Move the check to avoid the possible null pointer dereference.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: this is a real IRQ-time NULL deref in dt2811, the local 7.3-rc4 tree already contains the surgical fix, and it is a strong stable candidate.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[comedi/dt2811] [Fix] sanity check in interrupt handler**
- Subsystem: comedi: (COMEDI data-acquisition drivers), driver dt2811
- Verb: **Fix** — explicit bug-fix language
- Claimed intent: the dev->attached guard in dt2811_interrupt() is in the wrong place and can run after a NULL dereference
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- **Fixes:** none (expected for this review pipeline)
- **Reported-by:** none on *this* commit (but the series cover letter and sibling patches cite reporters; see Phase 4)
- **Tested-by:** none
- **Reviewed-by / Acked-by:** none on the commit
- **Link:** https://patch.msgid.link/[email protected] (series patch 3/11; msgid -4 because -1 is the cover letter)
- **Cc: stable:** none (expected)
- **Signed-off-by:** Ian Abbott <[email protected]> (COMEDI maintainer); Greg Kroah-Hartman (char-misc / staging tree, applied the patch)
- Ignore pipeline SOBs; none of Sasha Levin’s markers are on the real commit 8dda63825752ab19fcbc2a19ecab91d128112415
Notable pattern: this is patch 3 of an 11-patch maintainer series titled “Add/fix sanity check in ISA drivers to avoid null-ptr-deref”. Sibling patches carry Reported-by: from SNU researchers; this patch was included as the same class of bug.
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- **Bug:** IRQ handler checks dev->attached *after* using dev->read_subdev (s->async, async->cmd). If attached is false, read_subdev may still be NULL.
- **Symptom:** kernel NULL pointer dereference in interrupt context (oops).
- **Trigger described by author:** premature IRQ after request_irq() — wrong user-configured I/O base and/or IRQ, bad hardware, or the attach window before the device is marked attached.
- **Root cause:** request_irq() is issued in dt2811_attach() after registers are programmed to disable IRQs, but *before* subdevices / read_subdev / attached are set up. The existing safety check is too late.
- **Version info in message:** none.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: **Not a hidden fix.** Subject and body state a NULL deref. The “sanity check” wording is the existing attached-flag guard; the change is reordering it so it actually works.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/comedi/drivers/dt2811.c — **+5 / −2** (7 lines)
- Function: dt2811_interrupt()
- Scope: **single-file surgical fix**, one function, no API/data- structure change
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record (verified against 8dda63825752a^ vs current tree):
**Before:**
```c
s = dev->read_subdev;
async = s->async; /* deref s — crash if s == NULL */
cmd = &async->cmd; /* deref async — crash if async == NULL */
if (!dev->attached)
return IRQ_NONE;
```**After:**
```c
s = dev->read_subdev; /* pointer copy only; not a deref of s */
if (!dev->attached)
return IRQ_NONE;
async = s->async;
cmd = &async->cmd;
```Affected path: IRQ handler, **premature/spurious interrupt during attach** (and theoretically a shared/wrong IRQ). Normal post-attach acquisition is unchanged.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: **[NULL pointer dereference] in IRQ context**
- s = dev->read_subdev is assigned in dt2811_attach() only after request_irq() and comedi_alloc_subdevices().
- s->async is allocated even later, in __comedi_device_postconfig_async().
- dev->attached = true is set last, in comedi_device_postconfig().
- Window after request_irq() and before attached: read_subdev and/or async can be NULL. Old code dereferences them anyway.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- **Obviously correct:** same attached check already used across COMEDI; this only moves it before the first use of s.
- **Minimal:** no unrelated edits.
- **Regression risk: very low.** If attached is true, attach+postconfig have already set read_subdev and allocated async (barriers from attach_lock in postconfig). If attached is false, we now return IRQ_NONE instead of oopsing — correct for a shared/spurious IRQ.
- No public API, locking, or hot-path behavior change for a fully attached device.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Buggy handler introduced by **f2975a9b2ab9a9** (“staging: comedi:
dt2811: add async command support for AI subdevice”), H Hartley Sweeten, **2016-06-17**.
- Contained in **v4.8-rc1**. Present for ~10 years.
- if (!dev->attached) was already there from that commit; it was simply **after** the NULL deref.
Step 3.2: FOLLOW THE FIXES: TAG
Record: **No Fixes: tag.** Introducer is f2975a9b2ab9a9 (v4.8), confirmed via blame + git show. That commit exists in this tree’s history. No intermediate dt2811 interrupt-handler fix between 2016 and this commit.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record:
- 408bece94e7bd — I/O-base sanity checks (unrelated)
- df0e68c1e9945 — header move
- 8ffdff6a8cfbd (2021-04-15) — comedi left staging
- This patch is **standalone**. Series 11/11 are independent per-driver one-liners; no shared helper or prerequisite refactor. Nothing after 8dda63825752a on this file.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: **Ian Abbott is a listed COMEDI maintainer** (MAINTAINERS:
COMEDI DRIVERS, status **Odd Fixes**). Same-day series of 11 analogous IRQ-guard fixes. Weight: high — subsystem maintainer fixing a class of bugs reported by researchers.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: **None.** Uses dev->attached / dev->read_subdev that have existed for years. Applies standalone. Path in this tree is drivers/comedi/drivers/dt2811.c (post-staging). On pre-2021 trees the same hunk would apply under drivers/staging/comedi/drivers/dt2811.c.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c 8dda63825752a →
https://patch.msgid.link/[email protected]
- b4 dig -a: **v1 only** (single revision, 11-patch series). Applied version is that v1.
- Cover letter (20260618102949.26607-1): “Add/fix sanity check in ISA drivers to avoid **null-ptr-deref**”. Explains IRQ registered before subdevice init; some drivers already checked attached too late (dt2811 is in that set).
- Original report: https://lore.kernel.org/lkml/20260610115912.780131-1-
[email protected]/ (Jaeyoung Chung et al.). dt2811 was **not** in the reporter’s list; Abbott added it after spotting the same pattern.
- **No replies/NAKs** in the saved thread (12 messages, all from Abbott — patches + cover only).
- **No explicit Cc: stable** in the thread. Greg KH applied it to char- misc.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w):
- Recipients: linux-kernel, Greg Kroah-Hartman, H Hartley Sweeten (other COMEDI maintainer), Jaeyoung Chung, Sangyun Kim, Kyungwook Boo
- Appropriate maintainers were on CC. No external Reviewed-by; author *is* the maintainer.
Step 4.3: SEARCH FOR THE BUG REPORT
Record:
- Sibling patch 01/11 has Reported-by: Jaeyoung Chung, Sangyun Kim, Kyungwook Boo (SNU) and the lore link above.
- Cover letter: several ISA drivers can NULL-deref if the device interrupts before setup.
- Direct fetch of lore.kernel.org returned **403** in this environment; content is taken from the b4-saved mbox, not from WebFetch.
- Severity from reporter’s framing: **null-ptr-deref** (crash). Academic/security-style report of a real CWE-class bug, not a theoretical nit.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: 11 independent driver patches. This one does **not** depend on 01/02 or later patches. Related: 17221216ae8ce comedi_parport (sent ~3 weeks earlier, mentioned in the cover letter).
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable search also **403**. No evidence in the commit or series mbox of a stable NAK or of an existing reason to skip it. **UNVERIFIED:** whether anyone already queued this on stable@ (does not change the technical verdict).
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: **dt2811_interrupt()** only.
Step 5.2: TRACE CALLERS
Record:
- Registered in dt2811_attach() via request_irq(it->options[1], dt2811_interrupt, 0, ...) when the user-supplied IRQ is in {2,3,5,7}.
- Calling context: **hard IRQ**. Crash is an oops in interrupt context.
Step 5.3: TRACE CALLEES
Record (after the guard): inb/outb on dev->iobase, dt2811_ai_read_sample(), comedi_buf_write_samples(), comedi_handle_events(). Unchanged. The fix only avoids entering that path when the device is not attached.
Step 5.4: FOLLOW THE CALL CHAIN
Record:
- Userspace: COMEDI COMEDI_DEVCONFIG attach (comedi_device_attach() → dt2811_attach() → request_irq()).
- Attach typically needs privilege (raw I/O / admin), not an unprivileged syscall smash.
- Still reachable: load dt2811, configure I/O+IRQ, race during attach, or share/wrong IRQ.
- **Reachable from device attach**, not purely theoretical.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Same class fixed in aio_iiro_16, das6402, ni_at_a2150, ni_atmio16d, pcl711/816/818, pcmmio, pcmuio, quatech_daqp_cs. Canonical comment in ni_660x.c: “make sure dev->attached is checked before doing anything else”. Systematic COMEDI IRQ-init bug, not a one-off.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record:
- Local tree: **git describe HEAD = v7.3-rc4-27-gf0100363d8c37**, make kernelversion = **7.3.0-rc4** (mainline, not a 6.x.y stable branch).
- git merge-base --is-ancestor 8dda63825752a HEAD → **yes** (exit 0). The **fix is already in this checkout**.
- The **bug existed here until that commit**. Introduced v4.8 (f2975a9b2ab9a9). File and function exist at drivers/comedi/drivers/dt2811.c.
- Current dt2811_interrupt() already has the reordered check (lines 192–204).
This evaluation is whether that mainline fix **should be selected for stable**, not whether to re-apply it on 7.3-rc4. The touched code is present and the bug is old enough for every current LTS that still has the pre-fix handler.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply** on this code (hunk is tiny; handler body has been stable since 2016 aside from this reorder). Older stables with comedi still in staging need only a path rename. No conflicting local changes.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: This *is* the fix. No earlier dt2811 interrupt-guard substitute. No later revert or follow-up.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY Record:
- **Subsystem:** drivers/comedi/ — COMEDI ISA DAQ (CONFIG_COMEDI_DT2811, Data Translation DT2811).
- **Criticality: PERIPHERAL.** Niche 1980s-era ISA ADC/DAC. Not mm/net/fs. Still an in-tree, non-staging driver since 2021.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Status **Odd Fixes**. Low churn; Ian Abbott still sending real bugfixes (this series, I/O-base checks). Mature driver, long-lived bug.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Driver-specific / config-specific** — only CONFIG_COMEDI_DT2811 users with this ISA board (or anyone attaching the driver with an IRQ). Small population, including lab/industrial leftover hardware and distros that ship comedi modules.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- **Attach race:** request_irq at dt2811_attach() ~line 571, then reset already done, then alloc subdevices, then read_subdev = s, then return; core then comedi_device_postconfig() sets attached. Any IRQ in that window hits the bug.
- **Misconfigured IRQ/I/O:** author explicitly calls this out; ISA IRQ 2/3/5/7 are often shared.
- **How common:** uncommon (old ISA + attach/misconfig), but the window is real and does not need exotic timing beyond “IRQ fires while attaching”.
- **Unprivileged:** attach is privileged; this is **not** a guest DoS from an unprivileged syscall. Still a host oops for a legitimate (or root) attach.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record:
- **Failure mode:** NULL deref of s or s->async in dt2811_interrupt() → **kernel oops in IRQ context**.
- **Severity: HIGH** (crash). Not a silent corruption or universal panic, but an oops is an important stable-class issue.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- **Benefit:** medium for affected users (prevents oops on attach/wrong IRQ); low globally (tiny user base).
- **Risk:** **very low** — 7-line reorder, no locking/API change, behavior for attached devices identical.
- **Ratio:** **favor backport.** Near-zero regression risk vs a real crash fix. Obscure hardware is not a NO when the patch is this small and correct.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
**FOR:**
- Real NULL deref in IRQ handler (verified in pre-image of 8dda63825752a and in attach/postconfig ordering).
- Bug since v4.8; still the same handler shape.
- Maintainer-authored, merged by Greg KH; part of a documented null-ptr- deref series from an external report.
- 5 insertions / 2 deletions, obviously correct, no new API.
- Standalone; no prerequisites.
- Matches stable rule “NULL pointer dereference” and “driver probe/IRQ UAF/NPD”.
**AGAINST:**
- Peripheral ISA driver, few users.
- Trigger needs COMEDI attach + IRQ; not a core-path bug.
- This patch itself had no Reported-by (dt2811 was maintainer-found, not in the SNU list).
- No syzbot/KASAN splat in the commit message (hard to fuzz ISA I/O).
**UNRESOLVED:**
- Full text of the SNU report (lore 403).
- Whether stable@ already discussed this series.
None of the unresolved items are required to decide: the local code proves the NPD.
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — reorder of an existing guard; applied to char-misc; v1 with no NAK.
2. Fixes a real bug that affects users? **PASS** — NPD if IRQ fires before attached.
3. Important issue? **PASS** — oops in IRQ context (HIGH, not data- corruption/security-universal).
4. Small and contained? **PASS** — one function, +5/−2.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — code exists; hunk matches this tree. (Fix is already merged here; that is the *source* of the backport, not a reason to skip stables that still have the old order.)
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Not an exception category** (not a device ID/quirk/DT/build/doc patch). It is a ordinary small crash fix.
Step 9.4: MAKE YOUR DECISION
This is a textbook stable backport: a long-standing, small, obviously correct NULL-deref fix in an IRQ handler. Niche hardware lowers population, not severity-for-those-users, and the regression risk is negligible.
**What it solves for stable users:** loading/configuring the dt2811 COMEDI driver can oops if an interrupt arrives after request_irq() and before dev->attached / read_subdev / s->async are valid. The patch returns IRQ_NONE until attach is complete.
**Risk vs benefit:** benefit is preventing an oops; risk is a 7-line reorder with identical post-attach behavior.
**Concerns:** none that block a backport. Series membership does not imply a prerequisite. Staging path adjustment only matters on pre-2021 trees, not this 7.3 checkout.
Verification:
- [Phase 1] Parsed subject/tags/body of 8dda63825752ab19fcbc2a19ecab91d128112415; no Fixes/Cc:stable/Reported-by on this commit; Link msgid 26607-4
- [Phase 2] git show 8dda63825752a^:drivers/comedi/drivers/dt2811.c — confirmed s->async / async->cmd before if (!dev->attached)
- [Phase 2] Current file lines 192–204 — fix present
- [Phase 3] git blame — buggy pattern from f2975a9b2ab9a9 (2016); git describe --contains → v4.8-rc1
- [Phase 3] git log --oneline -- drivers/comedi/drivers/dt2811.c — no later dt2811 IRQ follow-up
- [Phase 3] Author is MAINTAINERS COMEDI contact
- [Phase 4] b4 dig -c / -a / -w / -m — v1 series, cover letter null-ptr-deref, SNU CCs, no NAK in mbox
- [Phase 4] lore WebFetch/curl → 403; used b4 mbox instead
- [Phase 5] Grep: only dt2811_attach request_irqs this handler; comedi_device_attach → attach → comedi_device_postconfig sets attached after s->async alloc
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4; git merge-base --is-ancestor 8dda63825752a HEAD succeeds
- [Phase 7] Kconfig COMEDI_DT2811 “Data Translation DT2811 ISA card support”
- [Phase 8] Failure mode: NULL deref in IRQ → oops; trigger: attach window / bad IRQ
- UNVERIFIED: full SNU report HTML; stable@ archive search (lore 403)
The fix is small, surgical, and meets all stable kernel criteria.
**YES**
drivers/comedi/drivers/dt2811.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/comedi/drivers/dt2811.c +5 -2
@@ -193,13 +193,16 @@ static irqreturn_t dt2811_interrupt(int irq, void *d) {struct comedi_device *dev = d;struct comedi_subdevice *s = dev->read_subdev; -struct comedi_async *async = s->async; -struct comedi_cmd *cmd = &async->cmd; +struct comedi_async *async; +struct comedi_cmd *cmd;unsigned int status;if (!dev->attached)return IRQ_NONE ; + async = s->async; + cmd = &async->cmd; + status =inb (dev->iobase +DT2811_ADCSR_REG );if (status &DT2811_ADCSR_ADERROR ) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 scsi: devinfo: Add BLIST_SKIP_IO_HINTS for EMC Symmetrix
In reply to Sasha LevinFrom: "Ewan D. Milne" <[email protected]>
[ Upstream commit f06a44e235ef188689ba23ffc72e9e89b10951a9 ]
EMC Symmetrix returns an error on MODE SENSE for page 0Ah subpage 05h because it does not implement the SBC-5 I/O hints. These commands began to be sent as a result of commit 4f53138fffc2 ("scsi: sd: Translate data lifetime information"). Add BLIST_SKIP_IO_HINTS to avoid sending these commands because in large configurations the failed commands are displacing other useful information in internal error logs.
---
LLM Generated explanations, may be completely bogus:
## Local tree
This checkout is **6.18.y** (v6.18.57-155-gcdf239ca885b2, VERSION=6 / PATCHLEVEL=18 / SUBLEVEL=57). The verdict is only for this tree.
The I/O-hints path and BLIST_SKIP_IO_HINTS are already here. At v6.18, the EMC SYMMETRIX blacklist entry does **not** skip those queries, so the bug exists.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject**
- Record: **[scsi/devinfo] [Add] hardware blacklist flag BLIST_SKIP_IO_HINTS for EMC Symmetrix**
**Step 1.2: Tags**
- Record:
- Signed-off-by: Ewan D. Milne <[email protected]> (author, Red Hat SCSI)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Martin K. Petersen (Oracle) <[email protected]> (SCSI maintainer)
- No Fixes:, Reported-by:, Tested-by:, Cc: stable (absence is expected)
- Pipeline Signed-off-by: Sasha Levin and [Upstream commit …] ignored
**Step 1.3: Body**
- Record: **Bug:** EMC Symmetrix does not implement SBC-5 I/O hints, so MODE SENSE page 0Ah subpage 05h fails. Those commands started after 4f53138fffc2 ("scsi: sd: Translate data lifetime information").
- **Symptom:** In large configs, failed commands fill the array’s internal error logs and displace useful entries.
- **Root cause:** Kernel probes a mode page the device does not implement.
- **Version info:** The probing started with 4f53138fffc2 (v6.9-rc1); that commit is an ancestor of this tree.
**Step 1.4: Hidden bug fix?**
- Record: **No disguise.** This is an explicit hardware quirk. It is not cleanup/refactor.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- Record: **1 file**, drivers/scsi/scsi_devinfo.c, **+1 / -1**, one table entry.
- Function: static scsi_dev_info_list initializer (EMC SYMMETRIX row).
- Scope: **single-file surgical quirk**.
**Step 2.2: Code flow**
- Record: **Before:** flags BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2 | BLIST_RETRY_ITF.
- **After:** same plus BLIST_SKIP_IO_HINTS.
- Affected path: sd_read_io_hints() during sd_revalidate_disk() (probe, open/revalidate, rescan). With the flag set it returns immediately and does not send MODE SENSE 0x0A/0x05.
**Step 2.3: Bug mechanism**
- Record: **[Hardware workaround]** Device-specific skip of an unsupported SCSI mode page. Same pattern as USB storage and the Iomega ZIP BLIST_SKIP_IO_HINTS entries already in this tree.
**Step 2.4: Fix quality**
- Record: **Obviously correct.** One flag bit on an existing vendor/product match. Regression risk is **very low**: only EMC SYMMETRIX skips a feature it does not implement. No API, locking, or allocation changes.
---
## PHASE 3: GIT HISTORY
**Step 3.1: Blame**
- Record: EMC SYMMETRIX row is old (3441afc672bc / 29cfc2ab71d96 for BLIST_RETRY_ITF, 2018). The **new** failure is not that row; it is sd_read_io_hints() from 4f53138fffc2 (**v6.9-rc1**, 2024-02-26).
**Step 3.2: Fixes: tag**
- Record: **None.** The message names 4f53138fffc2. git merge-base --is-ancestor 4f53138fffc2 HEAD → **yes**. git describe --contains 4f53138fffc2 → v6.9-rc1~12^2~8.
**Step 3.3: File history**
- Record: Related: 74b25178943fe ("scsi: devinfo: Add BLIST_SKIP_IO_HINTS for Iomega ZIP") — same quirk class, already in this 6.18 tree. 633aeefafc9c2 introduced the flag (**v6.10-rc5**), also an ancestor. **Standalone**, not patch X/Y.
**Step 3.4: Author**
- Record: Ewan D. Milne is a long-time SCSI contributor (Red Hat). Applied by SCSI maintainer Martin K. Petersen. Related flag work by Bart Van Assche (BLIST_SKIP_IO_HINTS intro, Cc: stable there).
**Step 3.5: Prerequisites**
- Record: Needs BLIST_SKIP_IO_HINTS and sd_read_io_hints() skip check. Both exist in v6.18 (include/scsi/scsi_devinfo.h:73, drivers/scsi/sd.c:3235). **Applies standalone.**
---
## PHASE 4: MAILING LIST / EXTERNAL
**Step 4.1: Original discussion**
- Record: b4 dig -c f06a44e235ef →
https://patch.msgid.link/[email protected]
- **v1 only** (b4 dig -a). No NAKs. Laurence Oberman: “Looks good” + Reviewed-by. Martin Petersen: applied to **7.3/scsi-fixes** (https://git.kernel.org/mkp/scsi/c/f06a44e235ef). No Cc: stable in review.
**Step 4.2: Recipients (b4 dig -w)**
- Record: Author + [email protected]. SCSI list was CCed; maintainer applied it.
**Step 4.3: Bug report**
- Record: No syzbot/bugzilla. Description is operational: array error- log overflow in large configs. That is a real enterprise SAN issue, not a theoretical one.
**Step 4.4: Series**
- Record: **Standalone 1/1.** ZIP quirk is a sibling pattern, not a dependency.
**Step 4.5: Stable list**
- Record: No lore.kernel.org/stable hit for this subject. WebFetch to lore returned 403; stable search via WebSearch found nothing relevant.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Functions**
- Record: No function body change. Table consumed via sdev->sdev_bflags. Consumer: sd_read_io_hints().
**Step 5.2: Callers**
- Record: sd_read_io_hints() is called only from sd_revalidate_disk() (drivers/scsi/sd.c:3773).
- sd_revalidate_disk() is called from:
- sd_probe() (disk attach)
- sd_open() if sd_need_revalidate()
- sd_rescan()
- sysfs cache-type store path
- **Process context**, SCSI disk attach/revalidate. In a large Symmetrix config this runs once per LUN (often thousands).
**Step 5.3: Callees**
- Record: Without the flag, scsi_mode_sense(..., modepage=0x0a, subpage=0x05, ...). On failure (res < 0) it already returns; the kernel does not oops. Harm is the failed command on the array.
**Step 5.4: Reachability**
- Record: **Yes.** Any EMC Symmetrix LUN probed as sd hits this. Not an obscure config path.
**Step 5.5: Similar patterns**
- Record: USB storage/uas set BLIST_SKIP_IO_HINTS because some devices **reset** on that page. Iomega ZIP uses it because the query makes the drive unusable. Same skip, milder Symmetrix symptom (error- log flood).
---
## PHASE 6: LOCAL TREE CROSS-REFERENCE
**Step 6.1: Buggy code in this tree?**
- Record: **Yes.** v6.18 has sd_read_io_hints() and the flag check, and the EMC row **without** BLIST_SKIP_IO_HINTS. Bug since 4f53138fffc2 (v6.9), so it is in 6.18.
**Step 6.2: Backport difficulty**
- Record: **Clean apply.** Parent of the candidate still has the same two-line EMC entry as v6.18. No refactor of that table.
**Step 6.3: Related fixes already here?**
- Record: Flag infrastructure and ZIP/USB skips are present. **No** existing skip for EMC Symmetrix at v6.18.
---
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1**
- Record: **[SCSI disk / scsi_devinfo] [IMPORTANT]** — not core mm/VFS, but enterprise block storage. EMC/Dell Symmetrix (VMAX/PowerMax lineage) is still used on LTS kernels.
**Step 7.2**
- Record: SCSI is actively maintained; this file is a mature quirk table, not a new subsystem.
---
## PHASE 8: IMPACT AND RISK
**Step 8.1: Who is affected**
- Record: **Driver/hardware-specific:** hosts with INQUIRY vendor EMC / product SYMMETRIX. Typical: datacenter SAN on 6.18 LTS.
**Step 8.2: Trigger**
- Record: **Every disk revalidate** (probe, rescan, some opens). Common on boot and device discovery. Unprivileged users do not trigger it directly; udev/scan does. Not a race.
**Step 8.3: Failure mode**
- Record: **Not a kernel oops.** Failed MODE SENSE is ignored in sd_read_io_hints(). User-visible issue is **array error-log pollution** in large LUN counts, hiding real faults. Severity **MEDIUM** for the kernel, **HIGH** operationally on big arrays. USB/ZIP cases of the same flag were crash/unusable-device; this is the same class of quirk.
**Step 8.4: Risk/benefit**
- Record: **Benefit: high for Symmetrix users, zero for others. Risk:
very low (1 flag bit, existing match).** Ratio favors backport.
---
## PHASE 9: SYNTHESIS
**Step 9.1: Evidence**
For:
- Real hardware incompatibility with a command 6.18 already sends
- Enterprise arrays, large LUN counts, error-log displacement
- 1-line quirk; BLIST_SKIP_IO_HINTS already in this tree
- Same class as USB/ZIP skips; ZIP already on 6.18
- Reviewed and applied to scsi-fixes by the SCSI maintainer
- Applies cleanly to v6.18
Against:
- Not a kernel crash, UAF, deadlock, or data corruption
- No Cc: stable / Fixes:
- Affects only one vendor/product
Unresolved:
- Lore HTTP 403; thread recovered via b4 dig -m. No public syzbot/bugzilla count of affected arrays.
**Step 9.2: Stable rules**
1. Obviously correct and tested? **PASS** — 1-bit flag; maintainer applied; Reviewed-by: Laurence Oberman
2. Real bug affecting users? **PASS** — unsupported MODE SENSE on production arrays
3. Important issue? **PASS** as a hardware quirk (array log overflow in large configs). Not a kernel panic.
4. Small and contained? **PASS** — +1/-1, one table row
5. No new features/APIs? **PASS** — uses existing flag
6. Can apply to this tree? **PASS** — flag, consumer, and EMC row all present at v6.18
**Step 9.3: Exception**
- Record: **Hardware quirk/workaround** (scsi_devinfo blacklist), analogous to USB/PCI quirks. That class is accepted for stable.
**Step 9.4: Decision**
This is a one-line device quirk for hardware this 6.18 tree already probes with I/O-hints MODE SENSE. The skip flag and call site exist; the EMC row does not skip yet. Risk is negligible; benefit is real for Symmetrix/VMAX deployments. **YES for this tree.**
---
## What this solves for 6.18 users
Since v6.9, sd_revalidate_disk() calls sd_read_io_hints(), which issues MODE SENSE page 0x0A subpage 0x05. EMC Symmetrix does not implement that SBC-5 page and returns an error. The kernel already swallows the error; on arrays with many LUNs those failures fill the controller’s error logs. Adding BLIST_SKIP_IO_HINTS stops the query for that INQUIRY match only.
It meets stable rules: small, obviously correct, no new API, applies cleanly, and is a standard scsi_devinfo hardware quirk.
---
## Verification
- **[Phase 1]** Parsed tags: author SOB Ewan Milne, Link to msgid, maintainer SOB Martin Petersen; no Fixes/Reported-by/Cc:stable
- **[Phase 2]** Diff: 1 line in scsi_devinfo.c EMC SYMMETRIX flags; adds BLIST_SKIP_IO_HINTS
- **[Phase 3]** git describe HEAD / make kernelversion: **6.18.57**
- **[Phase 3]** git merge-base --is-ancestor 4f53138fffc2 HEAD: yes; git describe --contains: v6.9-rc1
- **[Phase 3]** git merge-base --is-ancestor 633aeefafc9c2 HEAD: yes (flag intro, v6.10-rc5)
- **[Phase 3]** git blame EMC row: 29cfc2ab71d96 added BLIST_RETRY_ITF (2018); skip flag is new
- **[Phase 3]** git show v6.18:drivers/scsi/scsi_devinfo.c: SYMMETRIX **without** BLIST_SKIP_IO_HINTS
- **[Phase 3]** git grep BLIST_SKIP_IO_HINTS v6.18: flag and sd.c check present
- **[Phase 4]** b4 dig -c f06a44e235ef: lore URL; v1 only; Reviewed-by Laurence Oberman; applied to 7.3/scsi-fixes
- **[Phase 4]** b4 dig -m: full thread, no NAK, no stable nomination
- **[Phase 4]** WebFetch lore/msgid: **403**; used b4 mbox instead
- **[Phase 5]** Callers: sd_read_io_hints ← sd_revalidate_disk ← sd_probe / sd_open / sd_rescan
- **[Phase 6]** Parent of candidate matches v6.18 EMC lines → clean apply
- **[Phase 8]** Failure: array error-log flood, not kernel oops; severity MEDIUM kernel / HIGH operational
- **UNVERIFIED:** Exact customer ticket / number of arrays (not in the thread)
**YES**
drivers/scsi/scsi_devinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_devinfo.c +1 -1
@@ -161,7 +161,7 @@ static struct { {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* EMC CLARiiON, no storage on LUN 0 */ {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | - BLIST_REPORTLUN2 | BLIST_RETRY_ITF}, + BLIST_REPORTLUN2 | BLIST_RETRY_ITF | BLIST_SKIP_IO_HINTS}, {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN}, {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN},
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ACPI: APEI: Handle repeated SEA error storms
In reply to Sasha LevinFrom: Junhao He <[email protected]>
[ Upstream commit e61487226b7df39e5f4683b036ee6aa7a5039d7b ]
When hardware memory corruption occurs and a user process accesses the corrupted page, the CPU triggers a Synchronous External Abort (SEA). The kernel invokes do_sea() to handle the exception, which calls memory_failure() to handle the faulty page.
Scenario 1: Memory Error Interrupt First, then SEA
The page is already poisoned by the memory error interrupt path. The subsequent SEA handler sends a SIGBUS to the task, which accesses the poisoned page. This flow is correct.
Scenario 2: SEA first, then memory error interrupt (problematic scenario) If a user task directly accesses corrupted memory through a PFNMAP-style mapping (e.g., devmem), the page may still be in the free-buddy state when SEA is handled. In this case, memory_failure() will poison the page without invoking kill_accessing_process(), and then takes the free-buddy recovery path.
After the CPU returns to the task context, the task re-enters the SEA handler due to the same access. However, ghes_estatus_cached() suppresses all subsequent entries during the 10-second window, preventing ghes_do_proc() from being called. This suppression blocks the MF_ACTION_REQUIRED-based SIGBUS delivery, causing the kernel to fail to kill the task immediately. Consequently, the process keeps re-entering the SEA handler, leading to an SEA storm. Later, the memory error interrupt path also cannot kill the task, leaving the system stuck in this repeated loop.
The following error logs are explained using the devmem process:
NOTICE: SEA Handle
[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 9 [Hardware Error]: event severity: recoverable
[Hardware Error]: section_type: ARM processor error
[Hardware Error]: physical fault address: 0x0000001000093c00
[T54990] Memory failure: 0x1000093: recovery action for free buddy page: Recovered [ T9955] EDAC MC0: 1 UE Multi-bit ECC on unknown memory
(page:0x1000093 offset:0xc00 grain:1 - APEI location: ...)
NOTICE: SEA Handle
NOTICE: SEA Handle
...
... ---> SEA storm
...
NOTICE: SEA Handle
[ T9955] Memory failure: 0x1000093: already hardware poisoned
ghes_print_estatus: 1 callbacks suppressed
[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 9 [Hardware Error]: event severity: recoverable
[Hardware Error]: section_type: ARM processor error
[Hardware Error]: physical fault address: 0x0000001000093c00
[T54990] Memory failure: 0x1000093: already hardware poisoned
[T54990] 0x1000093: Sending SIGBUS to devmem:54990 due to hardware memory corruption
To resolve this, return an error when encountering the same SEA again. The subsequent SEA handler invocation uses arm64_notify_die() to send a SIGBUS signal to the task, which terminates the process and prevents it from re-entering the handler loop.
---
LLM Generated explanations, may be completely bogus:
The local tree is **pending-6.18** (kernel **6.18.53**). The buggy GHES cache-hit path is present here, the patch applies cleanly, and this is a real ARM64 SEA-storm hang, so it should be backported.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [ACPI: APEI] [Handle] [Stop repeated SEA aborts from looping when GHES cache suppresses a duplicate error]
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Reviewed-by: Wupeng Ma <[email protected]>
- Reviewed-by: Shuai Xue <[email protected]> (ACPI APEI reviewer in MAINTAINERS)
- Reviewed-by: Tony Luck <[email protected]> (ACPI APEI reviewer / RAS)
- Link: https://patch.msgid.link/20260527082707.2013499-1-hejunhao3@h-
partners.com
- Signed-off-by: Junhao He <[email protected]>
- Signed-off-by: Rafael J. Wysocki <[email protected]> (ACPI maintainer)
- No Fixes: tag (expected)
- No Cc: stable (expected)
- No Reported-by / Tested-by / syzbot
- Ignore pipeline SOBs such as Sasha Levin
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: On ARM64 firmware-first SEA, if a userspace PFNMAP access (devmem) hits corrupted memory while the page is still a free buddy, memory_failure() poisons it as recovered and does not kill the task. The task retries the same access. ghes_estatus_cached() then drops duplicates for 10s (GHES_ESTATUS_IN_CACHE_MAX_NSEC), so ghes_do_proc() never runs again and SIGBUS is not delivered. The CPU loops in SEA. Firmware logs show a ~10s storm, then SIGBUS only after the cache expires.
- Symptom: exception storm / system stuck; related APEI commits note firmware threshold reboot or hard lockup from the same class of loop.
- Version info: none in the message. Logs are from a real ARM platform (APEI GHES source 9, EDAC MC0).
- Root cause: cache-hit path in ghes_in_nmi_queue_one_entry() returns success (rc == 0), so apei_claim_sea() claims the abort and do_sea() returns without arm64_notify_die().
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not disguised. This is an explicit hang/storm fix, not cleanup.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/acpi/apei/ghes.c only (+9 / -1)
- Function: ghes_in_nmi_queue_one_entry()
- Scope: single-file surgical fix
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: cached estatus → goto no_work with rc still 0 → callers treat it as “successfully handled.”
- After: cached + is_hest_sync_notify(ghes) (HEST notify type SEA) → rc = -ECANCELED → ghes_notify_sea() / apei_claim_sea() fail → do_sea() falls through to arm64_notify_die() and SIGBUS.
- Path affected: duplicate synchronous SEA only. NMI/SDEI cache hits stay rc = 0.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: logic / correctness in RAS exception handling (hang / exception storm).
- Mechanism: success-on-cache-hit hid an incomplete recovery (free-buddy poison without kill). Returning an error unclaims the SEA so the arch handler can kill the task.
Verified supporting code in this tree:
- action_result(MF_RECOVERED) returns 0 (mm/memory-failure.c).
- memory_failure_cb() returns without SIGBUS if !ret.
- Free-buddy path never calls kill_accessing_process().
- 79a5ae3c4c5eb only force_sig(SIGBUS) when sync && !queued; the first SEA *does* queue work, so that fallback does not fire.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct for the single-source SEA case that matches the logs.
- Minimal; no API/data-structure change.
- Regression risk is low: gated by is_hest_sync_notify() so x86 NMI / SDEI behavior is unchanged.
- Known limitation (discussed on-list, accepted by Tony Luck): if several GHES SEA sources are on the list and one still returns 0, -ECANCELED is discarded. Author: a true multi-source storm is a different failure. Not a reason to withhold the single-source fix.
- KVM: kvm_handle_guest_sea() currently claims a duplicate SEA (apei_claim_sea() == 0). After this, it injects SError into the guest instead of leaving the host looping. That is an improvement, not a new API.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Cache skip introduced in d9f608dc156487 (“ACPI / APEI: Only use queued estatus entry during in_nmi_queue_one_entry()”, 2019-01-29). Present in this tree.
- is_hest_sync_notify() from a70297d221325 (2023-12-18). Present.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Not applicable. The bug is interaction among the 2019 cache, long-standing free-buddy recovery, and SEA claim returning success.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Related commits already in this tree:
- a70297d221325 — MF_ACTION_REQUIRED on sync events
- 79a5ae3c4c5eb — SIGBUS if sync error is not queued
- c1f1fda141373 — run memory_failure() in task work for sync SEA This patch is a remaining hole after those two 2025 SIGBUS fixes: queued free-buddy recovery still does not kill, then cache blocks the retry.
Standalone. Not “patch X/Y”.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Junhao He has HiSilicon PMU commits here, not APEI. Reviewers are the APEI/RAS people. Weight is from review, not authorship.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: Needs is_hest_sync_notify() and the existing ghes_in_nmi_queue_one_entry() cache check. Both are in this tree. Can apply standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- v1 msgid: [email protected] (2025-10-30), 12 messages. Returned -EAGAIN on every cache hit, including NMI/SDEI.
- v2 msgid: [email protected] (2026-05-27), 10 messages. This is the applied version: only SEA via is_hest_sync_notify().
- Applied version is v2 (latest).
- No NAKs. Rafael required an APEI-reviewer ACK; Tony Luck then Reviewed-by. Rafael: “Applied as 7.3 material.”
- No reviewer Cc: stable.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: Recipients/reviewers included ACPI APEI maintainers/reviewers (Rafael, Tony Luck, Shuai Xue). Shuai asked for an x86 look because the helper is shared; v2’s SEA-only gate was the answer. Tony Luck R-b after that explanation.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No bugzilla/syzbot. Author included production-style firmware + kernel logs (devmem task, free buddy Recovered, then 10s of “SEA Handle”, then SIGBUS). Real hardware reproduction, not theoretical.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Single patch. v2 changelog: (1) commit message per Shuai Xue,
(2) SEA-only so other NMI-type GHES handlers are not affected.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org HTTP was 403/Anubis. Thread retrieved with b4 mbox. No stable@ discussion found in those threads. UNVERIFIED: other independent stable-list threads beyond these two.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: ghes_in_nmi_queue_one_entry(); uses ghes_estatus_cached(), is_hest_sync_notify().
Step 5.2: TRACE CALLERS
Record:
- ghes_in_nmi_spool_from_list() ← ghes_notify_sea() (SEA) and NMI list
- __ghes_sdei_callback() (SDEI)
- ghes_notify_sea() ← apei_claim_sea() ← do_sea() (user_mode only) and kvm_handle_guest_sea()
NMI/SDEI: is_hest_sync_notify() is false, so no behavior change.
Step 5.3: TRACE CALLEES
Record: Cache lookup, gen_pool_free on no_work, no new locks/allocs on the new path.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Userspace load/store to poisoned PFNMAP memory → SEA → do_sea → apei_claim_sea → GHES. Reachable from userspace (/dev/mem in the logs). Unprivileged trigger depends on who can map that physical page (typically privileged), but once it fires the host loops. Firmware-first ARM64 servers are the population.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: ghes_proc() still calls ghes_do_proc() even when cached (IRQ path). Only the NMI-queue path skips processing on cache hit. That is unique to this helper; no sibling copy of the same bug.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. drivers/acpi/apei/ghes.c:1373-1375 is still:
```
if (ghes_estatus_cached(estatus))
goto no_work;
```is_hest_sync_notify() exists. CONFIG_ACPI_APEI_SEA is default y on ARM64. Bug class present since the 2019 queue path; this 6.18 tree also has the 2025 task-work SIGBUS series that still misses free-buddy.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Exact hunk matches this file. Expected apply: clean.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: c1f1fda141373 and 79a5ae3c4c5eb are in HEAD; they do not cover this cache-hit + free-buddy case. This commit is not in HEAD (git log --grep on the file found nothing).
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: ACPI APEI / GHES RAS. IMPORTANT for ARM64 firmware-first platforms (servers, Huawei/Kunpeng-class). Not core-mm, but memory-error handling on those machines.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Actively maintained (CXL CPER, ARM CPER bounds, task-work SEA). Mature SEA queue dates to 2019.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: ARM64 + ACPI APEI GHES SEA + memory failure. Driver/platform- specific, not universal. Typical of enterprise ARM RAS.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Hardware UE/poison + userspace access via PFNMAP while page is free buddy, SEA before (or instead of useful) async kill. Not every boot. When it hits, it repeats until the 10s cache expires or firmware reboots. Unprivileged users generally cannot open /dev/mem; still a host-stability bug for RAS/error-injection and any PFNMAP consumer.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: Exception storm / stuck task; related APEI text: firmware threshold reboot or hard lockup. Severity: CRITICAL/HIGH. Logs prove the 10s storm (1419.78 → 1429.81).
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: high for ARM64 RAS — stops a documented SEA storm and delivers SIGBUS immediately.
- Risk: low — ~9 lines, SEA-only, no new ABI, clean apply.
- Ratio: benefit ≫ risk.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real hang/storm with hardware logs
- Small, obviously correct, SEA-gated
- Applies cleanly to this 6.18 tree; helper already present
- Prior APEI SIGBUS fixes in this tree leave this hole
- Reviewed by APEI reviewers (Luck, Xue) and applied by Rafael
AGAINST:
- Trigger is RAS/PFNMAP, not every machine
- No Fixes:/Cc: stable (not a negative per rules)
- Incomplete if multiple concurrent distinct SEA sources all stay cached (accepted on-list)
UNRESOLVED:
- Could not HTTP-fetch lore (403); used b4 mbox instead
- UNVERIFIED: later mainline follow-ups after this commit
- UNVERIFIED: independent stable@ threads besides v1/v2
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? PASS — v2 after review; logs; R-b from Luck/Xue/Ma
2. Fixes a real bug that affects users? PASS — documented SEA storm on devmem/PFNMAP
3. Important issue? PASS — hang / exception storm / possible firmware reboot
4. Small and contained? PASS — one function, ~9 lines
5. No new features or APIs? PASS
6. Can apply to the local tree? PASS — hunk present, helper present, not already applied
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: None (not a device ID/quirk/DT/build/doc exception). Qualifies as a normal important bugfix.
Step 9.4: MAKE YOUR DECISION
This should be backported to this 6.18 tree. It closes a remaining ARM64 GHES SEA loop after the task-work SIGBUS work already in 6.18, with negligible regression risk.
Verification:
- [Phase 1] Parsed tags: 3 Reviewed-by (Ma, Xue, Luck), Link msgid, Rafael SOB; no Fixes/Cc:stable/syzbot
- [Phase 2] Diff: +9/-1 in ghes_in_nmi_queue_one_entry(); -ECANCELED only if cached && is_hest_sync_notify()
- [Phase 2] Confirmed action_result(MF_RECOVERED) returns 0; memory_failure_cb skips SIGBUS; free-buddy path skips kill_accessing_process
- [Phase 2] Confirmed 79a5ae3c4c5eb force-kill is sync && !queued only, so first SEA that queues work is not covered
- [Phase 3] blame: cache skip d9f608dc156487 (2019); is_hest_sync_notify a70297d221325; both ancestors of HEAD
- [Phase 3] git merge-base --is-ancestor : a70297, c1f1fda, 79a5ae3, d9f608dc all in this tree
- [Phase 3] git log --grep='repeated SEA' on drivers/acpi/: empty — commit not here
- [Phase 4] b4 am/b4 mbox: v1 12 msgs (2025-10-30), v2 10 msgs (2026-05-27); v2 is applied version
- [Phase 4] Tony Luck questioned SDEI vs SEA callers; author said SEA- only; Luck R-b; Rafael applied as 7.3 material
- [Phase 4] lore HTTP 403; discussion taken from b4 mboxes
- [Phase 5] callers: ghes_in_nmi_spool_from_list, __ghes_sdei_callback; user path do_sea → apei_claim_sea; KVM kvm_handle_guest_sea
- [Phase 6] git describe HEAD = p-6.18-1-g03b85e06ca9bf; make kernelversion = 6.18.53
- [Phase 6] exact old hunk still in ghes.c:1373-1375; new hunk absent
- [Phase 8] Failure mode: SEA storm ~10s (log timestamps 1419 → 1429), then SIGBUS; severity HIGH/CRITICAL
- UNVERIFIED: follow-up commits after this one in later mainline; other stable@ threads
**YES**
drivers/acpi/apei/ghes.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/apei/ghes.c +9 -1
@@ -1371,8 +1371,16 @@ static int ghes_in_nmi_queue_one_entry(struct ghes *ghes,ghes_clear_estatus (ghes, &tmp_header, buf_paddr, fixmap_idx);/* This error has been reported before, don't process it again. */ -if (ghes_estatus_cached (estatus)) +if (ghes_estatus_cached (estatus)) { +/* +* Return failure on duplicate SEA entries so that the +* subsequent SEA handler invocation sends a SIGBUS signal to +* the task to prevent it from re-entering the handler loop. +*/ +if (is_hest_sync_notify (ghes)) + rc = -ECANCELED ; goto no_work; + }llist_add (&estatus_node->llnode, &ghes_estatus_llist);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: add check for xcp id
In reply to Sasha LevinFrom: Gangliang Xie <[email protected]>
[ Upstream commit fa1531170d2c96060478d697fe93f1cafc0e7ddd ]
check sel_xcp_id before its use
---
LLM Generated explanations, may be completely bogus:
Confirmed: ring->xcp_id is u32, AMDGPU_XCP_NO_PARTITION is ~0, and the same OOB pattern is what the XCP maintainer later called out in release_sched. The 6.18.53 function has no bounds check. Compiling the full analysis.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[drm/amdgpu]** **[add/check]** Add a bounds check on sel_xcp_id before using it as an index into adev->xcp_mgr->xcp[].
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Fixes:** none (expected for this review pipeline)
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by:** Lijo Lazar \<[email protected]\> (AMD XCP/partitioning reviewer; also reviewed the helper that introduced this function)
- **Acked-by:** none
- **Link:** none in the commit message
- **Cc: stable:** none (expected; not a negative signal)
- **Signed-off-by:** Gangliang Xie \<[email protected]\> (author); Alex Deucher \<[email protected]\> (amdgpu maintainer)
- Ignored pipeline tags: [Upstream commit fa1531170d2c…], `Signed-off-
by: Sasha Levin`
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug description:** sel_xcp_id is used as an array index without validation.
- **Symptom/failure mode:** not spelled out in the message (one-line
body: “check sel_xcp_id before its use”). From the code, the failure is an out-of-bounds read/write of xcp[sel_xcp_id].
- **Version information:** none in the message.
- **Root cause:** amdgpu_xcp_gpu_sched_update() indexes adev->xcp_mgr->xcp[sel_xcp_id] even when the ID is AMDGPU_XCP_NO_PARTITION (~0) or >= MAX_XCP.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Yes — this is a memory-safety fix described as “add check”. Same pattern as the author’s nearby “add buf length check” / “add first record offset check” patches, and as Lijo Lazar’s explicit “bounds check xcp_id in release_sched” (“Avoid out-of-bounds xcp[] access, e.g. when xcp_id is AMDGPU_XCP_NO_PARTITION”).
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c (+3 / −0)
- **Function:** amdgpu_xcp_gpu_sched_update()
- **Scope:** single-file surgical fix (3 lines)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record: **Before:** the function immediately does num_gpu_sched = &adev->xcp_mgr->xcp[sel_xcp_id].gpu_sched[...] and writes &ring->sched into that slot, incrementing num_scheds. **After:** if sel_xcp_id >= MAX_XCP or sel_xcp_id == AMDGPU_XCP_NO_PARTITION, it returns without touching the array. Normal path unchanged for IDs in 0 .. MAX_XCP-1.
Callers in amdgpu_xcp_sched_list_update():
1. amdgpu_xcp_gpu_sched_update(adev, ring, ring->xcp_id)
2. For shared VCN: `amdgpu_xcp_gpu_sched_update(adev, ring, ring->xcp_id
+ 1)`
amdgpu_set_xcp_id() sets ring->xcp_id = AMDGPU_XCP_NO_PARTITION first and can leave it there (CPER/early return, unsupported ring type, or no matching inst_mask).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[Memory safety / out-of-bounds]** xcp[] has MAX_XCP (8) entries. ring->xcp_id is u32; AMDGPU_XCP_NO_PARTITION is (~0) → 0xffffffff. Indexing xcp[0xffffffff] is a wild OOB read/write (store a scheduler pointer, increment num_scheds). The VCN xcp_id + 1 path can also produce 8 when xcp_id == 7. The == AMDGPU_XCP_NO_PARTITION clause is redundant for unsigned sel_xcp_id (already >= MAX_XCP) but harmless.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct 3-line guard. Skipping a ring with an invalid XCP id is the right behavior (that ring should not be on a partition sched list). Regression risk is very low: a previously valid 0..7 id is unaffected; a previously invalid id was already corrupting memory.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record: The unchecked index was introduced in **4dbc17b455329** (“drm/amdgpu: Convert update_partition_sched_list into a common helper v3”, Hawking Zhang, 2025-06-16). That commit is an ancestor of **v6.18.53**. XCP itself dates to **75d1692393cb7** (2022-09-16).
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. The buggy helper **is** in this tree (git merge-base --is-ancestor 4dbc17b455329 v6.18.53 succeeded).
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Related nearby work on the same file: 085ef38814f01 “bounds check xcp ip block index”; mailing-list sibling “bounds check xcp_id in release_sched” (Lijo Lazar) which names the same AMDGPU_XCP_NO_PARTITION OOB. This patch is standalone; it does not depend on those siblings. No follow-ups after it on this function.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Gangliang Xie is an AMD contributor sending small validation patches (add buf length check, add first record offset check, RAS checksum). Not the subsystem maintainer. Weight comes from **Reviewed-
by: Lijo Lazar** and **Signed-off-by: Alex Deucher**.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. It only uses MAX_XCP and AMDGPU_XCP_NO_PARTITION, both present in this tree (amdgpu_xcp.h). Can apply standalone; the v6.18.53 function body matches the patch parent exactly.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c fa1531170d2c96060478d697fe93f1cafc0e7ddd →
https://patch.msgid.link/[email protected]
- b4 dig -a: single **v1**, no later revisions
- Thread: author patch + **Reviewed-by: Lijo Lazar**. No NAK, no stable nomination, no crash log in the thread.
- lore.kernel.org HTTP fetch returned 403; discussion recovered via b4 dig -m mbox (2 messages).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: b4 dig -w: To [email protected], Cc [email protected]. Reviewed by Lijo Lazar (XCP reviewer). Merged by Alex Deucher.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot/bugzilla/CVE. Web search did find the maintainer stating the **same** xcp[ring->xcp_id] pattern is OOB when id is AMDGPU_XCP_NO_PARTITION (bounds check xcp_id in release_sched). That is independent confirmation of the bug class, not a user crash report for this exact function.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone v1, not a numbered series. Related OOB guards in the same file (release_sched, ip-block index) are separate and not required for this hunk to be correct.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: No stable@ discussion found for this subject. linux-next merge mail listed this commit among several amdgpu_xcp.c bounds-check fixes (conflict was in release_sched, not this function).
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
semcode MCP is not available; callers/callees traced with grep and file reads.
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: amdgpu_xcp_gpu_sched_update (modified); callers amdgpu_xcp_sched_list_update → amdgpu_xcp_update_partition_sched_list.
**Step 5.2: TRACE CALLERS**
Record:
- amdgpu_xcp_init() (partition setup / mode switch)
- amdgpu_device.c after drm_sched_init for all rings (if (adev->xcp_mgr) amdgpu_xcp_update_partition_sched_list(adev))
Only **aqua_vanjaram** calls amdgpu_xcp_mgr_init (MI300-family Instinct). Consumer GPUs have xcp_mgr == NULL and never enter this path.
amdgpu_xcp_sched_list_update skips !ring, !ring->sched.ready, and ring->no_scheduler. CPER/KIQ/MES/UMSCH set no_scheduler and are not this OOB. Rings that **are** scheduled and still have xcp_id == ~0 (unsupported type in amdgpu_set_xcp_id’s default:, or no inst_mask match) **are** the OOB path. Shared VCN uses xcp_id + 1.
**Step 5.3: TRACE CALLEES**
Record: Array access and dev_dbg only. No locks, no allocation. Failure mode is pure memory corruption.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Device init / partition switch on Instinct GPUs with XCP enabled (mode != AMDGPU_XCP_MODE_NONE; AMDGPU_XCP_MODE_NONE and AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE are both -1, so the update is skipped until a real SPX/DPX/TPX/QPX/CPX mode is set). Not a syscall-hot path; it **is** a driver-init/mode-switch path on production HPC/AI GPUs. Unprivileged users do not trigger it directly.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same unguarded xcp[ring->xcp_id] in amdgpu_xcp_release_sched() in this tree. Maintainer-authored sibling patch exists upstream. Pattern is systematic.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** Local tree is **6.18.53** (git describe HEAD → v6.18.53-5049-g0f0bdc2b0dffb; Makefile VERSION=6 PATCHLEVEL=18 SUBLEVEL=53). v6.18.53:drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c has amdgpu_xcp_gpu_sched_update **without** the sel_xcp_id check (verified via git show v6.18.53:...). Bug introduced 2025-06 (4dbc17b455329), present since this 6.18 branch.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** onto v6.18.53 — parent hunk is identical. No refactor of this function between 6.18.53 and the patch.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No other fix of this specific index in amdgpu_xcp_gpu_sched_update on v6.18.53. The release_sched OOB is still unfixed here; that does not replace this patch.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **drm/amdgpu XCP (compute partitioning).** Criticality:
**IMPORTANT** — not core mm/fs, but MI300-class Instinct GPUs in HPC/AI. Not staging.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively developed (partition sysfs, unique ids, kobject cleanup, multiple 2025–2026 XCP commits). The helper this guards has been in 6.18 for the whole stable cycle.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver/config-specific:** CONFIG_DRM_AMDGPU + aqua_vanjaram XCP (Instinct MI300 family) with partitioning actually enabled. Not universal; not consumer Radeon.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Partition sched-list rebuild during GPU init or partition-mode switch, when a ready scheduled ring still has xcp_id == ~0 or `xcp_id
+ 1 >= 8. Not an unprivileged syscall. Likelihood: uncommon if every ring matches a partition, but the sentinel AMDGPU_XCP_NO_PARTITION is an intentional valid state in amdgpu_set_xcp_id, and the VCN + 1` path is an explicit in-tree caller. Consequences if it hits are severe.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: **OOB write of a pointer + increment through that pointer.** Kernel oops / memory corruption. **Severity: HIGH** (crash/corruption; potentially worse if the write lands on live data).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** High for Instinct XCP users — prevents a wild OOB write. Zero effect on other hardware (xcp_mgr is null).
- **Risk:** Very low (3 lines, early return, no locking/API change).
- **Ratio:** Strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real OOB write: xcp[sel_xcp_id] with sel_xcp_id possibly 0xffffffff or >= 8.
- AMDGPU_XCP_NO_PARTITION is a first-class sentinel in amdgpu_set_xcp_id, then passed straight into this indexer.
- Same class of bug independently described as OOB by Lijo Lazar for release_sched.
- Buggy helper present in **this** 6.18.53 tree since 4dbc17b455329.
- 3-line, obviously correct, reviewed by XCP expert, signed off by amdgpu maintainer.
- Applies cleanly; no new API/feature; no prerequisites.
**AGAINST:**
- No user/syzbot report; commit message is one line.
- Affects only partitioned Instinct GPUs, not all amdgpu users.
- On current MI300 mappings, many rings get a valid id or no_scheduler, so the crash may be uncommon.
**UNRESOLVED:** Exact production frequency of a ready ring left at NO_PARTITION on MI300 was not reproduced on hardware (analysis is from code). That does not change the OOB if it happens.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — trivial bounds check; Reviewed-by Lijo Lazar; in mainline via Alex Deucher.
2. Fixes a real bug that affects users? **PASS** — OOB index on XCP sched-list update for Instinct partition setups.
3. Important issue (crash, security, corruption, deadlock)? **PASS** — OOB write → crash/corruption, HIGH.
4. Small and contained? **PASS** — +3 lines, one function.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — v6.18.53 has the unchecked function; hunk matches.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. It qualifies as a normal memory-safety bug fix.
**Step 9.4: MAKE YOUR DECISION**
This is a small, correct guard against a real out-of-bounds write in amdgpu XCP scheduler-list updates. The buggy code is in this 6.18.53 tree, the patch applies cleanly, and the risk of regression is negligible. It should be backported.
Verification:
- [Phase 1] Tags: Reviewed-by Lijo Lazar; SOB Alex Deucher; no Fixes/Reported-by/Cc:stable (expected).
- [Phase 1] Body is one line; bug inferred from code, not a crash log.
- [Phase 2] Diff: +3 lines in amdgpu_xcp_gpu_sched_update(); early return on sel_xcp_id >= MAX_XCP || sel_xcp_id == AMDGPU_XCP_NO_PARTITION.
- [Phase 2] MAX_XCP is 8; AMDGPU_XCP_NO_PARTITION is (~0); ring->xcp_id is u32 (amdgpu_ring.h:370).
- [Phase 3] Blame: unchecked index from 4dbc17b455329 (2025-06-16); git merge-base --is-ancestor 4dbc17b455329 v6.18.53 succeeded.
- [Phase 3] No Fixes tag; no follow-up on this function after the candidate.
- [Phase 4] b4 dig -c fa1531170d2c…: lore/msgid [email protected]; v1 only; Lijo Reviewed-by; no NAK.
- [Phase 4] lore.kernel.org WebFetch: 403; mbox via b4 dig -m used instead.
- [Phase 4] WebSearch: Lijo Lazar “bounds check xcp_id in release_sched” explicitly calls AMDGPU_XCP_NO_PARTITION an OOB xcp[] access.
- [Phase 5] Callers: amdgpu_xcp_sched_list_update ← amdgpu_xcp_update_partition_sched_list ← amdgpu_xcp_init and amdgpu_device.c post-drm_sched_init.
- [Phase 5] Only aqua_vanjaram.c calls amdgpu_xcp_mgr_init.
- [Phase 5] CPER/KIQ/MES/UMSCH use no_scheduler (verified); they are not this OOB. Default/unmatched rings and VCN xcp_id+1 are.
- [Phase 6] git describe HEAD = v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion = 6.18.53.
- [Phase 6] git show v6.18.53:drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c shows the function **without** the check.
- [Phase 6] Upstream fa1531170d2c is not an ancestor of HEAD (merge- base --is-ancestor exit 1); the 6.18.53 file contents still match the pre-fix hunk.
- [Phase 7] drm/amdgpu XCP; IMPORTANT for Instinct partition users.
- [Phase 8] Failure mode: OOB write → oops/corruption; severity HIGH; backport risk very low.
- UNVERIFIED: Hardware reproduction on MI300 of a ready ring left at NO_PARTITION; not used as the sole basis for the decision (the OOB is visible in code and the same pattern is acknowledged by the XCP reviewer).
The patch is a 3-line, obviously correct bounds check for a real out-of- bounds write in amdgpu XCP scheduler-list updates. The unchecked function exists in this 6.18.53 tree, the fix applies cleanly, and the regression risk is negligible.
**YES**
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +3 -0
@@ -572,6 +572,9 @@ static void amdgpu_xcp_gpu_sched_update(struct amdgpu_device *adev, {unsigned int *num_gpu_sched; +if (sel_xcp_id >=MAX_XCP || sel_xcp_id ==AMDGPU_XCP_NO_PARTITION ) +return ; + num_gpu_sched = &adev->xcp_mgr->xcp[sel_xcp_id] .gpu_sched[ring->funcs->type][ring->hw_prio].num_scheds; adev->xcp_mgr->xcp[sel_xcp_id].gpu_sched[ring->funcs->type][ring->hw_prio]
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 spi: nxp-fspi: disable runtime PM on probe failures
In reply to Sasha LevinFrom: Jiawen Liu <[email protected]>
[ Upstream commit 5d14285d60ba95561609a293064654a0c7d7d928 ]
nxp_fspi_probe() enables runtime PM and autosuspend before several operations that can fail.
Some failure paths returned directly before the devm cleanup action was installed, leaving runtime PM enabled.
Route those failures through a common runtime PM cleanup path. Use pm_runtime_resume_and_get() for the initial clock enable.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: the leak is in this 6.18 tree, the fix is small and self-contained, and it does not depend on later rework.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
Record: **[spi: nxp-fspi]** **[disable]** disable runtime PM on probe failures. Action is a cleanup of leftover runtime PM after nxp_fspi_probe() fails.
**Step 1.2: Tags**
Record:
- Signed-off-by: Jiawen Liu <[email protected]> (author)
- `Link: https://patch.msgid.link/tencent_8FC0B8DFAF4AE67AEBA20548045D53
[email protected]`
- Signed-off-by: Mark Brown <[email protected]> (SPI maintainer applied it)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence is expected)
- Pipeline Signed-off-by: Sasha Levin / [Upstream commit 5d14285d60ba...] ignored as candidate-prep markers
**Step 1.3: Body**
Record:
- **Bug:** nxp_fspi_probe() calls pm_runtime_enable() + autosuspend, then can fail before devm_add_action_or_reset(..., nxp_fspi_cleanup, ...).
- **Symptom:** runtime PM left enabled after a failed probe; no nxp_fspi_cleanup() to disable it.
- **Root cause:** early return on clock get/put, IRQ request, and mutex init.
- **Fix:** common err_disable_pm path; switch initial get to pm_runtime_resume_and_get().
- **Version info in message:** none.
**Step 1.4: Hidden bug fix?**
Record: Not hidden. This is an explicit probe error-path resource-leak fix.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
Record:
- File: drivers/spi/spi-nxp-fspi.c (+22 / −9)
- Function: nxp_fspi_probe() only
- Scope: single-file surgical error-path fix
**Step 2.2: Code flow**
Record (verified against parent of 03a9171de3f13):
Before:
1. pm_runtime_enable / use_autosuspend
2. pm_runtime_get_sync() — on error, **return** (RPM stays enabled; usage count stays incremented because get_sync increments even on failure)
3. pm_runtime_put_sync() — on error, **return** (RPM stays enabled)
4. devm_request_irq() — on error, **return**
5. devm_mutex_init() — on error, **return**
6. Only later devm_add_action_or_reset(..., nxp_fspi_cleanup) disables RPM
After: those four failures goto err_disable_pm, which does pm_runtime_dont_use_autosuspend() + pm_runtime_disable(). Initial get uses pm_runtime_resume_and_get() so a failed resume does **not** leave the usage count up.
devm_add_action_or_reset failure still returns directly: on add failure that helper already runs nxp_fspi_cleanup(), which disables RPM. That path is correct as-is.
**Step 2.3: Bug mechanism**
Record: **Error-path resource leak** (runtime PM left enabled; usage- count leak on failed get_sync). Also a small **correctness** change:get_sync → resume_and_get, matching the kernel header guidance that get_sync leaves the counter incremented on error.
**Step 2.4: Fix quality**
Record: Obviously correct and minimal. Regression risk is low: only probe-failure paths plus the get API swap. Remaining gaps (unchecked nxp_fspi_default_setup(), unchecked get in nxp_fspi_cleanup()) are pre-existing and not introduced here.
## Phase 3: Git history
**Step 3.1: Blame**
Record: The buggy pm_runtime_enable / get_sync / early returns come from 97be4b919a609 ("spi: spi-nxp-fspi: enable runtime pm for fspi", Haibo Chen, 2025-04-28). Present in v6.16 and in this tree. Cleanup action is 9f7cd1bcb6363 ("use devm instead of remove"), also in this tree.
**Step 3.2: Fixes: tag**
Record: No Fixes: tag. Introducer is 97be4b919a609 (verified via blame). git merge-base --is-ancestor 97be4b919a609 v6.18 succeeds.
**Step 3.3: File history**
Record: Recent work is SoC clock/DTR features, not RPM probe cleanup. No later commit on this file after the candidate. Standalone vs this file.
**Step 3.4: Author**
Record: Jiawen Liu submitted a 4-patch SPI PM error-path series (atcspi200, bcmbca-hsspi, fsl-dspi, nxp-fspi). Not the driver maintainer; NXP people (Han Xu, Haibo Chen) maintain this driver. Mark Brown applied the series.
**Step 3.5: Dependencies**
Record: Cover letter says the four patches are independent. This hunk only needs pm_runtime_enable/use_autosuspend (present) and pm_runtime_resume_and_get() (present in include/linux/pm_runtime.h). Can apply standalone. Applies cleanly to this tree’s probe function.
## Phase 4: Mailing list
**Step 4.1: Original discussion**
Record:
- b4 dig -c 5d14285d60ba95561609a293064654a0c7d7d928 → https://patch.m
sgid.link/[email protected]
- Series: [PATCH 0/4] spi: fix PM error handling in several drivers (2026-06-20), **v1 only** for this commit
- Cover letter: patches are independent; local error paths only
- Frank Li: style comment only — use PM_RUNTIME_ACQUIRE instead of goto (not a NAK of the leak fix)
- Mark Brown applied the series to for-7.3 as-is, including [4/4] as 5d14285d60ba
- sashiko-bot: this patch still leaves clocks on if put_sync fails; also flagged pre-existing default_setup / cleanup get issues. Those did **not** block merge.
**Step 4.2: Recipients (b4 dig -w)**
Record: Mark Brown, linux-spi, Han Xu, Haibo Chen, Yogesh Gaur, [email protected], linux-arm-kernel. Right maintainers were on Cc.
**Step 4.3: Bug report**
Record: No user/syzbot report. Found by code review of probe error paths.
**Step 4.4: Related series**
Record: Later [PATCH v2 0/3] spi: nxp-fspi: fix runtime PM error handling (2026-07-28) *reworks* this fix with devm_pm_runtime_enable() / PM_RUNTIME_ACQUIRE_AUTOSUSPEND(), plus default_setup and cleanup checks. That follow-up is **not** in this tree (rg found no devm_pm_runtime_enable in the driver). Haibo Chen rejected PM_RUNTIME_ACQUIRE in cleanup. The later series is extra hardening/style, not a revert of this leak fix.
**Step 4.5: Stable list**
Record: lore.kernel.org search returned 403; no stable-thread evidence obtained. UNVERIFIED whether anyone nominated this on stable@ separately.
## Phase 5: Semantic analysis
**Step 5.1: Functions**
Record: nxp_fspi_probe() only.
**Step 5.2: Callers**
Record: Platform .probe = nxp_fspi_probe in this file. Runs at device bind / deferred probe, not from a syscall hot path.
**Step 5.3: Callees**
Record: pm_runtime_resume_and_get, pm_runtime_put_sync, devm_request_irq, devm_mutex_init, pm_runtime_dont_use_autosuspend, pm_runtime_disable. Runtime resume enables clocks via nxp_fspi_clk_prep_enable().
**Step 5.4: Reachability**
Record: Yes, from device probe on CONFIG_SPI_NXP_FLEXSPI (i.MX8/i.MX9/Layerscape FlexSPI). Trigger is a **failed** probe after RPM enable (clock resume fail, put fail, IRQ request fail, mutex init fail). Not unprivileged userspace on a working board.
**Step 5.5: Similar patterns**
Record: Same author fixed other SPI PM error paths. spi-rockchip.c already has err_disable_pm_runtime. This is a known driver pattern.
## Phase 6: Local tree (this checkout)
**Step 6.1: Does the bug exist here?**
Record:
- Tree: v6.18.53-5049-g0f0bdc2b0dffb, Makefile 6.18.53, branch autosel
- Buggy sequence exists in 03a9171de3f13^ (pm_runtime_get_sync + early returns after pm_runtime_enable)
- Introduced by 97be4b919a609, ancestor of v6.18
- Driver file and RPM enablement are present
**Step 6.2: Backport difficulty**
Record: **Clean apply**. Context matches this tree (device_set_node and DTR caps are already here). pm_runtime_resume_and_get() exists.
**Step 6.3: Related fixes already here?**
Record: No other probe RPM-disable fix. Later v2 rework is not present. nxp_fspi_cleanup() still disables RPM only after successful devm_add_action_or_reset.
## Phase 7: Subsystem context
**Step 7.1:** drivers/spi/ — NXP FlexSPI (CONFIG_SPI_NXP_FLEXSPI).
Criticality: **IMPORTANT** for i.MX/Layerscape boards (often the boot/SPI-NOR controller), **PERIPHERAL** for everyone else.
**Step 7.2:** Actively maintained (clock/DTR/DLL work through 2025–2026). RPM itself is from 6.16-era, so the leak has been in 6.18 for the life of this driver feature.
## Phase 8: Impact and risk
**Step 8.1: Who is affected**
Record: Users of NXP FlexSPI (nxp,imx8mm-fspi, imx8mp, imx8ulp, imx93, imx95, lx2160a-fspi, etc.) when probe fails after RPM is enabled.
**Step 8.2: Trigger**
Record: Failed probe after pm_runtime_enable(). Not every boot. Clock resume failure is the important case: old get_sync leaves `usage_count
Quoted 1 line
0
and RPM enabled, so a later bind hitspm_runtime_enable()` on an
already-enabled device (WARN). IRQ/mutex failures after a successful put leave RPM enabled on an unbound device.
Cannot be triggered by an unprivileged user on a healthy probe path.
**Step 8.3: Failure mode**
Record:
- Runtime PM enabled after failed bind
- Failed get_sync: usage-count leak, device stuck “active”
- Re-probe: pm_runtime_enable() WARN
- Autosuspend still armed if put succeeded before a later failure
Severity: **MEDIUM** (probe error path, not a success-path crash/corruption). Still a real leak/WARN class that stable regularly takes.
**Step 8.4: Risk-benefit**
Record:
- **Benefit:** Medium for i.MX/Layerscape; stops leftover RPM state and usage-count leak on failed probe.
- **Risk:** Low (~20 lines, error path only, recommended PM helper).
- Ratio supports backport.
## Phase 9: Synthesis
**Step 9.1: Evidence**
FOR:
- Real probe error-path leak: RPM enabled before nxp_fspi_cleanup is installed
- pm_runtime_get_sync() on failure leaks the usage count; resume_and_get + disable is the right fix
- Small, obviously correct, no new API
- Bug present since RPM was added (97be4b919a609), which is in this 6.18 tree
- SPI maintainer applied it; cover letter says the series is independent
- Driver is used on common NXP boards
AGAINST:
- No crash/syzbot/user report; probe-failure only
- Incomplete vs later review (ignored nxp_fspi_default_setup(), cleanup get)
- Frank Li preferred helpers over goto (style; not a functional NAK)
UNRESOLVED:
- Could not fetch lore.kernel.org (403); discussion recovered via b4 dig -m and lkml.iu.edu
- No stable@ thread found
**Step 9.2: Stable rules**
1. Obviously correct and tested? **PASS** — maintainer applied; logic matches PM docs
2. Real user-visible bug? **PASS** — leftover RPM / usage-count leak / re-probe WARN
3. Important? **PASS** — resource leak that can WARN and leave PM state wrong; not a success-path panic, but standard driver-core leak
4. Small and contained? **PASS** — one function, +22/−9
5. No new features/APIs? **PASS**
6. Applies to this tree? **PASS** — buggy code and helpers are here
**Step 9.3: Exception category**
Record: Not a device-ID/quirk/DT/build/docs exception. Ordinary error- path leak fix.
**Step 9.4: Decision**
This 6.18 tree has the leak. The patch is a small, correct disable of runtime PM on probe failures, with the right resume_and_get pairing. Later optional rework is not a reason to skip this.
### What it solves for stable users
On NXP FlexSPI, probe currently enables runtime PM, then can return on clock/IRQ/mutex failure before the devm cleanup action. That leaves RPM enabled (and, with get_sync, an elevated usage count). A later bind can WARN. The patch disables RPM on those paths.
### Risk vs benefit
Low risk, clear benefit on a widely used embedded SPI-NOR controller. No prerequisites beyond code already in 6.18.
---
Verification:
- [Phase 1] Parsed tags: author Jiawen Liu, Link msgid, SOB Mark Brown; no Fixes/Reported-by/Cc stable
- [Phase 2] Diff: nxp_fspi_probe() +22/−9; four early returns → err_disable_pm; get_sync → resume_and_get
- [Phase 2] Confirmed pm_runtime_get_sync increments usage even on error (include/linux/pm_runtime.h); resume_and_get does not
- [Phase 3] git describe HEAD / make kernelversion: **6.18.53**, branch autosel
- [Phase 3] git blame on parent: leak from 97be4b919a609 (2025-04-28)
- [Phase 3] git merge-base --is-ancestor 97be4b919a609 v6.18: yes (also in v6.16)
- [Phase 3] Parent probe still has get_sync + bare returns after pm_runtime_enable
- [Phase 4] b4 dig -c 5d14285d60ba: PATCH 4/4, lore msgid above
- [Phase 4] b4 dig -a: v1 only for this commit
- [Phase 4] b4 dig -w: Mark Brown, Han Xu, Haibo Chen, linux-spi, imx list
- [Phase 4] mbox: Frank Li style comment; Mark Brown applied 4/4 to for-7.3; cover letter says independent
- [Phase 4] Later v2 rework (Jul 2026) not in this tree
- [Phase 5] Probe is platform .probe; Kconfig SPI_NXP_FLEXSPI for i.MX/Layerscape
- [Phase 6] pm_runtime_resume_and_get exists; patch context matches local probe
- [Phase 8] Failure mode: RPM leak / usage-count leak / re-probe WARN, not a hot-path oops
- UNVERIFIED: lore.kernel.org HTTP 403; no dedicated stable@ discussion found
**YES**
drivers/spi/spi-nxp-fspi.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/spi/spi-nxp-fspi.c +22 -9
@@ -1426,9 +1426,11 @@ static int nxp_fspi_probe(struct platform_device *pdev)pm_runtime_use_autosuspend (dev);/* enable clock */ - ret =pm_runtime_get_sync (f->dev); -if (ret <0 ) -return dev_err_probe (dev, ret,"Failed to enable clock" ); + ret =pm_runtime_resume_and_get (f->dev); +if (ret <0 ) { + ret =dev_err_probe (dev, ret,"Failed to enable clock" ); + goto err_disable_pm; + }/* Clear potential interrupts */ reg =fspi_readl (f, f->iobase +FSPI_INTR );
@@ -1438,18 +1440,24 @@ static int nxp_fspi_probe(struct platform_device *pdev)nxp_fspi_default_setup (f); ret =pm_runtime_put_sync (dev); -if (ret <0 ) -return dev_err_probe (dev, ret,"Failed to disable clock" ); +if (ret <0 ) { + ret =dev_err_probe (dev, ret,"Failed to disable clock" ); + goto err_disable_pm; + }init_completion (&f->c); ret =devm_request_irq (dev, irq, nxp_fspi_irq_handler,0 , pdev->name, f); -if (ret) -return dev_err_probe (dev, ret,"Failed to request irq\n" ); +if (ret) { + ret =dev_err_probe (dev, ret,"Failed to request irq\n" ); + goto err_disable_pm; + } ret =devm_mutex_init (dev, &f->lock); -if (ret) -return dev_err_probe (dev, ret,"Failed to initialize lock\n" ); +if (ret) { + ret =dev_err_probe (dev, ret,"Failed to initialize lock\n" ); + goto err_disable_pm; + } ctlr->bus_num =-1 ; ctlr->num_chipselect =NXP_FSPI_MAX_CHIPSELECT ;
@@ -1467,6 +1475,11 @@ static int nxp_fspi_probe(struct platform_device *pdev)return ret;return devm_spi_register_controller (&pdev->dev, ctlr); + +err_disable_pm: +pm_runtime_dont_use_autosuspend (dev); +pm_runtime_disable (dev); +return ret; }static int nxp_fspi_runtime_suspend (struct device *dev)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 vdpa: octeon_ep: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 346da62d9f9ccca81cf279c361137d1fe2fe0c7f ]
The driver has a match table for the pci bus wired into its driver structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the driver registration structure, and the missing module alias publication.
Message-ID: <[email protected]>
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.12.111** (pending-6.12). The one-line MODULE_DEVICE_TABLE() addition belongs here: the Octeon vDPA PCI IDs already exist, but they are not published for autoload.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[vdpa/octeon_ep] [add] [export the existing PCI match table via MODULE_DEVICE_TABLE so userspace can autoload the module]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Verified from mainline 346da62d9f9cc (git log -1 --format=fuller):
- Signed-off-by: Pengpeng Hou <[email protected]> (author)
- Signed-off-by: Michael S. Tsirkin <[email protected]> (virtio/vDPA maintainer; applied the patch)
- Message-ID: <[email protected]>
No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Link:, or Cc: stable. Absence of Fixes: / Cc: stable is expected for this review and is not a negative.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** octep_pci_vdpa_map[] is wired to octep_pci_vdpa.id_table, but is not exported with MODULE_DEVICE_TABLE().
- **Symptom:** depmod/modpost do not emit pci:v0000177Dd0000... aliases, so udev/kmod will not autoload octep_vdpa when the Cavium/Marvell DPU appears.
- **Version info:** none in the message. Driver introduced in this tree by 8b6c724cdab85 (in v6.11; present in v6.12).
- **Root cause:** missing module-alias publication, not a runtime logic error.
The “source-level fix / no dynamic hardware reproduction” paragraph is in the original lore submission (not a stable-prep marker). MST asked what it meant, then applied the patch unchanged.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not disguised.** It is an explicit autoload/hardware-binding fix, same class as adding PCI IDs.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/vdpa/octeon_ep/octep_vdpa_main.c (**+1 / -0**)
- Function/object: octep_pci_vdpa_map[] (table definition; no function body change)
- Scope: **single-file surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** PCI IDs exist and are used for bind **if the module is already loaded**. No MODULE_DEVICE_TABLE, so no modules.alias entries.
- **After:** Same IDs plus MODULE_DEVICE_TABLE(pci, octep_pci_vdpa_map), which creates the __mod_pci__octep_pci_vdpa_map_device_table alias consumed by scripts/mod/file2alias.c (do_pci_entry()).
- Path: **module build / autoload**, not probe/error/init runtime logic.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[Hardware enablement / missing device-ID publication]**
Mechanism: MODULE_DEVICE_TABLE is empty when !MODULE (include/linux/module.h). This driver is **module-only** (depends on m), so the missing export is always the live path. Sibling vDPA PCI drivers already have it (ifcvf_main.c, snet_main.c).
**Step 2.4: ASSESS THE FIX QUALITY**
Record: **Obviously correct, one standard line, no API/locking/refcount change.** Regression risk is **very low**. MST applied it to mainline.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: Table and pci_driver come from **8b6c724cdab85** (`virtio:
vdpa: vDPA driver for Marvell OCTEON DPU devices, Srujana Challa, 2024-06-14; committed 2024-07-09). **Never had MODULE_DEVICE_TABLE`.** Present since v6.11.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Buggy omission is the original driver commit above. git merge-base --is-ancestor 8b6c724cdab85 HEAD → **yes**.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES** Record (this tree, -- drivers/vdpa/octeon_ep/octep_vdpa_main.c):
- b3175ec5209b8 mailbox signature
- 6e950ebc7da41 PF→VF mailbox address
- f655550322469 SR-IOV refcount leak
- 8b6c724cdab85 driver introduction
No later commit in this tree adds MODULE_DEVICE_TABLE. Standalone; not patch X/Y.
**Step 3.4: CHECK THE AUTHOR’S OTHER COMMITS**
Record: Pengpeng Hou submitted a July 2026 batch of the same one-line fix. Same pattern already **in this 6.12 tree**: 877e99535dfb9 `can:
ctucanfd: add missing MODULE_DEVICE_TABLE() (upstream d937bdb244a75, with Cc: stable). Mainline also has 7eeda5e248727` `vdpa: alibaba:
add missing MODULE_DEVICE_TABLE()`. Author is not the vDPA maintainer; MST took the octeon_ep patch.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: **None.** Uses existing table name and MODULE_DEVICE_TABLE(). git show 346da62d9f9cc | git apply --check → **CLEAN APPLY**. Later mainline commits (3e4cddec63db5, 6519ca235131c) do not touch this site.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 346da62d9f9cc →
https://patch.msgid.link/[email protected]
- b4 dig -a: **v1 only** (2026-07-05)
- Thread: author patch + MST reply (“what does this paragraph mean?” about the source-level boilerplate). **No NAK, no stable request, no risk flags.** Applied 2026-08-19.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc included Marvell reviewers [email protected], [email protected]; MST; Jason Wang; Xuan Zhuo; Eugenio Pérez; [email protected]. **Subsystem maintainer applied it.**
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: **No user/syzbot/bugzilla report.** Evidence is the match table vs missing export. Same class as PCI ID additions.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Same-day one-line series (cadence PCI, tegra CEC, ixp4xx, most_usb, imx8qxp, ctucanfd, alibaba vdpa, this driver). Each is self- contained.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: No octeon_ep-specific stable-list hit for this subject. Lore HTTP fetch returned 403; search did not show a prior reject. Related ctucanfd patch **did** go to this 6.12 tree with Cc: stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: No function body change. Objects: octep_pci_vdpa_map, octep_pci_vdpa, octep_vdpa_probe.
**Step 5.2: TRACE CALLERS**
Record: octep_vdpa_probe is only the PCI .probe callback (module_pci_driver). Invoked by PCI core on match **after** the module is loaded. Callers of the *new* macro are modpost/file2alias.c at build time.
**Step 5.3: TRACE CALLEES**
Record: Probe dispatches to octep_vdpa_probe_vf / octep_vdpa_probe_pf. Unchanged.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: PCI enumeration of Cavium IDs 0xb900/0xb903/0xba00/0xba03/0xbd00/0xbd03 (PCI_VENDOR_ID_CAVIUM 0x177d). Userspace-visible via hotplug/boot. Autoload is the intended udev path. Manual modprobe octep_vdpa still works without the patch.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: In-tree vDPA PCI drivers already export tables (ifcvf, snet). This driver was the outlier.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** drivers/vdpa/octeon_ep/octep_vdpa_main.c:841-857 has the table and .id_table and **no** MODULE_DEVICE_TABLE. Introduced **v6.11**, present in this **6.12.111** checkout. git merge-base --is- ancestor 346da62d9f9cc HEAD → **not in HEAD**.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Surrounding lines match. No refactor of the table.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: **No.** git log --grep=MODULE_DEVICE_TABLE -- drivers/vdpa/ is empty. Same-class ctucanfd fix is already in this tree, which shows the pattern is accepted here.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **[drivers/vdpa/octeon_ep — Marvell Octeon DPU vDPA] [PERIPHERAL / IMPORTANT for that hardware]**
Not core mm/VFS. Real PCI devices; Kconfig is supported (MAINTAINERS:
MARVELL OCTEON ENDPOINT VIRTIO DATA PATH ACCELERATOR).
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Driver is young (2024) but present for the life of 6.12. Modest churn; mailbox/SR-IOV fixes already in this tree.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver-/hardware-specific** — hosts with Marvell/Cavium CN10x DPU vDPA (CONFIG_OCTEONEP_VDPA=m). Not universal.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Trigger is **every boot/hotplug** of those PCI devices if the module is not preloaded. Unprivileged users do not trigger a crash; they just get a **non-bound device**. Kconfig depends on m means there is **no built-in fallback**.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: **Failure mode: module does not autoload; vDPA offload does not come up until manual modprobe.** **Severity: MEDIUM** (hardware non- function, not oops/corruption). Same user-visible class as missing PCI IDs.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** medium for Octeon DPU users (driver actually attaches on device appearance).
- **Risk:** very low (one MODULE_DEVICE_TABLE line, no runtime change).
- **Ratio:** **favorable.** Official rule: *“It must either fix a real bug that bothers people or just add a device ID.”*
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real autoload bug: IDs exist, aliases are not generated.
- Module-only driver (depends on m) — autoload is the normal load path.
- +1 line, standard macro, clean apply on 6.12.111.
- Same omission since driver introduction (in this tree).
- Sibling vDPA PCI drivers already export tables.
- Virtio maintainer applied it upstream.
- Same-class patch already in this 6.12 tree (can: ctucanfd).
- Matches the documented device-ID exception.
**AGAINST:**
- Not a crash/UAF/security issue.
- Niche DPU hardware; no distro bug report.
- Manual modprobe is a workaround.
- Kconfig notes firmware/emulation must be running first (PCI presence still implies the device is enumerable).
**UNRESOLVED:** Direct lore.kernel.org HTTP was 403; thread recovered via b4 dig mbox. No stable-list discussion found.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — one-line, maintainer- applied.
2. Fixes a real bug that affects users? **PASS** — broken autoload for existing PCI IDs.
3. Important issue? **PASS** under the **device-ID / hardware- enablement** exception (not a crash).
4. Small and contained? **PASS** — +1 line, one file.
5. No new features or APIs? **PASS** — publishes IDs the driver already matches.
6. Can apply to the local tree? **PASS** — buggy code present; git apply --check clean.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **Device ID / module-alias publication for an existing driver** (stable-rules “or just add a device ID”).
**Step 9.4: MAKE YOUR DECISION**
Backport. The local 6.12 tree has the driver without aliases; the fix is the documented, low-risk hardware-enablement class.
---
### What the commit solves for this tree
On 6.12, octep_vdpa can bind only if something already loaded it. The PCI table is complete; MODULE_DEVICE_TABLE is missing, so udev never loads octep_vdpa for CN103K/CN105K/CN106K PF/VF IDs. Adding the macro generates aliases at module build time and does not change probe logic.
### Risk vs benefit
Benefit is that those DPUs attach on boot/hotplug. Risk is negligible. This is the same pattern already taken for ctucanfd in this tree.
### Concerns
None that block backport: no prerequisites, no conflicts, no new API. No Fixes:/Cc: stable on the original, which is why it needs this review.
---
### Verification
- **[Phase 1]** git log -1 --format=fuller 346da62d9f9cc: SOB Pengpeng Hou + MST; Message-ID as given; no Fixes/Cc stable/Reported-by.
- **[Phase 1]** git describe HEAD / make kernelversion / Makefile:
**pending-6.12, 6.12.111**.
- **[Phase 2]** Diff is +1 MODULE_DEVICE_TABLE(pci, octep_pci_vdpa_map) after the ID table.
- **[Phase 2]** include/linux/module.h:251-256: macro emits the alias only for MODULE.
- **[Phase 2]** scripts/mod/file2alias.c:441-459: do_pci_entry() builds pci:vNdN... aliases.
- **[Phase 2]** drivers/vdpa/Kconfig:133-142: OCTEONEP_VDPA is tristate **depends on m**.
- **[Phase 3]** git blame -L 841,863: table from 8b6c724cdab85; never had MODULE_DEVICE_TABLE.
- **[Phase 3]** git merge-base --is-ancestor 8b6c724cdab85 HEAD → yes; vs v6.11 and v6.12 → in both.
- **[Phase 3]** git merge-base --is-ancestor 346da62d9f9cc HEAD → **not in this tree**.
- **[Phase 3]** git log --oneline -20 -- drivers/vdpa/octeon_ep/octep_vdpa_main.c: four commits; none add the macro.
- **[Phase 3]** git show 346da62d9f9cc | git apply --check → **CLEAN APPLY**.
- **[Phase 3]** 877e99535dfb9 in this tree: same-author MODULE_DEVICE_TABLE pattern already backported.
- **[Phase 4]** b4 dig -c 346da62d9f9cc: lore URL; v1 only; recipients include MST and Marvell; MST question only, then apply.
- **[Phase 4]** /tmp/octep_mdt.mbox: 2 messages; no NAK.
- **[Phase 4]** lore.kernel.org/stable search: no octeon_ep discussion found (lore HTTP 403 on direct fetch).
- **[Phase 5]** grep octep_vdpa_probe: only PCI .probe in this file.
- **[Phase 5]** ifcvf/snet already have MODULE_DEVICE_TABLE(pci, ...).
- **[Phase 6]** Current file lines 841–863: table + driver, **no** MODULE_DEVICE_TABLE.
- **[Phase 6]** Later origin/master commits do not touch this hunk.
- **[Phase 7]** MAINTAINERS: drivers/vdpa/octeon_ep/ listed; reviewers schalla/vattunuru.
- **[Phase 8]** IDs in octep_vdpa.h:
0xb900/0xb903/0xba00/0xba03/0xbd00/0xbd03; vendor PCI_VENDOR_ID_CAVIUM 0x177d.
- **[Phase 9]** Documentation/process/stable-kernel-rules.rst:15: “fix a real bug … **or just add a device ID**”.
- **UNVERIFIED:** Live udev/hardware reproduction (author did not claim it; source-level evidence is sufficient). Direct lore.kernel.org page fetch (403); thread recovered via b4.
**YES**
drivers/vdpa/octeon_ep/octep_vdpa_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/vdpa/octeon_ep/octep_vdpa_main.c +1 -0
@@ -898,6 +898,7 @@ static struct pci_device_id octep_pci_vdpa_map[] = { { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_VDPA_DEVID_CN103K_VF) }, { 0 }, }; +MODULE_DEVICE_TABLE (pci, octep_pci_vdpa_map);static struct pci_driver octep_pci_vdpa = { .name = OCTEP_VDPA_DRIVER_NAME,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.12] vdpa: octeon_ep: add missing MODULE_DEVICE_TABLE()
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] vdpa: octeon_ep: MODULE_DEVICE_TABLE() conflicts with octeon_ep and Kconfig --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vdpa: octeon_ep: MODULE_DEVICE_TABLE() conflicts with octeon_ep and Kconfig --
commit 2202a6588d5755d6dbbded2b962a2580a97810a5
Author: Pengpeng Hou <[email protected]>
vdpa: octeon_ep: add missing MODULE_DEVICE_TABLE()
This commit adds a MODULE_DEVICE_TABLE(pci, octep_pci_vdpa_map) entry to drivers/vdpa/octeon_ep/octep_vdpa_main.c to generate PCI module aliases for automatic module loading.
drivers/vdpa/octeon_ep/octep_vdpa_main.c static struct pci_device_id octep_pci_vdpa_map[] = { · line 886
Quoted 9 lines
drivers/vdpa/octeon_ep/octep_vdpa_main.c +1
-0@@ -883,6 +883,7 @@ static struct pci_device_id octep_pci_vdpa_map[] = { { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_VDPA_DEVID_CN103K_VF) }, { 0 }, }; +MODULE_DEVICE_TABLE (pci, octep_pci_vdpa_map);
[Severity: High]
Was MODULE_DEVICE_TABLE(pci, octep_pci_vdpa_map) intentionally omitted here?
In drivers/vdpa/Kconfig, config OCTEONEP_VDPA specifies:
config OCTEONEP_VDPA
tristate "vDPA driver for Octeon DPU devices"
depends on m
depends on PCI_MSI
help
This is a vDPA driver designed for Marvell's Octeon DPU devices. This driver enables the offloading of the VirtIO dataplane to an Octeon DPU device.
Please note that this driver must be built as a module and it cannot be loaded until the Octeon emulation software is running.
Exporting octep_pci_vdpa_map via MODULE_DEVICE_TABLE() causes udev/kmod to autoload octep_vdpa during boot or PCI enumeration before the Octeon emulation software is running. If OCTEP_EPF_RINFO(0) is 0 because the emulation software has not initialized the rings yet, octep_vdpa_probe() -> octep_vdpa_probe_pf() -> octep_vdpa_pf_setup() fails with -EINVAL:
drivers/vdpa/octeon_ep/octep_vdpa_main.c:octep_vdpa_pf_setup() {
...
addr = octpf->base[OCTEP_HW_MBOX_BAR];
val = readq(addr + OCTEP_EPF_RINFO(0));
if (val == 0) {
dev_err(&pdev->dev, "Invalid device configuration\n");
return -EINVAL;
}
...
}In addition, all six PCI device IDs in octep_pci_vdpa_map (0x177d:0xb900, 0xb903, 0xba00, 0xba03, 0xbd00, and 0xbd03 with PCI_ANY_ID for subvendor, subdevice, and class) are identical to the PCI device IDs already exported via MODULE_DEVICE_TABLE() by the in-tree Ethernet PF and VF drivers:
drivers/net/ethernet/marvell/octeon_ep/octep_main.c:
static const struct pci_device_id octep_pci_id_tbl[] = {
...
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KA_PF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF10KA_PF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF10KB_PF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KB_PF)},
{0, },
};MODULE_DEVICE_TABLE(pci, octep_pci_id_tbl);
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c:
static const struct pci_device_id octep_vf_pci_id_tbl[] = {
...
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KA_VF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF10KA_VF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF10KB_VF)},
{PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KB_VF)},
{0, },
};MODULE_DEVICE_TABLE(pci, octep_vf_pci_id_tbl);
Neither octep_vdpa_probe_pf() nor octep_vdpa_probe_vf() checks whether the device is running vDPA firmware rather than standard NIC firmware before claiming the PCI device. In octep_vdpa_pf_setup(), OCTEP_EPF_RINFO(0) is also non-zero in standard NIC mode, causing it to shrink BAR 4 via octep_vdpa_pf_bar_shrink() and succeed, while octep_vdpa_probe_vf() queues octep_vdpa_setup_task and returns 0 unconditionally:
drivers/vdpa/octeon_ep/octep_vdpa_main.c:octep_vdpa_probe_vf() {
...
INIT_WORK(&mgmt_dev->setup_task, octep_vdpa_setup_task);
schedule_work(&mgmt_dev->setup_task);
dev_info(&pdev->dev, "octep vdpa mgmt device setup task is queued\n");
return 0;
}Could publishing MODULE_DEVICE_TABLE(pci, octep_pci_vdpa_map) cause octep_vdpa to autoload prematurely and race with octeon_ep and octeon_ep_vf to claim standard NIC PF and VF devices?
Quoted 3 lines
drivers/vdpa/octeon_ep/octep_vdpa_main.c +0
-0static struct pci_driver octep_pci_vdpa = { .name =OCTEP_VDPA_DRIVER_NAME ,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit cd21fdcbef3fb32136f72075ab668b075423b3f6 ]
The driver has a match table for the of bus wired into its driver structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the driver registration structure, and the missing module alias publication.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject**
Record: **[clk/imx]** **[add]** missing MODULE_DEVICE_TABLE() so the i.MX8QXP SCU clock driver’s OF match table is exported as module aliases.
**Step 1.2 — Tags**
Record:
- Reviewed-by: Brian Masney <[email protected]>
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Pengpeng Hou <[email protected]> (author)
- Signed-off-by: Abel Vesa <[email protected]> (clk/imx maintainer)
- No Fixes:, Reported-by:, Tested-by:, Acked-by:, or `Cc:
stable` (absence of the last two is expected for this review)
**Step 1.3 — Body**
Record: The driver already has imx8qxp_match[] wired as of_match_table, but it never called MODULE_DEVICE_TABLE(of, …). Without that, modpost/file2alias does not emit of:N*T*C… aliases, so udev/modprobe/initramfs tools cannot autoload clk-imx-scu from DT compatible strings. Failure mode: modular CONFIG_CLK_IMX8QXP=m does not bind on fsl,scu-clk / fsl,imx8qxp-clk / fsl,imx8qm-clk / fsl,imx8dxl-clk. The author presents this as a source-level correctness fix, not a live hardware repro. No version range is given.
**Step 1.4 — Hidden bug fix?**
Record: Not disguised. It is an explicit completeness fix for module alias publication. That is a real functional bug for =m builds, not style cleanup.
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record: One file, drivers/clk/imx/clk-imx8qxp.c, **+1 / -0**. One insertion after imx8qxp_match[]. Surgical single-file change.
**Step 2.2 — Code flow**
Record: **Before:** imx8qxp_match[] is only referenced by imx8qxp_clk_driver.driver.of_match_table (bind-time matching if the module is already loaded). **After:** the same table is also aliased for modpost (__mod_device_table__kmod_*__of__imx8qxp_match), which produces OF module aliases. No probe, init, or error-path logic changes.
**Step 2.3 — Bug mechanism**
Record: **Hardware/module-autoload omission** (same class as missing device IDs). The OF table existed; aliases were not published. MODULE_DEVICE_TABLE is the required export so scripts/mod/file2alias.c do_of_entry() can emit aliases.
**Step 2.4 — Fix quality**
Record: Obviously correct: same pattern as clk-imx8mm.c (MODULE_DEVICE_TABLE(of, imx8mm_clk_of_match)) and the sibling LPCG driver. Minimal, no API/data-structure change. Regression risk is essentially none: for =y the extra alias symbol is unused at runtime; for =m it only adds modules.alias entries.
---
## Phase 3: Git history
**Step 3.1 — Blame**
Record: Match table introduced in c2cccb6d0b33b (2018, original driver). Modular build introduced in e0d0d4d86c766 (“Support building i.MX8QXP clock driver as module”, 2020-08-22, first in **v5.9**). That is when MODULE_DEVICE_TABLE became necessary and was omitted. Bug is long-standing, not recent.
**Step 3.2 — Fixes: tag**
Record: None. The introducing commit is e0d0d4d86c766; it is an ancestor of this HEAD.
**Step 3.3 — File history**
Record: Immediate neighbor e89485455ac49 (clk: imx: imx8qxp-lpcg: add missing MODULE_DEVICE_TABLE()) is the same author/pattern on the LPCG sibling. Independent 1-line fix; this patch does not depend on it. Other recent file history (aadb7d1f2ca0f softdep on scu_pd) is unrelated.
**Step 3.4 — Author**
Record: Pengpeng Hou submitted a cluster of clk MODULE_DEVICE_TABLE additions (imx8qxp, imx8qxp-lpcg, mediatek mt6735). Not the clk/imx maintainer. Maintainer Abel Vesa applied it; Brian Masney reviewed.
**Step 3.5 — Dependencies**
Record: None. Needs only imx8qxp_match[] and MODULE_DEVICE_TABLE from <linux/module.h>, both present. Standalone.
---
## Phase 4: Mailing list / external research
**Step 4.1 — Original discussion**
Record: b4 dig -c cd21fdcbef3fb →
https://patch.msgid.link/[email protected]b4 dig -a: single **v1**, no later revisions.
Thread (gnuweeb mirror; lore.kernel.org returned 403): Brian Masney Reviewed-by; Abel Vesa “Applied, thanks!” as cd21fdcbef3fb. No NAK, no stable nomination, no risk flags.
**Step 4.2 — Recipients (b4 dig -w)**
Record: Abel Vesa, Peng Fan, Stephen Boyd, Michael Turquette, Frank Li, Sascha Hauer, Fabio Estevam, linux-clk, [email protected], linux-arm- kernel. Correct maintainers and lists.
**Step 4.3 — Bug report**
Record: No Reported-by / syzbot / bugzilla. Evidence is the match table vs missing export. Pull text for clk-imx 7.3 lists “Add missing MODULE_DEVICE_TABLE() declarations for i.MX8QXP clock drivers.”
**Step 4.4 — Series**
Record: Standalone [PATCH], not N/M. Sibling LPCG patch is parallel and not a prerequisite.
**Step 4.5 — Stable list**
Record: gnuweeb /stable/?q=imx8qxp+MODULE_DEVICE_TABLE did not show a dedicated discussion of this patch (hits were unrelated imx8 noise). lore.kernel.org/stable returned 403.
---
## Phase 5: Code semantics
**Step 5.1 — Functions**
Record: No function body changed. Data: imx8qxp_match[]. Related:imx8qxp_clk_driver, imx8qxp_clk_init(), imx8qxp_clk_probe().
**Step 5.2 — Callers**
Record: imx8qxp_clk_init() (module_init) → platform_driver_register(&imx8qxp_clk_driver). Probe runs when OF compatible matches. Autoload is what was broken: without aliases the module may never load, so probe never runs.
**Step 5.3 — Callees**
Record: Probe calls imx_clk_scu_init(), many imx_clk_scu/imx_clk_scu2, of_clk_add_hw_provider(). Unchanged.
**Step 5.4 — Reachability**
Record: Userspace-reachable only in the sense that missing aliases prevent the module from being requested. Affects i.MX8QXP/QM/DXL boards with CONFIG_CLK_IMX8QXP=m. DT compatibles: fsl,scu-clk, fsl,imx8dxl-clk, fsl,imx8qxp-clk, fsl,imx8qm-clk.
**Step 5.5 — Similar patterns**
Record: Other imx clk files already had MODULE_DEVICE_TABLE(of, …) (clk-imx8mm.c, clk-imx8mn.c, clk-imx8mp.c, clk-imx8mq.c, clk- imx8-acm.c, etc.). This file was the omission.
---
## Phase 6: Local tree
**Step 6.1 — Does the buggy code exist here?**
Record: Local tree is **v7.3-rc4** (git describe = v7.3-rc4-27-gf0100363d8c37, VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4). CLK_IMX8QXP is **tristate**. File has imx8qxp_match[], module_init/module_exit, and (after this commit) MODULE_DEVICE_TABLE. The omission existed from v5.9 until this 7.3-era commit. git merge-base --is-ancestor cd21fdcbef3fb HEAD is true — the fix is already in this checkout; the underlying driver and match table are present.
**Step 6.2 — Backport difficulty**
Record: Clean apply: one line after the sentinel of imx8qxp_match[]. No refactor of that region.
**Step 6.3 — Related fixes already here?**
Record: Sibling LPCG table already has MODULE_DEVICE_TABLE. No earlier equivalent for clk-imx8qxp.c. No competing fix.
---
## Phase 7: Subsystem / maintainer
**Step 7.1**
Record: **clk / i.MX SoC clocks**. **IMPORTANT** for i.MX8QXP/QM/DXL (clock provider for the SoC), not core mm/vfs. Peripheral relative to the whole kernel, critical on those boards.
**Step 7.2**
Record: Actively maintained (clk-imx-7.3 pull by Abel Vesa). The missing alias is old; the rest of the file is mature.
---
## Phase 8: Impact and risk
**Step 8.1 — Who is affected**
Record: **Platform/config-specific**: NXP i.MX8QXP/QM/DXL with CONFIG_CLK_IMX8QXP=m. Built-in (=y) is unchanged.
**Step 8.2 — Trigger**
Record: Modular kernel + DT node with those compatibles + autoload via aliases (udev, request_module, dracut/mkinitramfs). Common for distro =m configs. Unprivileged users do not trigger it; boot/device-probe does.
**Step 8.3 — Failure mode**
Record: Module never autoloads → SCU clocks never register → consumers fail to probe (UART, net, display, etc.). **MEDIUM–HIGH** on affected boards; not a panic/UAF. For =y, **no effect**.
**Step 8.4 — Risk vs benefit**
Record: **Benefit:** restores documented autoload for a supported tristate clock driver. **Risk:** very low (1 line, no runtime path). Ratio is strongly favorable.
---
## Phase 9: Synthesis
**Step 9.1 — Evidence**
FOR:
- Real bug: OF match table not exported; aliases missing for a tristate driver with module_init.
- Same pattern already used throughout drivers/clk/imx/.
- 1-line, obviously correct; maintainer applied; Reviewed-by Brian Masney.
- Zero runtime change when built-in.
- Analogous to device-ID additions (exception category: make existing hardware/driver work).
- Bug present since v5.9 modular support (e0d0d4d86c766).
- Applies cleanly to this tree’s imx8qxp_match[].
AGAINST:
- No crash/syzbot/user report; source-level only.
- Impact limited to CLK_IMX8QXP=m (many images use =y).
- Not a security/UAF/deadlock class bug.
UNRESOLVED:
- Could not fetch lore.kernel.org (403); used b4 + gnuweeb/LKML mirrors instead.
- No dedicated stable-list thread found.
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — 1-line standard macro; reviewed and applied by clk/imx.
2. Real bug affecting users? **PASS** — =m autoload/initramfs alias generation is broken without it.
3. Important? **PASS** — SoC clock provider failing to load breaks the platform; severity is functional, not panic, but that is enough for this class of fix.
4. Small and contained? **PASS** — +1 line, one file.
5. No new features/APIs? **PASS** — publishes existing table.
6. Can apply to this tree? **PASS** — match table, linux/module.h, and modular Kconfig are all here.
**Step 9.3 — Exception category**
Record: Closest match is **device-ID / module-alias enablement** for an existing driver (not a new driver).
**Step 9.4 — Decision**
This tree is mainline **7.3-rc4**. The driver, OF table, and tristate module support are here; the fix is a one-line alias export with no runtime risk. That meets stable criteria for this checkout.
---
### Problem and why it mattersclk-imx8qxp.c can be =m since v5.9 and already matches DT via imx8qxp_match[], but never published that table with MODULE_DEVICE_TABLE(). Users with modular i.MX8QXP/QM/DXL kernels do not get of: aliases, so the clock module may not autoload and consumers never get clocks.
### Stable rules
Small, obviously correct, no new API, real autoload bug, applies to this tree.
### Risk vs benefit
Benefit is correct module loading on a supported config; risk is negligible.
### Concerns
No hardware repro and no Fixes: tag; neither blocks this pattern. Sibling LPCG patch is independent.
---
Verification:
- [Phase 1] Parsed tags: Reviewed-by Brian Masney; Link patch.msgid.link/[email protected]; SOBs Hou and Abel Vesa; no Fixes/Reported-by/Cc:stable
- [Phase 2] Diff: +1 line MODULE_DEVICE_TABLE(of, imx8qxp_match) in drivers/clk/imx/clk-imx8qxp.c; no function body change
- [Phase 3] git blame: table from c2cccb6d0b33b (2018); modular support e0d0d4d86c766 (v5.9) introduced the need for aliases
- [Phase 3] git merge-base --is-ancestor e0d0d4d86c766 HEAD: yes; git merge-base --is-ancestor cd21fdcbef3fb HEAD: yes
- [Phase 3] Neighbor e89485455ac49 is independent LPCG MODULE_DEVICE_TABLE add
- [Phase 4] b4 dig -c cd21fdcbef3fb: matched v1 at that msgid; -a only v1; -w listed clk/imx and linux-clk recipients
- [Phase 4] gnuweeb thread: Masney Reviewed-by; Vesa Applied as cd21fdcbef3fb; no NAK
- [Phase 4] lore.kernel.org fetch: 403; used mirrors
- [Phase 5] CLK_IMX8QXP is tristate in drivers/clk/imx/Kconfig; built as clk-imx-scu via Makefile; module_init(imx8qxp_clk_init) registers the platform driver
- [Phase 5] scripts/mod/file2alias.c do_of_entry() emits of:N*T*C<compatible> from MODULE_DEVICE_TABLE
- [Phase 5] Sibling clk-imx8mm.c already uses the same macro
- [Phase 6] git describe HEAD: v7.3-rc4-27-gf0100363d8c37; make kernelversion: 7.3.0-rc4; file currently contains the added line
- [Phase 6] Apply difficulty: one line after existing imx8qxp_match[]
- [Phase 8] Failure mode: modular clock provider not autoloaded; severity MEDIUM–HIGH on those SoCs, none if =y
- UNVERIFIED: live udev/initramfs failure on hardware (author did not claim a runtime repro); stable-list discussion beyond the gnuweeb search
**YES**
drivers/clk/imx/clk-imx8qxp.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/imx/clk-imx8qxp.c +1 -0
@@ -337,6 +337,7 @@ static const struct of_device_id imx8qxp_match[] = { { .compatible = "fsl,imx8qm-clk", &imx_clk_scu_rsrc_imx8qm, }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, imx8qxp_match);static struct platform_driver imx8qxp_clk_driver = { .driver = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nfc: nxp-nci: Add remove on IRQ error
In reply to Sasha LevinFrom: Griffin Kroah-Hartman <[email protected]>
[ Upstream commit 56345cea6a30dc7a1b036d5fb7900434b4a4c5e8 ]
Add a call to nxp_nci_remove() in nxp_nci_i2c_probe() when the request_threaded_irq() fails.
Previously, IRQ resources were not being freed upon error.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: the probe error path is in this 6.12 tree, the leftover NCI device is a real leak, and the three-line cleanup applies here.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Record: [nfc / nxp-nci] [Add] call nxp_nci_remove() when IRQ registration fails in I2C probe
**Step 1.2: Tags**
- Record:
- Assisted-by: gkh_clanker_2000 (AI-assisted)
- Cc: David Heidelberg, Carl Lee, Jakub Kicinski, Krzysztof Kozlowski, Ian Ray, Uwe Kleine-König
- Signed-off-by: Griffin Kroah-Hartman (author)
- Signed-off-by: Greg Kroah-Hartman
- Reviewed-by: Ian Ray <[email protected]>
- `Link: https://patch.msgid.link/2026070726-observer-
fang-9716@gregkh`
- `Signed-off-by: David Heidelberg` (NFC maintainer)
- No `Fixes:`, no `Reported-by:`, no `Cc: stable` (absence expected)
- Ignore any pipeline `Signed-off-by: Sasha Levin` / `[Upstream commit
...]` markers**Step 1.3: Body**
- Record: Claimed bug is that request_threaded_irq() failure in nxp_nci_i2c_probe() does not clean up. Symptom described as “IRQ resources were not being freed.” Root cause stated as missing nxp_nci_remove() after a failed IRQ request. No stack trace, no reproducer, no version range.
- The “IRQ resources” wording is inaccurate: a failed request_threaded_irq() never acquired an IRQ, so there is nothing to free_irq(). The real leak is the NCI/NFC device created by the earlier nxp_nci_probe() success.
**Step 1.4: Hidden bug fix?**
- Record: Yes. This is error-path cleanup framed as “Add remove”. It is a real leak/UAF fix, not a feature. The AI-written message understates (and mislabels) the actual leftover object.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- Record: drivers/nfc/nxp-nci/i2c.c only. ~3 lines added, 1 line changed. Function: nxp_nci_i2c_probe(). Surgical single-file error- path change.
**Step 2.2: Code flow**
- Record: Before: nxp_nci_probe() registers an NCI/NFC device, then request_threaded_irq(); on failure the driver logs and returns the error. I2C core does **not** call .remove(). After: same log, plus nxp_nci_remove(phy->ndev) before returning. Only the IRQ-request failure path changes.
**Step 2.3: Bug mechanism**
- Record: [Error path / resource leak] with a follow-on UAF. nxp_nci_probe() does nci_allocate_device() + nci_register_device() (nfc_register_device(), three workqueues, rfkill, LLCP, genl “device added”). Those objects are not devm-backed. phy and info **are** devm_kzalloc. On probe failure, really_probe() → device_unbind_cleanup() → devres_release_all() frees info/phy while the registered nci_dev still holds driver_data pointing at info. Opening that leftover NFC device reaches nxp_nci_open() → nci_get_drvdata() on freed memory.
**Step 2.4: Fix quality**
- Record: Obviously correct and matches s3fwrn5_i2c_probe() in this tree (goto s3fwrn5_remove → s3fwrn5_remove()). Does not free_irq() (correct: IRQ was never taken). Uses the same nxp_nci_remove() as .remove. On this path NCI_UP is unset, so nci_close_device() does not call nxp_nci_close(); no new deadlock. Regression risk is very low.
## Phase 3: Git history
**Step 3.1: Blame**
- Record: Missing cleanup is original I2C probe code from 6be88670fc59d5 (“NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver”, Clément Perrochaud, 2015-03-09). git describe --contains → v4.1-rc1~.... Present for the entire life of this 6.12 tree.
**Step 3.2: Fixes: tag**
- Record: None. Buggy commit is 6be88670fc59d5, and git merge-base --is-ancestor 6be88670fc59d5 HEAD succeeds.
**Step 3.3: File history**
- Record: Recent local history is IRQ-trigger work (78ac2b2f981f6, 42c445f8dab95), GPIO sleep, unaligned.h move. No prior fix for this IRQ-fail cleanup. Not a multi-patch series that needs later nxp-nci commits.
**Step 3.4: Author**
- Record: Griffin Kroah-Hartman; no other nxp-nci commits in this tree. Greg KH SOB. Ian Ray Reviewed-by. David Heidelberg (NFC) took it. Driver is S: Orphan in MAINTAINERS.
**Step 3.5: Prerequisites**
- Record: Needs nxp_nci_probe() / nxp_nci_remove() / phy->ndev, all present in drivers/nfc/nxp-nci/core.c here. Standalone.
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**
- Record: Lore patch.msgid.link and lore.kernel.org fetches returned
403. Recovered from Openwall/LKML:
- https://lists.openwall.net/linux-kernel/2026/07/07/1891
- https://lkml.iu.edu/hypermail/linux/kernel/2607.0/13842.html
- Single [PATCH] (not v2/v3). Posted 2026-07-07 to oe-linux-nfc / LKML.
- Ian Ray: “Nice improvement!” + Reviewed-by
(https://lkml.iu.edu/hypermail/linux/kernel/2607.0/14256.html). No NAK.
**Step 4.2: Recipients**
- Record: oe-linux-nfc, LKML, David Heidelberg, Carl Lee, Jakub Kicinski, Krzysztof Kozlowski, Ian Ray, Uwe Kleine-König. NFC list + net maintainer CC’d.
**Step 4.3: Bug report**
- Record: No user/syzbot/bugzilla report. Found as AI-assisted error- path audit.
**Step 4.4: Series / merge**
- Record: David Heidelberg’s NFC net-next PR 2026-08-17 lists it under **Improvements**, not Fixes: https://lists.openwall.net/linux-
kernel/2026/08/17/1882 (based on 7.2-rc7). Sibling Griffin patch:
nfc: mrvl: spi: Unregister dev on allocation fail. Taken for mainline, not as a -net hotfix.
**Step 4.5: Stable list**
- Record: No stable-thread hit for this subject. UNVERIFIED that nobody later nominated it; lore.kernel.org/stable search was not usable (403 / unrelated hits).
## Phase 5: Semantic / call graph
**Step 5.1: Functions**
- Record: nxp_nci_i2c_probe(); calls nxp_nci_remove().
**Step 5.2: Callers**
- Record: I2C .probe via module_i2c_driver(nxp_nci_i2c_driver). Device enumeration / bind / module load. Not IRQ/hot path except that this *is* the IRQ-setup failure arm.
**Step 5.3: Callees**
- Record: nxp_nci_remove() → nci_unregister_device() + nci_free_device(); optional FW work cancel; set_mode(COLD).
**Step 5.4: Reachability**
- Record: Yes, from device probe (init/userspace bind). The leftover NFC device is userspace-visible: nfc_register_device() does device_add() and nfc_genl_device_added(). A daemon that opens it after a failed probe hits the UAF. Trigger is request_threaded_irq() failure (bad/busy IRQ, ENOMEM), not every boot.
**Step 5.5: Similar patterns**
- Record: drivers/nfc/s3fwrn5/i2c.c already unwinds with s3fwrn5_remove() on IRQ failure. drivers/nfc/st-nci/i2c.c has the same missing unwind (devm_request_threaded_irq fail just logs). pn533/i2c.c uses goto irq_rqst_err. This is a known probe-pattern bug, not unique to nxp-nci.
## Phase 6: This tree (6.12.111)
**Step 6.1: Buggy code present?**
- Record: Yes. git describe HEAD → p-6.12-3-gc504cf0baa3d8; make kernelversion → **6.12.111**. Current nxp_nci_i2c_probe() still returns on IRQ failure without nxp_nci_remove() (drivers/nfc/nxp- nci/i2c.c around the request_threaded_irq() call). Introduced v4.1, long before 6.12.
**Step 6.2: Backport difficulty**
- Record: Clean/trivial. The hunk matches this tree (including Carl Lee ACPI IRQ context already backported as 42c445f8dab95). Candidate later tree uses { .name = "nxp-nci_i2c" } vs { "nxp-nci_i2c" } here; that is unused context, not the fix.
**Step 6.3: Related fixes already here?**
- Record: No git log --grep hit for “Add remove on IRQ” or nxp_nci_remove on the error path. No alternate unwind.
## Phase 7: Subsystem context
**Step 7.1**
- Record: [drivers/nfc/nxp-nci] NXP NCI I2C (PN547/PN548/PN7150). **IMPORTANT/PERIPHERAL**: not core mm/net, but this driver is on real laptops (Lenovo T14s IRQ-storm traffic in 2026). Kconfig:
NFC_NXP_NCI / NFC_NXP_NCI_I2C.
**Step 7.2**
- Record: Mature (2015); recent churn is IRQ polarity/ACPI, not a rewrite. Orphan.
## Phase 8: Impact and risk
**Step 8.1: Who**
- Record: Users with NXP NCI over I2C (CONFIG_NFC_NXP_NCI_I2C), and only when IRQ request fails during probe.
**Step 8.2: Trigger**
- Record: Failed request_threaded_irq() after successful nxp_nci_probe(). Uncommon on healthy firmware, but deterministic when it happens. Unprivileged userspace can then talk to the genl- announced leftover NFC device.
**Step 8.3: Failure mode**
- Record: Leaked nci_dev/nfc_dev, three workqueues, rfkill, LLCP; registered NFC node after a failed bind; UAF of devm info/phy if the leftover device is opened. Severity: **HIGH** if hit (UAF/oops), **LOW–MEDIUM** likelihood.
**Step 8.4: Benefit vs risk**
- Record: Benefit medium for affected hardware (prevents leak + UAF on a failed probe). Risk very low (3 lines, existing teardown, only the already-failed path). Ratio is favorable.
## Phase 9: Synthesis
**Evidence FOR**
- Real probe error-path leak of a registered NFC/NCI device and associated workqueues.
- Verified UAF: device_unbind_cleanup() frees devm info while nci_dev->driver_data still points at it; nfc_genl_device_added() can pull userspace in.
- Bug present since v4.1; in this 6.12.111 tree unchanged.
- 3-line, obviously correct unwind; same pattern as s3fwrn5 here.
- Reviewed-by Ian Ray; merged by David Heidelberg.
- Applies cleanly (or with trivial context).
**Evidence AGAINST**
- Maintainer filed it as a net-next **Improvement**, reviewer said “Nice improvement!” — not treated as a crash fix.
- Commit message is wrong about “IRQ resources”.
- AI-assisted, no user/syzbot report in 11 years.
- Trigger is rare; driver is orphan; NFC is not core.
- No Fixes: (expected, not a veto).
**Unresolved**
- Could not fetch lore.kernel.org (403). Used Openwall/LKML instead.
- No usable stable-list discussion found.
**Stable rules**
1. Obviously correct and tested? **PASS** — 3 lines, existing nxp_nci_remove(), Reviewed-by, in NFC pull.
2. Real bug affecting users? **PASS** — leftover registered NFC device + leak; UAF if opened.
3. Important (crash/security/corruption/deadlock)? **PASS** — UAF/oops on leftover device; not a hot-path crash, but still a serious failure mode.
4. Small and contained? **PASS** — one file, ~3 lines.
5. No new features/APIs? **PASS**.
6. Applies to this tree? **PASS**.
**Exception category:** none (not a device ID/quirk/DT/build/doc exception). It is a normal error-path leak/UAF fix.
The inaccuracy of the commit message and the “improvement” label do not change the code: without nxp_nci_remove(), a failed IRQ request leaves an NFC device registered after devm teardown. That is exactly the class of probe-path leak stable trees take, and the patch is safe on 6.12.111.
### What this solves for 6.12 users
If nxp_nci_i2c_probe() fails at request_threaded_irq(), 6.12 currently keeps the NCI/NFC device from nxp_nci_probe() and then frees the devm private data. Userspace can still see that NFC device. The patch unregisters and frees it, matching .remove.
### Risk vs benefit
Benefit is avoiding a leak and a reachable UAF on that failure path. Risk is negligible: the new call is the same teardown already used on unbind, and the device was never brought up (NCI_UP clear).
### Concerns
None that block a backport. Context around ACPI IRQ flags is already in this tree. No extra commits required.
Verification:
- [Phase 1] Parsed tags: AI-assisted; Reviewed-by Ian Ray; David Heidelberg SOB; no Fixes/Reported-by/Cc:stable
- [Phase 1] Body claims “IRQ resources” leak; code actually cleans the NCI device, not an IRQ
- [Phase 2] Diff: 3 lines in nxp_nci_i2c_probe() adding nxp_nci_remove(phy->ndev) on IRQ failure
- [Phase 2] nxp_nci_probe() registers via nci_register_device() → nfc_register_device() (device_add, genl); nci_allocate_device() is kzalloc, not devm
- [Phase 2] phy/info are devm_kzalloc; really_probe() failure path calls device_unbind_cleanup() → devres_release_all() (verified in drivers/base/dd.c)
- [Phase 2] On this path nci_close_device() skips ops->close when NCI_UP is clear (verified in net/nfc/nci/core.c)
- [Phase 3] Blame: 6be88670fc59d5 (v4.1-rc1); ancestor of HEAD
- [Phase 3] No existing unwind for this path in this tree
- [Phase 4] Openwall 2026-07-07 submission; Ian Ray “Nice improvement!”; NFC PR 2026-08-17 lists it under Improvements
- [Phase 4] UNVERIFIED: lore.kernel.org 403; no stable-list thread found
- [Phase 5] Sibling s3fwrn5 already calls remove on IRQ failure; st- nci still does not
- [Phase 6] Local tree 6.12.111; buggy if (r < 0) nfc_err(...); return r; still present; nxp_nci_remove() exists
- [Phase 7] Orphan nxp-nci I2C driver; used on real PCs (ACPI IRQ work already in this tree)
- [Phase 8] Failure: leak + leftover NFC device + UAF if opened; trigger uncommon; fix risk very low
**YES**
drivers/nfc/nxp-nci/i2c.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +3 -1
@@ -326,8 +326,10 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) nxp_nci_i2c_irq_thread_fn, irqflags |IRQF_ONESHOT , NXP_NCI_I2C_DRIVER_NAME, phy); -if (r <0 ) +if (r <0 ) {nfc_err (&client->dev,"Unable to register IRQ handler\n" ); +nxp_nci_remove (phy->ndev); + }return r; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda/realtek: Add quirk for Lenovo ThinkBook G8+
In reply to Sasha LevinFrom: Zhang Heng <[email protected]>
[ Upstream commit 4322ac247f4ce7932edbd46aa37f3dae62cde424 ]
Fix Bass Speaker volume control on Lenovo ThinkBook G8+ by adding quirk 17aa:38dc with ALC285_FIXUP_SPEAKER2_TO_DAC1.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.18.57**. The ThinkBook G8+ SSID is not in v6.18.57; the existing ALC285_FIXUP_SPEAKER2_TO_DAC1 path is, so this is a one-line hardware quirk that belongs in this series.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [ALSA/hda/realtek] [Add] [quirk for Lenovo ThinkBook G8+ to fix bass speaker volume]
- Subsystem: ALSA: hda/realtek
- Verb: Add (hardware quirk, not a new API)
- Intent: enable an existing Realtek fixup for PCI SSID 17aa:38dc
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Link: https://bugzilla.kernel.org/show_bug.cgi?id=221799 — user- filed hardware bug
- `Link:
https://patch.msgid.link/[email protected]`
— original submission
- Signed-off-by: Zhang Heng <[email protected]> — author
- Signed-off-by: Takashi Iwai <[email protected]> — ALSA maintainer
- No Fixes: tag (expected; this adds a device match, it does not revert an earlier logic bug)
- No Reported-by: / Tested-by: / Reviewed-by: / Cc: stable (absence is expected)
- Pipeline markers ([Upstream commit 4322ac247f4ce…], `Signed-off-by:
Sasha Levin`) ignored per instructions
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: bass speaker volume control is broken on Lenovo ThinkBook G8+
- Symptom: users cannot control bass speaker volume
- Root cause (from the existing fixup, not restated in this commit): NID 0x17 (bass speaker) is not routed to DAC1 (0x02), so volume amp is missing
- Fix: match SSID 17aa:38dc to ALC285_FIXUP_SPEAKER2_TO_DAC1
- Version info: none in the message; patch dated 2026-09-21, applied by Takashi Iwai 2026-09-28
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. This is an explicit hardware quirk for a documented laptop audio defect.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: sound/hda/codecs/realtek/alc269.c (+1 / -0)
- Function/table: alc269_fixup_tbl[]
- Scope: single-file, one-line surgical addition
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Before: PCI SSID 17aa:38dc has no quirk; generic Realtek auto-config is used
- After: that SSID selects ALC285_FIXUP_SPEAKER2_TO_DAC1 at codec probe
- Path: HDA codec probe / pin-config fixup (init path), not a hot path or error path
- Only machines with that SSID are affected
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- Category: hardware workaround / codec quirk (SND_PCI_QUIRK)
- Mechanism: alc285_fixup_speaker2_to_dac1() on HDA_FIXUP_ACT_PRE_PROBE calls snd_hda_override_conn_list(codec, 0x17, …, {0x02}), forcing the bass-speaker pin onto DAC1 so volume control works
- The fixup is also chained to ALC269_FIXUP_THINKPAD_ACPI (Lenovo ACPI hooks), which is the same chain already used for Yoga Pro 7 14ARP8 (17aa:386e)
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: one table entry using an existing, long-lived fixup
- Minimal: no unrelated edits
- Regression risk: low and SSID-scoped. Wrong SSID would mis-route audio on that ID only; 17aa:38dc is unused in this tree’s HDA tables
- No public API / data-structure change
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- This is a new table row, not a change to old lines
- Neighboring Lenovo SSIDs (0x38d7, 0x38df) already exist in v6.18.57
- alc285_fixup_speaker2_to_dac1 / bass-speaker-to-DAC pattern dates to e79c22695abd3 (2019; originally Cc: stable)
- Same enum used for Yoga Pro 7 14ARP8 in 1a49509885cd9 (2024-06-16), which **is** an ancestor of v6.18.57
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Not applicable. The “bug” is missing hardware enablement for this SSID, not a regression of a prior commit.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- Recent alc269.c history is dominated by similar SND_PCI_QUIRK additions
- Submitted as [PATCH 1/2]; 2/2 is an unrelated Acer Nitro headset-mic quirk (1025:151e). Not a prerequisite
- Standalone
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record:
- Zhang Heng is a regular Realtek quirk contributor (ASUS, Lenovo, HP, Samsung entries in this file)
- Not the subsystem maintainer; Takashi Iwai applied the patch
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record:
- Needs ALC285_FIXUP_SPEAKER2_TO_DAC1, alc285_fixup_speaker2_to_dac1(), ALC269_FIXUP_THINKPAD_ACPI, snd_hda_override_conn_list(), and alc269_fixup_tbl[]
- All present in v6.18.57
- Can apply standalone
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 4322ac247f4ce7932edbd46aa37f3dae62cde424 →
https://patch.msgid.link/[email protected]
- Series: **v1 only** ([PATCH 1/2])
- Takashi Iwai reply ([email protected], 2026-09-28):
“Applied both patches. Thanks.”
- No NAK, no requested revision, no stable-risk comments
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w):
- To: [email protected] (ALSA maintainer)
- Cc: [email protected], [email protected]
- Maintainer applied it after review
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record:
- Commit cites bugzilla 221799
- Direct fetch of bugzilla/lore HTML was blocked by Anubis/captcha (403 / bot check)
- UNVERIFIED: bugzilla comment text, number of duplicates, reporter hardware dump
- Verified: author and maintainer treated it as a real bass-speaker volume bug for SSID 17aa:38dc
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record:
- 2/2 is an independent Acer quirk, not required here
- Same fixup already used for Lenovo Yoga Pro 7 14ARP8 in this tree
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search blocked by Anubis. UNVERIFIED whether anyone already asked for this on stable@. No in-tree evidence of a prior rejection.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record:
- Modified: alc269_fixup_tbl[] (data)
- Invoked fixup: alc285_fixup_speaker2_to_dac1()
- Lookup at probe: alc269_fixup_tbl passed into the generic HDA fixup picker (around line 8558 in this checkout / 8528 in v6.18.57)
**Step 5.2: TRACE CALLERS**
Record:
- Table is consulted during Realtek ALC269-family codec probe
- Triggered by HDA bus enumeration of matching PCI SSID
- Not IRQ/hot-path; once per codec init
**Step 5.3: TRACE CALLEES**
Record:
- snd_hda_override_conn_list() — present in v6.18.57 (include/sound/hda_codec.h)
- Chained ALC269_FIXUP_THINKPAD_ACPI — present in v6.18.57
**Step 5.4: FOLLOW THE CALL CHAIN**
Record:
- Userspace-reachable: yes, by using the laptop’s speakers / mixer
- Unprivileged users cannot attack other machines; they only exercise this laptop’s audio path
- Impact is functional (bass volume), not a kernel crash
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record:
- Same fixup already bound to Yoga Pro 7 14ARP8 (SND_PCI_QUIRK(0x17aa, 0x386e, …, ALC285_FIXUP_SPEAKER2_TO_DAC1))
- Many other SND_PCI_QUIRK Lenovo entries in the same table
- Systematic, well-worn pattern
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record:
- Tree: git describe HEAD → v6.18.57-155-gcdf239ca885b2; make kernelversion → 6.18.57
- git merge-base --is-ancestor 4322ac247f4ce7932edbd46aa37f3dae62cde424 v6.18.57 → **NO** (upstream commit not in 6.18.57)
- git grep 0x38dc v6.18.57 -- sound/hda/codecs/realtek/alc269.c → **absent**
- The missing-quirk bug **does** exist in this series
- Driver, fixup enum, and function **do** exist
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record:
- Dry-run of the upstream hunk onto v6.18.57:sound/hda/codecs/realtek/alc269.c: **Hunk #1 succeeded at 7538 (offset -726 lines)**
- Expected difficulty: clean apply (line-offset only)
- Neighboring context (0x38d7 Yoga 9, then 0x38df Yoga Y990) matches
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record:
- No other 17aa:38dc HDA quirk in v6.18.57
- No alternate ThinkBook G8+ fix
- (HEAD currently contains the autosel candidate copy; ignored as pipeline state)
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record:
- Subsystem: ALSA HD-audio Realtek codec (sound/hda/codecs/realtek/)
- Criticality: IMPORTANT (very common laptop audio), not core mm/scheduler
- Affects only Lenovo ThinkBook G8+ (17aa:38dc)
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record:
- Mature but active: v6.18.57 already contains many similar quirk backports (HP, Lenovo, ASUS)
- Typical stable material for this file
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: driver-specific / machine-specific — owners of Lenovo ThinkBook G8+ with PCI SSID 17aa:38dc
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- Trigger: boot / audio init on that laptop, then using speaker volume
- Common for those users (every session)
- Not a security trigger; not a race
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Failure mode: bass speaker volume control does not work (wrong DAC routing)
- Severity: MEDIUM functionally, but this is an explicit **hardware quirk** exception that stable routinely takes
- Not a panic/UAF/corruption
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: high for affected hardware (makes volume control work); zero for everyone else
- Risk: very low (1 line, existing fixup, SSID-matched)
- Ratio: strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real hardware bug with bugzilla link
- One-line SND_PCI_QUIRK using an existing fixup already in 6.18.57
- ALSA maintainer applied it with no objections
- Same pattern as Yoga Pro 7 14ARP8 in this tree
- Applies cleanly to v6.18.57
- Explicit stable exception: audio codec quirks
AGAINST:
- Not a crash/security/data-corruption issue
- Affects one laptop SSID
- Bugzilla body could not be fetched (captcha)
UNRESOLVED:
- Full bugzilla 221799 text
- Whether stable@ already discussed this commit
Those gaps do not outweigh the verified quirk itself.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — 1-line table entry; maintainer applied; existing fixup
2. Fixes a real bug that affects users? **PASS** — broken bass volume on ThinkBook G8+
3. Important issue? **PASS** under the hardware-quirk exception (pin/DAC routing so speakers are controllable)
4. Small and contained? **PASS** — +1 line, one file
5. No new features or APIs? **PASS** — no new fixup, no new kAPI; device ID/quirk only
6. Can apply to the local tree? **PASS** — dry-run succeeded on v6.18.57
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **Hardware quirk / workaround** (ALSA Realtek SND_PCI_QUIRK for a specific laptop). This is the documented stable exception for codec quirks.
**Step 9.4: DECISION**
This should be backported to this 6.18.y tree. The driver and fixup are already here; only the SSID match is missing. That is exactly the class of change stable takes for laptop audio.
---
### What the commit solves and why it matters
Without the quirk, ThinkBook G8+ (17aa:38dc) leaves the bass speaker pin on a DAC without volume amp, so bass volume cannot be controlled. The one-line match sends that SSID through alc285_fixup_speaker2_to_dac1(), which is already used for other Lenovo dual-speaker machines in this tree.
### Stable rules / risk
It is small, obviously correct, introduces no API, and is SSID-scoped. Apply risk is an offset-only hunk. Benefit is real for users of that laptop on 6.18.y; risk to other machines is negligible.
### Concerns
None that block backport. Series 2/2 is unrelated. Bugzilla details were not readable due to captcha, but the code, existing fixup, and maintainer accept are sufficient.
Verification:
- [Phase 1] Parsed subject/tags: quirk add; bugzilla 221799; Iwai SOB; no Fixes tag
- [Phase 2] Diff: +1 SND_PCI_QUIRK(0x17aa, 0x38dc, …, ALC285_FIXUP_SPEAKER2_TO_DAC1) in alc269_fixup_tbl
- [Phase 2] Read alc285_fixup_speaker2_to_dac1() at alc269.c:2532:
overrides NID 0x17 conn list to DAC 0x02; chained to ALC269_FIXUP_THINKPAD_ACPI
- [Phase 3] git merge-base --is-ancestor 4322ac247f4ce v6.18.57 → NO (not already in 6.18.57)
- [Phase 3] Fixup enum/function present in v6.18.57 (alc269.c:3791, :4907, Yoga Pro 7 use at :7492)
- [Phase 3] Similar Lenovo quirk 1a49509885cd9 is an ancestor of v6.18.57
- [Phase 3] Series 2/2 is an independent Acer quirk; not a dependency
- [Phase 4] b4 dig -c 4322ac247f4ce: lore/msgid [email protected]; v1 only
- [Phase 4] b4 dig -w: To Iwai, Cc linux-sound
- [Phase 4] mbox: Iwai “Applied both patches. Thanks.”; no NAK
- [Phase 4] UNVERIFIED: bugzilla 221799 body (Anubis/403); stable@ search (Anubis)
- [Phase 5] Table consumed at Realtek codec probe; snd_hda_override_conn_list exists in v6.18.57
- [Phase 6] git describe HEAD / make kernelversion: 6.18.57; 0x38dc absent from v6.18.57 alc269.c
- [Phase 6] patch --dry-run of upstream hunk onto v6.18.57 file:
succeeded at line 7538
- [Phase 8] Failure mode: bass speaker volume broken on one Lenovo SSID; quirk-scoped
- UNVERIFIED: exact bugzilla reporter comments and whether stable@ already nominated this
**YES**
sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7572,6 +7572,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x38d5 ,"Yoga S990-16 Pro IMH YC Quad" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38d6 ,"Yoga S990-16 Pro IMH VECO Quad" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38d7 ,"Lenovo Yoga 9 14IMH9" ,ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x38dc ,"Lenovo ThinkBook G8" ,ALC285_FIXUP_SPEAKER2_TO_DAC1 ),SND_PCI_QUIRK (0x17aa ,0x38df ,"Yoga Y990 Intel YC Dual" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38e0 ,"Yoga Y990 Intel VECO Dual" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 selftests/net: fin_ack_lat: fix latency threshold typo
In reply to Sasha LevinFrom: Brian Grech <[email protected]>
[ Upstream commit 2373107782a98ba15931a37bbd9dd46d7213e5aa ]
The commit message for af8c8a450bf4 ("selftests: net: Add FIN_ACK processing order related latency spike test") states: "if the latency is larger than 1 second (spike), print a message". However the code uses a threshold of 100000 us (100 ms), not 1000000 us (1 s).
The lower threshold causes false positives on slower hardware where normal connection latency occasionally exceeds 100 ms but never approaches the 1 s spike that indicates the actual FIN/ACK race bug.
Fix the threshold to match the documented intent.
---
LLM Generated explanations, may be completely bogus:
I have the local 6.12 tree, the one-line typo, mailing-list review, and a clean apply. Compiling the nine-phase analysis next.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Record: [selftests/net] [fix] latency threshold typo in fin_ack_lat
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS** (from the presented message and from git show 2373107782a9)
- Reviewed-by: Simon Horman <[email protected]>
- Signed-off-by: Brian Grech <[email protected]> (author)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Jakub Kicinski <[email protected]> (netdev maintainer, applied it)
- No Reported-by, Tested-by, Acked-by in the committed message
- Committed message has no Fixes: / Cc: stable (those tags were on mailing-list v3; they are not treated as “already selected”)
- Record: Reviewed by a netdev reviewer; applied by the net maintainer. Author is Red Hat.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
- Record: [Bug] fin_ack_lat treats latency ≥ 100000 µs (100 ms) as a spike, while the original test commit says the spike is **1 second**. [Symptom] false FAIL printouts on slower/loaded hardware when normal localhost connect latency is 100 ms–1 s. [Version] original test is af8c8a450bf4 (2020). [Root cause] missing zero: 100000 vs 1000000.
**Step 1.4: DETECT HIDDEN BUG FIXES**
- Record: Not hidden. Explicit typo/threshold bug in a kselftest. “fix” is accurate.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- Record: tools/testing/selftests/net/fin_ack_lat.c — 1 line changed (100000 → 1000000). Function: client(). Scope: single-file, one- line surgical fix. git show --stat: 1 file changed, 1 insertion(+), 1 deletion(-).
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
- Record: After connect/send/read, timediff() returns microseconds (tv_sec * 1000000 + tv_usec). If lat < threshold, skip the printf and close. Before: print (and the wrapper script counts a FAIL) at ≥ 100 ms. After: only at ≥ 1 s.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
- Record: [Category] logic/correctness (wrong constant). [Mechanism] threshold was 10× too low vs documented 1 s spike that matches TCP_TIMEOUT_INIT (1×HZ). Wrapper fin_ack_lat.sh fails if any spike line is printed.
**Step 2.4: ASSESS THE FIX QUALITY**
- Record: Obviously correct vs the original commit text and vs timediff() units. Minimal. Regression risk is that 100 ms–1 s events would no longer FAIL; that is intended, because those are not the FIN/ACK race (which waits a full initial RTO of 1 s). No API/locking/kernel-runtime change.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
- Record: Line 72 (if (lat < 100000)) blamed to af8c8a450bf469 (SeongJae Park, 2020-02-02). Introduced with the test; never changed since.
**Step 3.2: FOLLOW THE FIXES: TAG**
- Committed message has no Fixes: tag. Mailing-list v3 cited `Fixes:
af8c8a450bf4`.
- git merge-base --is-ancestor af8c8a450bf4 HEAD → yes (exit 0).
- Original test message: “if the latency is larger than 1 second (spike), print a message.”
- Related kernel fix 9603d47bad464 (“tcp: Reduce SYN resend delay if a suspicous ACK is received”) is also an ancestor; it describes the 1 s TIMEOUT_INIT reconnection spike this test is for.
**Step 3.3: CHECK FILE HISTORY**
- Record: Only one commit on this file in this tree: af8c8a450bf46. No later refactor. Standalone, not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
- Record: git log --author="Brian Grech" -- tools/testing/selftests/net/ is empty in this tree (author is not a 6.12 net-selftest regular). Reviewer Horman and committer Kicinski are netdev maintainers/reviewers.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
- Record: None. Only changes a numeric constant. git apply --check of 2373107782a9 succeeds on this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
- Record: b4 dig -c 2373107782a9 →
https://patch.msgid.link/[email protected]
- Revisions (b4 dig -a):
- v1: 2026-07-31,
https://patch.msgid.link/[email protected]
- v2: 2026-08-04 (added maintainer CCs)
- v3: 2026-08-06 (applied)
- Horman (2026-08-06): looks good; “might be nice” to explain why 1 s; “if this is a fix to be backported (I am unsure)” then add Fixes: and target net. **Reviewed-by** given; no NAK.
- Author replied and sent v3 with original-commit wording, Fixes:, and Cc: stable.
- Applied to netdev/net-next by Jakub Kicinski (2373107782a9). No NAKs in the saved thread.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
- Record (b4 dig -w): netdev, linux-kselftest, Shuah Khan, Eric Dumazet, Paolo Abeni, Simon Horman, Jakub Kicinski. Right lists and maintainers.
**Step 4.3: SEARCH FOR THE BUG REPORT**
- Record: No syzbot/bugzilla. Evidence is the commit text plus a Red Hat author describing loaded/slower-hardware false positives. Severity:
incorrect kselftest FAIL, not a kernel oops.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
- Record: Standalone 1-patch series. No sibling patches required.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
- Record: lore.kernel.org/stable search via WebFetch returned 403. Web search did not find a stable-list rejection or discussion of this fix.
UNVERIFIED: no confirmed stable@ thread beyond v3 CCing stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
- Record: client() only.
**Step 5.2: TRACE CALLERS**
- Record: main() forks and the child calls client(port). Userspace- only. fin_ack_lat.sh runs ./fin_ack_lat for 30s and FAILs if any stdout spike line appears. Makefile: TEST_PROGS += fin_ack_lat.sh, TEST_GEN_FILES += fin_ack_lat — part of default net selftests.
**Step 5.3: TRACE CALLEES**
- Record: socket/connect/send/read, timediff(), printf on spike. No kernel helpers.
**Step 5.4: FOLLOW THE CALL CHAIN**
- Record: Reachable by running the net kselftest (localhost TCP). Not a syscall bug; it is the test harness for the 2020 FIN/ACK race.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
- Record: Only this one comparison. timediff() already uses * 1000000 (µs), which confirms 1000000 = 1 s.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
- Record: Yes. This checkout is **6.12.111** (pending-6.12, p-6.12-3-gc504cf0baa3d8). fin_ack_lat.c:72 is still if (lat < 100000). Introduced 2020-02 (af8c8a450bf4); present throughout 6.12. Candidate 2373107782a9 is **not** an ancestor of HEAD.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
- Record: git diff af8c8a450bf4 HEAD -- tools/testing/selftests/net/fin_ack_lat.c is empty. git apply --check of the candidate succeeds. Expected: **clean apply**.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
- Record: git log --grep="fin_ack_lat: fix latency" and --grep="latency threshold typo" on that path: empty. No alternate fix.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
- Record: tools/testing/selftests/net/ — kselftest, not kernel runtime. Criticality: **PERIPHERAL** for production machines; **IMPORTANT** for people who run net selftests on 6.12 (distro CI, LTS validation).
**Step 7.2: SUBSYSTEM ACTIVITY**
- Record: Net selftests are active in 6.12; this **file** is untouched since 2020 (mature, long-standing typo).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
- Record: Anyone running tools/testing/selftests/net (fin_ack_lat.sh). Not production TCP. Config: standard net kselftests.
**Step 8.2: TRIGGER CONDITIONS**
- Record: 30 s of localhost connect/send/read. False FAIL when a loop exceeds 100 ms (loaded CI, slow VM, embedded). Unprivileged users can run the test; this is not a security trigger.
**Step 8.3: FAILURE MODE SEVERITY**
- Record: Incorrect kselftest FAIL (script: FAIL: N spikes detected). No oops, hang, or corruption. Severity: **MEDIUM** for testers/CI, **LOW** for production runtime. The kernel bug the test is meant to catch is a ~1 s SYN retry (TCP_TIMEOUT_INIT = 1*HZ in include/net/tcp.h).
**Step 8.4: RISK-BENEFIT RATIO**
- Record: Benefit: stops false FAILs on 6.12 net selftests; restores the 1 s meaning the test was written for. Risk: one constant in userspace; no kernel change. Ratio: **high benefit for testers / very low risk**.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: EVIDENCE**
FOR:
- Real, documented mismatch: commit af8c8a450bf4 says 1 s; code uses 100 ms.
- timediff() is in microseconds; 1000000 µs is 1 s.
- Kernel symptom being tested is a 1 s initial RTO (TCP_TIMEOUT_INIT), not 100 ms.
- Wrapper treats any printed spike as FAIL, so the typo causes false failures.
- File and bug exist in this 6.12 tree unchanged since 2020.
- One-line, applies cleanly, userspace-only.
- Reviewed-by Horman; applied by Kicinski.
- Author (Red Hat) describes slower/loaded-system false positives — a real “bothers people” case for LTS testing.
AGAINST:
- Not a kernel crash, UAF, deadlock, or CVE.
- Horman was unsure about backport before v3.
- Applied via net-next; committed message dropped Fixes:/Cc: stable.
- Only testers are affected.
UNRESOLVED:
- Could not read lore.kernel.org/stable (403). No evidence of a stable rejection.
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — units, original docs, and TCP_TIMEOUT_INIT all agree; reviewed.
2. Fixes a real bug that affects users? **PASS** — false kselftest FAILs on slower/loaded hardware; Red Hat author.
3. Important issue? **PASS** (as “oh, that's not good” / broken default net selftest), not as a production crash. Official stable-kernel- rules.rst allows a real bug that bothers people, not only oops/hang/CVE.
4. Small and contained? **PASS** — 1 line, 1 file.
5. No new features or APIs? **PASS**.
6. Can apply to this tree? **PASS** — clean apply; buggy code present.
**Step 9.3: EXCEPTION CATEGORIES**
- Record: Not a device-ID/quirk/DT/build/docs exception. Closest
analogue: **test/tooling correctness** (same spirit as a build fix:
helps people who build and test this kernel).
**Step 9.4: DECISION**
This tree is **6.12.111**. The typo is in-tree, the 1 s threshold is what the test and the TCP bug both mean, and the patch is a one-line userspace correction with no kernel regression surface. That is appropriate for 6.12 stable: it stops false net-selftest failures without changing runtime behavior.
---
## What the commit solves for stable users
On 6.12, fin_ack_lat is a default net selftest. It is supposed to flag the ~1 s reconnect spike from FIN/ACK processing order (TCP_TIMEOUT_INIT). A missing zero makes it flag ≥100 ms instead, so loaded or slow machines can FAIL without the actual TCP bug. Distros and anyone running kselftests on 6.12 get noisy, wrong results.
## Stable rules / risk vs benefit
It is obviously correct, tiny, already reviewed, and applies cleanly. Benefit is reliable tests; risk is negligible. It does not fix a production crash, but it does fix a real, user-visible test bug in this tree.
## Concerns
None that block a backport: no missing prerequisites, no file drift, no kernel ABI change. Raising the threshold will ignore 100 ms–1 s events; that matches the original design.
---
## Verification
- [Phase 1] Parsed committed tags on 2373107782a9; Horman Reviewed-by; Kicinski SOB; no Fixes in committed text
- [Phase 1] Original test commit af8c8a450bf4 text: “larger than 1 second (spike)”
- [Phase 2] Diff: one comparison in client(), 100000 → 1000000
- [Phase 2] timediff() uses tv_sec * 1000000 (microseconds) — verified in fin_ack_lat.c
- [Phase 2] fin_ack_lat.sh FAILs if any spike line is printed — verified
- [Phase 3] git blame line 72 → af8c8a450bf469 (2020-02-02)
- [Phase 3] git merge-base --is-ancestor af8c8a450bf4 HEAD → yes; 2373107782a9 → no
- [Phase 3] 9603d47bad464 (TCP SYN resend / 1 s spike) is an ancestor
- [Phase 3] File unmodified after introduction (git diff af8c8a450bf4 HEAD -- fin_ack_lat.c empty)
- [Phase 3] git apply --check of candidate → success
- [Phase 4] b4 dig -c 2373107782a9 → lore msgid [email protected]
- [Phase 4] b4 dig -a: v1 (2026-07-31), v3 (2026-08-06, applied)
- [Phase 4] b4 dig -m: Horman Reviewed-by; unsure about backport; no NAK; v3 added Fixes + Cc: stable on the list
- [Phase 4] Patchwork: applied to net-next as 2373107782a9
- [Phase 4] UNVERIFIED: stable@ archive (lore 403)
- [Phase 5] client() called only from forked main(); Makefile lists the test in TEST_PROGS
- [Phase 5] TCP_TIMEOUT_INIT is 1*HZ in include/net/tcp.h
- [Phase 6] git describe HEAD → p-6.12-3-gc504cf0baa3d8; make kernelversion → 6.12.111; line 72 still 100000
- [Phase 8] Failure mode: kselftest false FAIL, not kernel oops; severity MEDIUM for testers
**YES**
tools/testing/selftests/net/fin_ack_lat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/fin_ack_lat.c +1 -1
@@ -69,7 +69,7 @@ static void client(int port) lat =timediff (start, end); sum_lat += lat; nr_lat++; -if (lat <100000 ) +if (lat <1000000 ) goto close;if (getsockname (sock, (struct sockaddr *)&laddr, &len) ==-1 )
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: add bounds check to prevent array overflow
In reply to Sasha LevinFrom: YiPeng Chai <[email protected]>
[ Upstream commit db15c49a17b8fab9ada38f3a548e5353d7d6b1a8 ]
Add bounds check to prevent array overflow.
v2:
Add warning messages.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.18.53**. The unbounded write into mce_adev_list.devs[] is present in that base; this is a 7-line overflow guard for that array.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[drm/amdgpu] [add] bounds check to prevent array overflow**
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: YiPeng Chai (author)
- Reviewed-by: Tao Zhou
- Signed-off-by: Alex Deucher (amdgpu maintainer)
- No Fixes:, Reported-by, Tested-by, Link:, or Cc: stable (absence is expected)
- Pipeline-only tags ignored: [Upstream commit db15c49a17b8…], Signed-
off-by: Sasha Levin
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: write into mce_adev_list.devs[] with no cap vs MAX_GPU_INSTANCE (64)
- Symptom: kernel array overflow / adjacent BSS corruption
- Version info: none in the message
- Root cause: registration does devs[num_gpu++] = adev with no capacity check (the sibling amdgpu_register_gpu_instance() has had that check since 2018)
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not disguised. It is an explicit overflow fix. v2 only adds a ratelimited warning.
===============================================================
PHASE 2: DIFF ANALYSIS
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c (+7 / −0)
- Function: amdgpu_register_bad_pages_mca_notifier()
- Scope: single-file surgical fix
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: always mce_adev_list.devs[mce_adev_list.num_gpu++] = adev, then register the MCE decode chain once
- After: if num_gpu >= MAX_GPU_INSTANCE, warn and return; otherwise same as before
- Path: device init / RAS recovery init, not the MCE hot path
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: **buffer overflow / out-of-bounds write**
- Mechanism: devs is struct amdgpu_device *devs[MAX_GPU_INSTANCE] (64). Index 64 is past the array and lands on num_gpu and the following BSS. A pointer-sized store there corrupts static driver state.
- Fix: same capacity check already used for mgpu_info in amdgpu_kms.c
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct; no API/lock/data-structure change
- Early return only skips adding a 65th device; the decode chain is already registered by GPU 0
- Regression risk: **very low** (warn + return). Skipping page- retirement for a 65th Aldebaran is safer than overflowing
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Unbounded store introduced in 91a1a52d03aa0f (Mukul Joshi, 2021-09-20): “Fix RAS page retirement with mode2 reset on Aldebaran”
- Present in this 6.18.53 tree (git merge-base --is-ancestor 91a1a52d03aa0f v6.18.53 succeeded)
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Introducer is 91a1a52d03aa0f, in this tree.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record:
- This tree has **no** amdgpu_unregister_bad_pages_mca_notifier (that landed later, ~Nov 2025 on amd-gfx)
- amdgpu_ras_recovery_fini() / amdgpu_driver_unload_kms() never shrink mce_adev_list
- GPU reset unregisters mgpu_info and re-adds it; it does **not** re- run amdgpu_ras_recovery_init(), so reset does not grow this list
- Series mate patch 2/2 (drm/amd/ras: use IS_ERR() to check thread creation result) touches rascore/ras_process.c and is independent
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: YiPeng Chai is a regular amdgpu RAS contributor. Tao Zhou reviewed; Alex Deucher applied. Not a drive-by change.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: None. The register function in v6.18.53 matches the parent hunk. Applies standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c db15c49a17b8… →
https://patch.msgid.link/[email protected]
- v1 (2026-06-16): check only, silent return
- v2 (same day): added dev_warn_ratelimited
- Tao Zhou (v1): “do we need to add warning message for it?” — that is the only review request
- No NAKs, no stable discussion, no user crash report
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): amd-gfx, Hawking Zhang, Tao Zhou, Candice Li. Tao
Zhou: Reviewed-by on v2. Alex Deucher signed off.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No syzbot, bugzilla, or user report found. Looks like an internal correctness/static-analysis fix, not a field crash.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record:
- 2-patch series; 2/2 is an unrelated kthread_run IS_ERR check
- Related later work: “Unregister mce notifier” (Nov 2025) — **not in this 6.18.53 tree**, so the list never shrinks here. That makes overflow easier to hit than on later mainline
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: No lore.kernel.org/stable hit for this subject. lore.kernel.org fetches returned 403; mail-archive + b4 were used instead.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS
Record: amdgpu_register_bad_pages_mca_notifier() (modified). Related:find_adev(), amdgpu_bad_page_notifier(), amdgpu_ras_recovery_init(). semcode MCP not available; used grep/read.
Step 5.2: TRACE CALLERS
Record:
- Only caller: amdgpu_ras_recovery_init() when CONFIG_X86_MCE_AMD, asic_type == CHIP_ALDEBARAN, and adev->gmc.xgmi.connected_to_cpu
- That is called only from amdgpu_device_init() (not from reset reinit)
- amdgpu_device_init() ← amdgpu_driver_load_kms() ← PCI probe
- amdgpu_pci_remove() → amdgpu_driver_unload_kms() does **not** drop the MCE list entry
Step 5.3: TRACE CALLEES
Record: dev_warn_ratelimited(), mce_register_decode_chain() (unchanged, still once)
Step 5.4: FOLLOW THE CALL CHAIN
Record:
- Reachable on MI200/MI250 (Aldebaran) CPU-attached XGMI systems (HPC), with RAS enabled
- Not a syscall; probe/unbind-bind
- Unbind/bind without rmmod leaves module statics: each successful RAS init increments num_gpu. After 64 such inits, the next write is OOB
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: amdgpu_register_gpu_instance() already guards mgpu_info.num_gpu >= MAX_GPU_INSTANCE (blame: 62d73fbcfb3671, 2018). This list was a copy without that guard.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. v6.18.53 has:mce_adev_list.devs[mce_adev_list.num_gpu++] = adev;
with no check. MAX_GPU_INSTANCE is 64 in amdgpu.h. Introduced 2021, long before 6.18.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply**. v6.18.53 function body matches the parent hunk (no unregister helper in this tree; not required).
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: No other overflow guard or unregister for mce_adev_list in v6.18.53.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: drm/amdgpu RAS / x86 MCE decode. **IMPORTANT** for Aldebaran+XGMI-to-CPU, not core kernel. Still kernel-memory corruption if it fires.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: amdgpu RAS is actively maintained; this particular list has been unchanged since 2021 except later unregister (not in 6.18).
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Driver- and config-specific: CONFIG_DRM_AMDGPU + CONFIG_X86_MCE_AMD + Aldebaran (PCI 1002:7408/740C/740F/7410) with host-GPU XGMI. Real HPC/Instinct users exist; not all amdgpu laptops.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- 65+ registrations into a 64-slot array
- A node with 65 Aldebaran GPUs is not realistic
- **In this tree**, no unregister: PCI unbind/bind (or probe after a failed teardown that still completed RAS init) grows the list. 64 cycles is uncommon but a real admin/debug path
- Unprivileged users cannot typically drive 64 GPU rebinds
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: OOB write of an amdgpu_device * past devs[] into num_gpu and following BSS → memory corruption, then likely oops on later MCE/list walk. Severity **HIGH** when hit; likelihood **LOW**.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: prevents a real overflow on a path this tree never cleans up; matches an existing sibling check
- Risk: 7 lines, warn+return, no locking/API change — **very low**
- Ratio: favorable for stable
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real unbounded store into a 64-entry static array (memory safety)
- Buggy code is in 6.18.53 and dates to 2021
- This tree never unregisters, so the counter can climb across unbind/bind
- 7-line, obviously correct, same pattern as amdgpu_register_gpu_instance()
- Reviewed by Tao Zhou; applied by Alex Deucher
- Applies cleanly; no prerequisites
AGAINST:
- Thin commit message; no crash report / syzbot / CVE
- Needs Aldebaran + XGMI-to-CPU + 65 registrations — rare in production
- Series 1/2, but 2/2 is unrelated
UNRESOLVED:
- Could not fetch lore.kernel.org (403); used b4 + mail-archive
- No public statement of how the overflow was found (Coverity vs internal test)
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — trivial bounds check; v2 reviewed
2. Fixes a real bug that affects users? **PASS** — OOB write; reachable if the list is never drained
3. Important issue? **PASS** — kernel memory corruption (HIGH, uncommon trigger)
4. Small and contained? **PASS** — +7 lines, one function
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — clean against v6.18.53
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: Not a device-ID/quirk/DT/build/docs exception. It is a normal memory-safety fix.
Step 9.4: MAKE YOUR DECISION
This is a small, obviously correct overflow guard for code that exists in this 6.18.53 tree. Because 6.18 never removes entries from mce_adev_list, the overflow is more reachable here than on later kernels that gained unregister. Benefit outweighs risk.
Verification:
- [Phase 1] Tags: author YiPeng Chai, Reviewed-by Tao Zhou, SOB Alex Deucher; no Fixes/Reported-by
- [Phase 2] Diff: +7 lines in amdgpu_register_bad_pages_mca_notifier(); if (num_gpu >= MAX_GPU_INSTANCE) warn; return;
- [Phase 3] git blame v6.18.53: unbounded store from 91a1a52d03aa0f (2021); ancestor of v6.18.53
- [Phase 3] git merge-base --is-ancestor 4f933b6727c05 v6.18.53 failed — fix is not in 6.18.53
- [Phase 3] No unregister in this tree (git grep unregister_bad_pages empty; git log --grep="Unregister mce notifier" empty)
- [Phase 3] Only recovery_init caller of register; reset path does not re-call it
- [Phase 4] b4 dig -c db15c49a17b8: v1 + v2; Tao asked for a warning; v2 Reviewed-by
- [Phase 4] b4 dig -a: two revisions, applied is v2
- [Phase 4] b4 dig -w: amd-gfx + Hawking Zhang, Tao Zhou, Candice Li
- [Phase 4] Patch 2/2 is IS_ERR on rascore kthread — independent
- [Phase 4] lore.kernel.org WebFetch 403 — UNVERIFIED via lore HTML; mail-archive used instead
- [Phase 5] Callers: only Aldebaran + connected_to_cpu in amdgpu_ras_recovery_init ← amdgpu_device_init ← PCI probe
- [Phase 5] Remove path: amdgpu_pci_remove → amdgpu_driver_unload_kms does not touch mce_adev_list
- [Phase 6] git describe HEAD: v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion: 6.18.53
- [Phase 6] v6.18.53 function matches parent; MAX_GPU_INSTANCE=64
- [Phase 8] Failure mode: OOB write into BSS → corruption/oops; severity HIGH, trigger uncommon
- UNVERIFIED: exact discovery method (no public reproducer)
The patch is a 7-line bounds check that stops a real out-of-bounds write in RAS MCE GPU tracking. The buggy store is in this 6.18.53 tree, the tree never shrinks the list on teardown, and the change is obviously correct with negligible regression risk.
**YES**
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -0
@@ -4814,6 +4814,13 @@ static void amdgpu_register_bad_pages_mca_notifier(struct amdgpu_device *adev)* Use this list instead of mgpu_info to find the amdgpu * device on which the UMC error was reported. */ +if (mce_adev_list.num_gpu >=MAX_GPU_INSTANCE ) { +dev_warn_ratelimited (adev->dev, +"mce_adev_list full, skip notifier registration (max=%d)\n" , +MAX_GPU_INSTANCE ); +return ; + } + mce_adev_list.devs[mce_adev_list.num_gpu++] = adev;/*
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: cec: tegra: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 8dcf23edaf4bdf22259f6a47cfddc8bb1467425c ]
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication.
---
LLM Generated explanations, may be completely bogus:
This is a one-line OF module-alias fix on a driver that has been in the tree since v4.15. Local checkout is **v7.3-rc4** (7.3.0-rc4, f0100363d8c37), not a numbered stable branch. The candidate is 8dcf23edaf4bd.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [media/cec/tegra] [add] missing MODULE_DEVICE_TABLE() so OF module aliases are generated
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Pengpeng Hou <[email protected]> (author)
- Signed-off-by: Hans Verkuil <[email protected]> (CEC/Tegra CEC maintainer; applied the patch)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Link:, or Cc: stable
- Absence of Fixes:/Cc: stable is expected for this review pipeline and is not a negative signal
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: OF match table is wired to .of_match_table but not exported via MODULE_DEVICE_TABLE(of, ...).
- Symptom: when CONFIG_CEC_TEGRA=m, depmod/modinfo get no of: aliases, so udev will not autoload tegra_cec.ko for nvidia,tegra114-cec / tegra124-cec / tegra210-cec.
- Version info: none in the message. Git shows the match table dates to the original driver (v4.15-rc1).
- Root cause: missing module-alias publication, not a probe/runtime logic error.
- Author states this is a source-level finding, not a live hardware repro.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a disguised cleanup. It is an explicit autoload/hardware- enablement fix. The “source-level” wording is candor, not a claim that nothing is wrong.
===============================================================
PHASE 2: DIFF ANALYSIS
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/media/cec/platform/tegra/tegra_cec.c (+1 / -0)
- Functions: none. Adds MODULE_DEVICE_TABLE(of, tegra_cec_of_match) after the existing tegra_cec_of_match[] table.
- Scope: single-file, one-line surgical change.
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: table exists and is assigned to platform_driver.driver.of_match_table, so a **already loaded** or **built-in** driver still matches DT nodes.
- After: scripts/mod/file2alias.c also emits of: modaliases into the .ko, so userspace can autoload the module from sysfs modalias.
- Path affected: module build / autoload, not probe/remove/IRQ/CEC transfer.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: hardware enablement / missing device-table export (same family as adding IDs).
- Mechanism: MODULE_DEVICE_TABLE() creates the __mod_device_table__kmod_* alias that file2alias.c consumes. Without it, the kernel can bind the driver once loaded, but the module will not be loaded automatically.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct: sibling CEC platform drivers (stm32-cec, meson/ao-cec, s5p_cec, stih-cec, cec-gpio) already use the same pattern.
- Minimal: one line, no API/struct/locking change.
- Regression risk: very low. Builtin builds are unaffected at runtime; modular builds only gain aliases.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Match table introduced in 9d2d60687c9a06 ("media: tegra-cec: add Tegra HDMI CEC driver", Hans Verkuil, 2017-07-15; first contained in **v4.15-rc1**).
- Original file had the OF table and .of_match_table = of_match_ptr(...) and **no** MODULE_DEVICE_TABLE.
- Bug has been present for the entire life of the driver.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Not applicable. Introduction commit is 9d2d60687c9a06, present in this tree (git merge-base --is-ancestor of the candidate vs HEAD succeeds).
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record (recent on this file):
- 7bc1f3c8bd673 (2023): drop of_match_ptr so the table is always used (build fix for !OF).
- 8dcf23edaf4bd (this commit)
- Later functional CEC fixes (be627f257ce28, bce7236c16c2c) do not depend on this line.
- Standalone; not patch X/Y.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record:
- Pengpeng Hou submitted a large set of “add missing MODULE_DEVICE_TABLE()” patches (rtc, vdpa, watchdog, fbdev, soc, can, clk, power, this CEC driver). Same recipe, LLM-style commit text.
- Hans Verkuil is listed maintainer of ARM/TEGRA HDMI CEC and applied this patch. That is a strong quality signal for the **change**, even if the author is doing a sweep.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: None. The macro has existed for decades (include/linux/module.h). The table and .of_match_table assignment are original. Applies standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c 8dcf23edaf4bd →
https://patch.msgid.link/[email protected]
- Single revision (v1 only). b4 dig -a also matched an unrelated 2024 Liao Chen v4l2-subdev series by patch-id search noise; this commit is a standalone v1.
- Direct lore HTTP fetch returned 403; full thread was saved via b4 dig -m to /tmp/tegra_cec_moddev.mbox.
- NVIDIA Tegra developer Mikko Perttunen replied 2026-07-15: objected to the “source-level fix / no dynamic hardware reproduction” paragraph as AI boilerplate, and said **“Otherwise looks fine to me.”** No NAK. No request for v2. Hans applied v1 as-is (that paragraph remained).
- No reviewer asked for Cc: stable.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): To/Cc included Hans Verkuil, Mauro Chehab, Thierry Reding, Jonathan Hunter, linux-tegra, linux-media, linux-kernel. Right lists and maintainers. Informal ack from Mikko Perttunen (NVIDIA); applied by Hans Verkuil.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No Reported-by, bugzilla, or syzbot. Evidence is the missing export next to a live OF table. No user report of failed autoload was found.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Same-day author sweep of missing MODULE_DEVICE_TABLE across subsystems. Not a dependent series; each driver patch is self-contained. Sibling CEC OF drivers already had the macro.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: No lore.kernel.org/stable thread for this exact Tegra CEC patch (search did not return a relevant hit). Same-class patches **have** gone into stable before, including:
- PCI: tegra: Add missing MODULE_DEVICE_TABLE on 4.19-stable
- can: ctucanfd: add missing MODULE_DEVICE_TABLE() from the same author, committed to linux-stable by Greg Kroah-Hartman (d937bdb244a75 upstream)
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: No functions modified. Macro addition adjacent to tegra_cec_of_match[]. Related structures: tegra_cec_driver (module_platform_driver).
Step 5.2: TRACE CALLERS
Record: tegra_cec_probe is the platform probe (DT device instantiation). MODULE_DEVICE_TABLE is not called at runtime; scripts/mod/file2alias.c do_table() consumes the alias at module build. Impact surface is autoload of tegra_cec.ko only.
Step 5.3: TRACE CALLEES
Record: N/A for the added line. The driver already includes <linux/module.h> and <linux/of.h>.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Reachable for users with CONFIG_CEC_TEGRA=m on Tegra 114/124/210 HDMI CEC DT nodes (e.g. Jetson TK1 / older Tegra boards). Unprivileged userspace cannot trigger a crash; the user-visible failure is “CEC adapter never appears until modprobe tegra_cec”. Builtin (=y) is already fine.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Other CEC platform drivers already export OF tables. This file was the outlier. Same missing-macro pattern exists across many drivers and is treated as a real autoload bug.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. File drivers/media/cec/platform/tegra/tegra_cec.c exists. Pre-commit parent still has the OF table and .of_match_table without the macro. Candidate **is already an ancestor of HEAD** (git merge-base --is-ancestor 8dcf23edaf4bd HEAD). Bug introduced v4.15-rc1; present in every long-lived stable series that has this driver.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Expected apply: **clean**. Context around the table (compatibles tegra114/124/210) is original. Later commits only add the macro and then unrelated CEC protocol fixes. Line numbers differ slightly on current HEAD because of later edits, but the hunk is trivial.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: This is the fix; it is already in this 7.3-rc4 tree. No earlier substitute autoload fix on this file. 7bc1f3c8bd673 only dropped of_match_ptr; it did not add aliases.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: drivers/media/cec/platform/tegra/ — HDMI CEC on NVIDIA Tegra.
Criticality: **PERIPHERAL** (SoC-specific media driver), but real product hardware (Jetson TK1 and Tegra X1 designs were the original test targets).
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Low churn. Driver added 2017; occasional correctness fixes. Mature. The missing macro is long-standing, not a regression from recent refactoring.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Driver-specific / config-specific: CONFIG_CEC_TEGRA=m on DT platforms with nvidia,tegra114-cec, nvidia,tegra124-cec, or nvidia,tegra210-cec. Not universal.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Every boot/hotplug of that DT node when the driver is a module and nothing else loads it. Common on distros that package CEC as a module; irrelevant if the vendor kernel builds it in. Not a race. Not triggerable as a crash by unprivileged users.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: HDMI CEC device never binds until manual modprobe. No oops, leak, or corruption. Severity: **MEDIUM** for those boards (feature/hardware dead), **LOW** globally. This is the same user-visible class as “device ID missing so the module never loads.”
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: restores intended autoload for modular Tegra CEC; matches every other CEC OF driver.
- Risk: one compile-time alias line; no runtime path change.
- Ratio: high benefit for affected users, negligible risk.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR backporting:
- Real bug: OF match table used by the platform driver is not published to module aliases.
- CEC_TEGRA is **tristate**; modular builds are first-class.
- One line, obviously correct, no new API.
- Same pattern as the documented **device-ID / hardware enablement** exception.
- Maintainer-applied (Hans Verkuil); NVIDIA engineer said the change looks fine.
- Sibling CEC drivers already have MODULE_DEVICE_TABLE(of, ...).
- Bug present since v4.15; no prerequisites.
- Same class of patches has historically been accepted into stable (including this author’s can: ctucanfd MODULE_DEVICE_TABLE fix).
AGAINST:
- Not a crash, UAF, deadlock, or security hole.
- No end-user report; author did not claim hardware reproduction.
- Peripheral SoC driver; small user population.
- Author is doing a mass static-analysis sweep; commit text was called out as AI boilerplate.
- Builtin kernels are unaffected.
UNRESOLVED:
- Could not HTTP-fetch lore (403); discussion recovered from b4 dig -m instead.
- Could not find a stable-list thread for **this** SHA.
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — one well-known macro; applied by the subsystem maintainer; NVIDIA developer agreed. Build- tested at least (author/reviewer).
2. Fixes a real bug that affects users? **PASS** — modular autoload for real Tegra CEC DT compatibles.
3. Important issue? **PASS** under the hardware-enablement exception (device does not come up). Not CRITICAL crash/corruption.
4. Small and contained? **PASS** — +1 line, one file.
5. No new features or APIs? **PASS** — publishes an existing table.
6. Can apply to the local tree? **PASS** — file and table exist; hunk is trivial. (This 7.3-rc4 tree already contains the commit.)
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Device ID / module alias publication for an existing driver.** Closest listed exception is new device IDs; this is the matching half (exporting the IDs the driver already matches). Also analogous to quirks/DT enablement: it makes already-supported hardware actually attach when built as a module.
Step 9.4: MAKE YOUR DECISION
The local tree is mainline **7.3.0-rc4**. The driver and buggy omission exist here and in any stable series that still has tegra_cec. The patch is a one-line, maintainer-acked autoload fix with no runtime risk. That is stable material.
What problem it solves for stable users: with CONFIG_CEC_TEGRA=m, udev never loads the module from the DT compatible, so HDMI CEC stays dead until a manual modprobe. Distros that ship this as a module on Jetson/Tegra boards hit that.
Risk vs benefit: benefit is hardware actually probing; risk is essentially zero.
Verification:
- [Phase 1] Parsed tags: author + Hans Verkuil SOB only; no Fixes/Reported-by/Cc: stable
- [Phase 1] Body describes missing OF alias publication, not a crash
- [Phase 2] Diff: +1 line MODULE_DEVICE_TABLE(of, tegra_cec_of_match) in tegra_cec.c
- [Phase 2] Confirmed .of_match_table = tegra_cec_of_match already present
- [Phase 3] git blame: table from 9d2d60687c9a06 (v4.15-rc1); macro from 8dcf23edaf4bd
- [Phase 3] Original driver dump: no MODULE_DEVICE_TABLE
- [Phase 3] Author sweep of similar one-liners; Hans is MAINTAINERS owner of ARM/TEGRA HDMI CEC
- [Phase 4] b4 dig -c 8dcf23edaf4bd:
https://patch.msgid.link/[email protected]
- [Phase 4] b4 dig -a: single v1; no later revision
- [Phase 4] b4 dig -w: linux-media, linux-tegra, Hans, Mauro, Thierry Reding, Jonathan Hunter
- [Phase 4] mbox: Mikko Perttunen “Otherwise looks fine to me”; complaint was about AI commit-message padding only
- [Phase 4] lore WebFetch 403; content taken from mbox
- [Phase 4] No stable@ thread for this SHA; same-class MODULE_DEVICE_TABLE patches have landed in stable
- [Phase 5] Kconfig CEC_TEGRA is tristate; Makefile obj-$(CONFIG_CEC_TEGRA) += tegra_cec.o
- [Phase 5] MODULE_DEVICE_TABLE in include/linux/module.h creates file2alias symbol; scripts/mod/file2alias.c do_table() consumes it
- [Phase 5] Other CEC OF drivers already have the macro
- [Phase 6] git describe HEAD: v7.3-rc4-27-gf0100363d8c37; make kernelversion: 7.3.0-rc4
- [Phase 6] git merge-base --is-ancestor 8dcf23edaf4bd HEAD: yes (already in this tree)
- [Phase 6] Backport difficulty: clean one-liner
- [Phase 7] Peripheral media driver, maintainer-applied
- [Phase 8] Failure mode: module not autoloaded → CEC unused; severity MEDIUM for Tegra modular users, not a panic
- UNVERIFIED: live udev autoload on real Tegra hardware (author did not claim it)
**YES**
drivers/media/cec/platform/tegra/tegra_cec.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/cec/platform/tegra/tegra_cec.c +1 -0
@@ -458,6 +458,7 @@ static const struct of_device_id tegra_cec_of_match[] = { { .compatible = "nvidia,tegra210-cec", }, {}, }; +MODULE_DEVICE_TABLE (of, tegra_cec_of_match);static struct platform_driver tegra_cec_driver = { .driver = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nvmem: brcm_nvram: reject empty NVRAM partition
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit fde46579cf8872138b296349c2bd8a3cd3f132e2 ]
If the partition is completely erased (all padding bytes), the trimming loop reduces data_len to 0. devm_kzalloc(dev, 0, GFP_KERNEL) returns ZERO_SIZE_PTR ((void *)16), which is non-NULL and bypasses the NULL check. The subsequent cast of priv->data to struct brcm_nvram_header * and dereference of header->magic causes a page fault on address 0x10.
Reject data_len smaller than the header before allocating.
---
LLM Generated explanations, may be completely bogus:
Local tree is **6.6.157** (pending-6.6). The empty-NVRAM oops path is present here and the 5-line guard is not. This is a real boot-time page fault on Broadcom Northstar boards, and the patch applies cleanly.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[nvmem/brcm_nvram] [reject] reject empty NVRAM partition**
- Subsystem: nvmem: brcm_nvram
- Verb: **reject** — defensive check, not a feature
- Intent: refuse to probe when the cached NVRAM image is smaller than the on-flash header
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- **Fixes:** none (expected for this review pipeline)
- **Reported-by / Tested-by / Reviewed-by / Acked-by:** none
- **Assisted-by:** opencode:big-pickle
- **Signed-off-by:** Rosen Penev (author); Srinivas Kandagatla (nvmem maintainer); Greg Kroah-Hartman (char-misc)
- **Link:** https://patch.msgid.link/[email protected] — this is patch 12/14 of Srinivas’s later char-misc pull, not a dependency series
- **Cc: stable:** none (not a negative signal)
- Original submission was a standalone [PATCH] ([email protected]), applied as mainline 5f75913830bc
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- **Bug:** erased NVRAM (all padding bytes) makes the trim loop set data_len = 0
- **Symptom:** devm_kzalloc(..., 0) returns ZERO_SIZE_PTR ((void *)16), the if (!priv->data) check passes, then brcm_nvram_parse() dereferences header->magic and **page-faults at address 0x10**
- **Root cause:** zero-size kmalloc is not NULL; the code treats it as a valid buffer
- **Fix:** return -EINVAL if data_len < sizeof(struct brcm_nvram_header) before allocating
- **Versions:** none named; the buggy trim-and-cache path was added by nvmem: brcm_nvram: store a copy of NVRAM content
Step 1.4: DETECT HIDDEN BUG FIXES
Record: **Not hidden.** This is an explicit crash fix. The wording matches the code.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- **File:** drivers/nvmem/brcm_nvram.c — **+5 / −0**
- **Function:** brcm_nvram_copy_data()
- **Scope:** single-file surgical error-path check
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- **Before:** trim padding → WARN if huge → devm_kzalloc(data_len) → copy → parse
- **After:** same, but if data_len is smaller than the 20-byte header, log and return -EINVAL
- **Path:** probe/init only (subsys_initcall_sync → brcm_nvram_probe → brcm_nvram_copy_data)
- Probe already returns copy_data errors, so this fails the driver instead of oopsing
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- **Category:** memory safety / NULL-check bypass (ZERO_SIZE_PTR) leading to a **NULL-ish deref / page fault**
- **Mechanism:** devm_kmalloc() returns ZERO_SIZE_PTR for size 0 (verified in this tree). That pointer is non-NULL, so the allocation “succeeded.” brcm_nvram_parse() then does memcmp(header->magic, ...) at address 0x10
- Also covers 1 <= data_len < sizeof(header), which would be a short buffer under the same parse
Step 2.4: ASSESS THE FIX QUALITY
Record:
- **Obviously correct:** you cannot parse a header that is not there
- **Minimal:** 5 lines, no API/locking/structure change
- **Regression risk:** very low. Worst case: probe fails with -EINVAL and NVRAM cells are missing (MAC fallback), instead of a boot oops
- **Red flags:** none. The later sibling “malformed flash OOB” patch is independent
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Trim loop, devm_kzalloc(priv->data_len), and parse were introduced by **09283d60bc332** (nvmem: brcm_nvram: store a copy of NVRAM content, upstream 1e37bf84afacd)
- That landed in **this tree in v6.6.9** (git describe --contains → v6.6.9~19)
- Original v6.6 did **not** have this path (git merge-base --is- ancestor 09283d60bc332 v6.6 failed)
Step 3.2: FOLLOW THE FIXES: TAG
Record: **No Fixes: tag.** The buggy commit is nonetheless identified:09283d60bc332 / 1e37bf84afacd, present in this tree. This is a **stable-to-stable follow-up** to a 6.6.9 backport.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record:
- Last change to this file in *this* tree is the copy-data backport itself
- Rosen also sent a sibling patch the same day: nvmem: brcm_nvram: fix out-of-bounds access on malformed flash data (pull 13/14). That tightens header->len vs data_len. **Not a prerequisite** for this empty-partition check
- Original author series was **v1 standalone [PATCH]**, later batched as 12/14 in Srinivas→Greg pull
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record:
- Rosen Penev has no prior drivers/nvmem/ commits in this tree
- Srinivas Kandagatla is the nvmem maintainer and applied it (Applied, thanks! / commit 5f75913830bc)
- Original driver author Rafał Miłecki was CCed; no NAK in the thread
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record:
- Depends only on brcm_nvram_copy_data() + struct brcm_nvram_header, both in this tree
- **Can apply standalone.** Insertion context matches exactly
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- **b4 dig -c 5f75913830bc:**
https://patch.msgid.link/[email protected]
- **b4 dig -a:** only **v1**; applied version is that v1
- Thread is 2 messages: patch + maintainer apply. **No NAK, no requested respin**
- lore.kernel.org WebFetch returned 403; thread recovered via b4 mbox + openwall/lkml mirrors
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w):
- To: linux-kernel
- Cc: Srinivas Kandagatla (maintainer), [email protected] (driver author)
- Applied by the subsystem maintainer; no extra Reviewed-by
Step 4.3: SEARCH FOR THE BUG REPORT
Record: **No Reported-by, no syzbot, no bugzilla.** The crash mechanism is spelled out (fault at 0x10) and matches the code. Trigger is an erased NVRAM image (all 0xFF/0x00), which is a real flash state.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record:
- Standalone v1 from Rosen
- Later 12/14 is only the maintainer pull batch
- Sibling OOB-length fix is related but **not required** for this patch to be correct
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: No useful stable-list hit for this subject. Absence of Cc:
stable is expected for this review.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: brcm_nvram_copy_data() (modified). Crash consumer:brcm_nvram_parse(). Caller: brcm_nvram_probe().
Step 5.2: TRACE CALLERS
Record:
- brcm_nvram_copy_data ← only brcm_nvram_probe
- brcm_nvram_probe ← platform driver, registered from brcm_nvram_init via **subsys_initcall_sync**
- Reachable at **boot** on DT nodes compatible = "brcm,nvram"
Step 5.3: TRACE CALLEES
Record: devm_platform_get_and_ioremap_resource, readb trim loop, devm_kzalloc, memcpy_fromio, bcm47xx_nvram_init_from_iomem (return value already ignored). bcm47xx_nvram_is_valid() reads **iomem**, not priv->data, so it does not crash first; copy_data still returns 0 and parse faults.
Step 5.4: FOLLOW THE CALL CHAIN
Record:
Boot → brcm_nvram_init → probe → copy_data (data_len=0, ZERO_SIZE_PTR) → parse → memcmp(header->magic) at 0x10 → **oops**
- Userspace syscall not required
- **Yes, reachable** on BCM5301X with an empty/erased NVRAM mapping
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: devm_kmalloc() in this tree explicitly return ZERO_SIZE_PTR when !size. Same class of bug as other “kmalloc(0) is not NULL” crashes. Sibling OOB check in parse is a related malformed-flash bug, not a duplicate of this one.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: **Yes.** drivers/nvmem/brcm_nvram.c lines 78–89 (trim + devm_kzalloc) and 177–187 (header deref). Introduced in **v6.6.9**. Mainline fix 5f75913830bc is **not** an ancestor of HEAD. Source has no “NVRAM data too small” check.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply.** Context around the WARN/devm_kzalloc site matches. MAC_ADDR_STR_LEN vs 3 * ETH_ALEN - 1 is a different function and is not touched.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: No “empty NVRAM” / “data too small” commit in this tree. No alternate fix.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: **nvmem / Broadcom NVRAM driver.** Criticality: **PERIPHERAL** (ARCH_BCM_5301X routers), but real shipping hardware. 16 DT files in this tree already have compatible = "brcm,nvram" (Luxul, Linksys, D-Link, Asus, etc.). CONFIG_NVMEM_BRCM_NVRAM depends on ARCH_BCM_5301X || COMPILE_TEST.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: This driver is mature; last local change is the 6.6.9 cache-copy backport. The bug is in that long-lived path, not in brand-new mainline- only code.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Driver-specific / platform-specific** — BCM5301X boards with a brcm,nvram node (OpenWrt and similar). Not universal.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- Trigger: NVRAM window is all padding (erased flash 0xFF, or all zeros)
- Happens at **device probe / boot**, not a rare runtime race
- Not an unprivileged syscall exploit; it is a **boot oops** on those machines
- Realistic after wipe, bad flash, or empty factory partition
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: **Kernel oops / page fault during probe.** Severity: **HIGH** (boot crash on affected boards). Not a silent corruption bug, but it takes the kernel down instead of failing probe.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- **Benefit:** high for BCM5301X users with empty/wiped NVRAM; converts oops → clean -EINVAL
- **Risk:** very low (5 lines, error path only, no locking)
- **Ratio:** strongly favors backport. This is also a fix for a bug **introduced by an earlier stable backport** (6.6.9)
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
**FOR:**
- Concrete oops: dereference of ZERO_SIZE_PTR at 0x10
- Buggy path exists in this 6.6.157 tree (since 6.6.9)
- 5-line, obviously correct guard; probe already handles -EINVAL
- Maintainer-applied; no NAK
- Clean apply; no prerequisites
- Follow-up to a stable backport that added the trim-and-allocate logic
**AGAINST:**
- No public Reported-by / Tested-by
- Driver is platform-specific, not core
- Empty NVRAM is not every-boot on healthy devices
**UNRESOLVED:**
- Direct lore.kernel.org HTTP fetch was 403 (thread recovered via b4)
- No independent user report found beyond the author’s analysis
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — mechanism matches devm_kmalloc(0) and parse; maintainer applied v1
2. Fixes a real bug that affects users? **PASS** — oops on erased NVRAM; DT boards in this tree use the driver
3. Important issue (crash, security, corruption, deadlock)? **PASS** — boot-time page fault
4. Small and contained? **PASS** — +5 lines, one function
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — context identical
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: Not a device-ID/quirk/DT/build/docs exception. Ordinary crash fix.
Step 9.4: MAKE YOUR DECISION
Backport. The local tree has the 6.6.9 cache-copy code that created this kmalloc(0) oops; the guard is tiny and fails probe instead of taking a fault.
===============================================================
What this solves for stable users
===============================================================
On this 6.6.y tree, brcm_nvram_copy_data() trims trailing padding and allocates data_len bytes. If the mapped NVRAM is fully erased, data_len becomes 0. devm_kzalloc(dev, 0) returns (void *)16, parse treats that as a header, and the kernel oopses at boot. The patch rejects anything smaller than struct brcm_nvram_header (20 bytes) and returns -EINVAL, which brcm_nvram_probe() already handles.
It meets the stable rules: real crash, tiny, no API change, applies cleanly, and it closes a hole opened by a prior 6.6.9 stable backport.
Risk vs benefit: very low risk, high benefit on BCM5301X when NVRAM is empty. The sibling malformed-length OOB patch is useful later but is not required for this one.
===============================================================
Verification
===============================================================
- [Phase 1] Parsed tags: no Fixes/Reported-by; SOBs Rosen/Srinivas/Greg; Link is Srinivas 12/14 pull of a standalone v1
- [Phase 2] Diff: +5 lines in brcm_nvram_copy_data() before devm_kzalloc
- [Phase 2] include/linux/device.h: devm_kzalloc → devm_kmalloc; drivers/base/devres.c:833-834: size 0 returns ZERO_SIZE_PTR; include/linux/slab.h:175: ((void *)16)
- [Phase 2] brcm_nvram_parse() at lines 179–184 dereferences header->magic — matches “page fault on address 0x10”
- [Phase 3] git blame: trim/alloc from 09283d60bc332; git describe --contains → v6.6.9~19; not in v6.6
- [Phase 3] git merge-base --is-ancestor 5f75913830bc HEAD → not ancestor (fix absent)
- [Phase 3] git log --grep='empty NVRAM' on drivers/nvmem/ → empty
- [Phase 4] b4 dig -c 5f75913830bc: original URL [email protected]
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] b4 dig -w: linux-kernel, Srinivas, Rafał; mbox: patch + “Applied, thanks!”; no NAK
- [Phase 4] lore WebFetch 403; used b4 + openwall/lkml instead
- [Phase 5] Callers: only brcm_nvram_probe; subsys_initcall_sync
- [Phase 5] bcm47xx_nvram_init_from_iomem reads iomem magic; return ignored so parse still runs
- [Phase 6] git describe HEAD → p-6.6-3-g04810563abb71; make kernelversion → **6.6.157**
- [Phase 6] Patch context around WARN/kzalloc matches; clean apply expected
- [Phase 7] 16 arch/arm/boot/dts/broadcom/*.dts* files with brcm,nvram; Kconfig NVMEM_BRCM_NVRAM depends on ARCH_BCM_5301X
- [Phase 8] Failure mode: probe-time oops, severity HIGH
- UNVERIFIED: no independent end-user crash log; mechanism verified from code anyway
**YES**
drivers/nvmem/brcm_nvram.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvmem/brcm_nvram.c +5 -0
@@ -84,6 +84,11 @@ static int brcm_nvram_copy_data(struct brcm_nvram *priv, struct platform_device }WARN (priv->data_len >SZ_128K ,"Unexpected (big) NVRAM size: %zu B\n" , priv->data_len); +if (priv->data_len <sizeof (struct brcm_nvram_header )) { +dev_err (priv->dev,"NVRAM data too small (%zu)\n" , priv->data_len); +return -EINVAL ; + } + priv->data =devm_kzalloc (priv->dev, priv->data_len,GFP_KERNEL );if (!priv->data)return -ENOMEM ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ACPI: scan: Defer device power initialization
In reply to Sasha LevinFrom: Peixin Xie <[email protected]>
[ Upstream commit dc948f8b384a516ac5c471eb9382959f838e02f4 ]
acpi_bus_get_power_flags() initializes the device power state while the ACPI device object is being created, before checking whether the device is ready for enumeration.
If enumeration is deferred, acpi_bus_attach() clears the initialized and power_manageable flags. When the dependency is later satisfied, acpi_bus_init_power() is called again and takes additional references to the power resources used by the device. These references prevent the resources from being turned off when the device enters D3.
This issue was reproduced on a SpacemiT K3 RISC-V Pico-ITX. The affected device uses a power resource through _PR0 and has an automatically derived dependency on its interrupt controller.
The initial power initialization acquires a power resource reference. The device is then deferred, but that reference is not dropped. When the dependency becomes available, power initialization acquires another reference. Consequently, entering D3 only drops the reference count from 2 to 1 and _OFF is not evaluated:
[ 0.314611] ACPI Debug: "I2P2 _STA" [ 0.318260] ACPI: \_SB_.I2P2: ACPI: PM: Power resource is on [ 0.323998] ACPI: \_SB_.I2P2: New power resource [ 0.382108] ACPI Debug: "I2P2 _STA" [ 0.478964] ACPI Debug: "I2P2 _ON" [ 0.482498] ACPI: \_SB_.I2P2: ACPI: PM: Power resource turned on [ 0.488597] ACPI Debug: "I2C2, PS0" [ 0.863170] ACPI: \_SB_.I2P2: ACPI: PM: Power resource already on [ 0.873686] ACPI Debug: "I2C2, PS0" [ 2.416055] ACPI Debug: "I2C2, PS3" [ 2.423397] ACPI: \_SB_.I2P2: ACPI: PM: Power resource still in use
To address this, remove the early acpi_bus_init_power() call and leave regular ACPI device objects uninitialized until acpi_bus_attach() runs after the device is ready for enumeration.
Power resource objects are initialized through acpi_add_power_resource() and do not require the generic initialization in acpi_bus_attach(), so mark them as initialized there.
After the change, device power state initialization is deferred until its dependency is met. Since no reference is acquired before then, the power resource left on by firmware is turned off as unused after the namespace scan. Once the dependency is met, the resource is turned on once for the device and is turned off normally when the device later enters D3:
[ 0.314628] ACPI Debug: "I2P2 _STA" [ 0.318277] ACPI: \_SB_.I2P2: ACPI: PM: Power resource is on [ 0.324016] ACPI: \_SB_.I2P2: New power resource [ 0.382118] ACPI Debug: "I2P2 _STA" [ 0.496116] ACPI: \_SB_.I2P2: ACPI: PM: Turning OFF [ 0.501081] ACPI Debug: "I2P2 _OFF" [ 0.504705] ACPI: \_SB_.I2P2: ACPI: PM: Power resource turned off [ 1.415899] ACPI Debug: "I2P2 _ON" [ 1.418866] ACPI: \_SB_.I2P2: ACPI: PM: Power resource turned on [ 1.424947] ACPI Debug: "I2C2, PS0" [ 2.647655] ACPI Debug: "I2C2, PS3" [ 2.654856] ACPI Debug: "I2P2 _OFF" [ 2.654866] ACPI: \_SB_.I2P2: ACPI: PM: Power resource turned off
This also avoids powering up devices before their dependencies are available.
---
LLM Generated explanations, may be completely bogus:
The local tree is 6.12.111. The buggy ACPI power-init path is present here, so the rest of this is whether the leak is backport-worthy for this checkout.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [ACPI: scan:] [Defer] [device power initialization] Subsystem ACPI scan/PM. “Defer” is a timing change that the body presents as a leak fix, not a feature.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Signed-off-by: Peixin Xie \<[email protected]\> (author)
- [ rjw: Changelog edits ] — ACPI maintainer edited the changelog
- Link: https://patch.msgid.link/20260820-acpi-power-resource-ref-
[email protected]
- Signed-off-by: Rafael J. Wysocki \<[email protected]\> (ACPI/PM maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable (absence is expected)
- Ignore any pipeline “Upstream commit” / Sasha Levin SOB if present
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: acpi_bus_get_power_flags() calls acpi_bus_init_power() while the ACPI device is created, before readiness for enumeration. If attach defers the device, it clears initialized and power_manageable without dropping power-resource refs. Later re-init takes a second ref. D3 then drops 2→1 and _OFF is never evaluated.
- Symptom: power resource “still in use”; device stays powered in D3. Reproduced on SpacemiT K3 RISC-V Pico-ITX (I2C with _PR0, auto-dep on interrupt controller). Logs show _ON twice, then _PS3 without _OFF.
- Root cause: leaked power-resource ref_count across deferred enumeration.
- Fix: drop the early acpi_bus_init_power(); leave initialized false until acpi_bus_attach() after the device is ready; mark power- resource objects initialized in acpi_add_power_resource(). Side
effect: firmware-on unused resources can be turned off after namespace scan, then turned on once when the dependency is met.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: This is an explicit bug fix (unbalanced power-resource refs), not a disguised cleanup. The subject says “Defer” because that is the mechanism.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- drivers/acpi/power.c: +1 (device->flags.initialized = true in acpi_add_power_resource())
- drivers/acpi/scan.c: −4 (remove acpi_bus_init_power() from acpi_bus_get_power_flags(); remove initialized = true from acpi_init_device_object())
- Functions: acpi_add_power_resource, acpi_bus_get_power_flags, acpi_init_device_object
- Scope: single-subsystem, surgical (~5 lines)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Hunk 1 (power.c): power-resource objects skip generic attach init; they must still be marked initialized so later acpi_bus_attach() does not treat them as uninitialized ACPI devices.
- Hunk 2 (acpi_bus_get_power_flags): still discovers _PRx/_PSx and fills state lists, but no longer takes refs / evaluates _ON at object-creation time.
- Hunk 3 (acpi_init_device_object): initialized stays false (kzalloc-zeroed) until attach. Existing attach path already does:
- not ready → leave uninitialized, clear power_manageable
- ready && !initialized → acpi_bus_init_power() once, then set initialized
Before: init at create (ref=1) → defer (flags cleared, ref still 1) → later init (ref=2) → D3 (ref=1, no _OFF).
After: no early ref → defer → later init (ref=1) → D3 (ref=0, _OFF).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: Reference-counting / resource leak (ACPI power-resource ref_count, not kmalloc). acpi_power_on_unlocked() does ref_count++; acpi_power_off_unlocked() only calls _OFF when count hits 0. Extra init leaves a sticky ref so D3 never turns the resource off. Category: logic/correctness + PM refcount.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct relative to the attach-time init path that has existed since 2015 (1b1f3e1699a988). Minimal. Regression risk is the global move of first acpi_bus_init_power() from add to attach for every ACPI device, plus unused resources of deferred devices being turned off after scan (existing DMI quirks already cover platforms that cannot tolerate that). For devices ready immediately, attach still runs in the same acpi_bus_scan() before driver probe, so common x86/ACPI paths stay equivalent. Power-resource initialized=true is required so walk-of-children attach does not mis-init those objects. Early devices that skip acpi_bus_attach() (fixed power/sleep button, ECDT EC) typically have no _PR0/_PS0; acpi_device_enumerated() was already false because visited is unset — verified no change there.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Early acpi_bus_init_power() in acpi_bus_get_power_flags:
1b1f3e1699a988 (2015-01-05, “ACPI / PM: Fix PM initialization for devices that are not present”) — in this tree.
- initialized = true in acpi_init_device_object: 202317a573b20d (2013-11-22) — in this tree.
- Attach-time re-init: same 2015 commit.
- The leak becomes reachable when enumeration is deferred *and* the device is still present (acpi_dev_ready_for_enumeration() can fail on honor_deps && dep_unmet while acpi_device_is_present() is true). Honor-deps: 9d9bcae47fd5a (2021, INT3472). RISC-V PLIC/APLIC on the honor list: 15f210f43e95f (2024-08-27) — ancestor of v6.12 and of HEAD.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. The interaction is old init (2013–2015) plus deferred enumeration (2021, much wider on RISC-V ACPI in 6.12).
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent scan.c work is honor-list and dep-scan (15f210f43e95f, b38c61f1f394d, 0dae3d96ca011). Recent power.c work includes unused-resource DMI quirks (d08fb559b4557, 9b04d99788cf4). This patch is standalone, not “2/N”. v1 was a different approach (forced D3cold on defer); v2 replaced it.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: No prior Peixin Xie ACPI commits in this tree. The design is Rafael’s (v1 review), and he applied v2.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Uses existing acpi_bus_attach() uninitialized path. acpi_init_device_object() callers in this tree are only acpi_add_single_object() and acpi_add_power_resource(). No missing helpers. Standalone; applies to this tree.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- v2 lore msgid: 20260820-acpi-power-resource-ref- [email protected]
- v1: 20260811-acpi-power-resource-ref- [email protected]
- v1: drop refs by acpi_power_transition(..., D3_COLD) on the not- ready path. Rafael: pointless to power up then immediately down; drop early acpi_bus_init_power() and init once when ready.
- Author tested that on SpacemiT K3; runtime suspend/resume balanced.
- Rafael then asked to clear initialized in acpi_init_device_object() and set it in acpi_add_power_resource() (exactly v2).
- v2 reply from Rafael: “Applied as 7.3-rc material, thanks!” No NAK. No reviewer Cc: stable.
- Base-commit on the patch: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5 (mainline-era, not this branch).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To/Cc: Rafael J. Wysocki, Len Brown, Yixun Lan, linux-acpi, linux-kernel, linux-riscv, spacemit. Maintainer designed and applied it. No extra Reviewed-by.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot/bugzilla. Hardware report from the author with before/after ACPI Debug traces (I2C2/I2P2 in v2; USBD.PDPR in v1). Real- world, not theoretical.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Single-patch series, v1→v2 only. No extra patches required for the leak itself.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: No stable@ discussion found for this msgid. Not a reason to reject.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: acpi_bus_get_power_flags, acpi_init_device_object, acpi_add_power_resource. Callers of the removed init:acpi_bus_init_power still from acpi_bus_attach and acpi_device_update_power.
**Step 5.2: TRACE CALLERS**
Record:
- acpi_bus_get_power_flags() ← acpi_add_single_object() during namespace scan.
- acpi_init_device_object() ← acpi_add_single_object(), acpi_add_power_resource().
- acpi_bus_attach() ← acpi_bus_scan() (pass 1), acpi_scan_clear_dep_fn() (deferred), hotplug attach.
- acpi_scan_add_dep() sets honor_dep when the supplier HID is in acpi_honor_dep_ids (PLIC RSCV0001, APLIC RSCV0002, INT3472, IVSC, PNP0C0F, ACPI0016, …). RISC-V arch_acpi_add_auto_dep() adds GSI/PLIC deps for devices with interrupts.
**Step 5.3: TRACE CALLEES**
Record: acpi_bus_init_power() → acpi_device_get_power() → acpi_power_on_resources() → acpi_power_on_list() → acpi_power_on_unlocked() (ref_count++, maybe _ON). End of acpi_scan_init() calls acpi_turn_off_unused_power_resources() only for ref_count==0.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Boot ACPI scan, no userspace needed. On RISC-V ACPI, any GSI consumer depending on PLIC/APLIC is deferred; if it also has _PR0, the leak fires (I2C and USB in the reports). On x86, INT3472/IVSC camera _DEP devices with power resources are the same class. Reachable on real hardware in this tree.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same extra-ref pattern is unique to “init, then clear flags without dropping refs.” Wakeup-resource refcount has had its own stable- worthy fixes historically; this patch does not touch that.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes.
- Tree: pending-6.12, git describe p-6.12-3-gc504cf0baa3d8, make kernelversion **6.12.111**
- drivers/acpi/scan.c:1160-1161 still calls acpi_bus_init_power() from acpi_bus_get_power_flags()
- scan.c:1844 still sets initialized = true at object creation
- scan.c:2298-2315 still clears flags on defer and re-inits if !initialized
- power.c acpi_add_power_resource() does **not** set initialized
- Subject not in git log on these files — not already applied
- RISC-V honor list + arch_acpi_add_auto_dep() are in this tree (15f210f43e95f is ancestor of v6.12)
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Clean apply. The three contexts match. Mainline kzalloc_obj vs this tree’s kzalloc is outside the hunk. Extra strcpy of name/class in this tree is also outside the hunk.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No alternate fix. Unused-resource DMI quirks are unrelated (they skip turning unused resources off).
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: ACPI scan + ACPI PM (drivers/acpi/scan.c, drivers/acpi/power.c). IMPORTANT: not mm/scheduler, but ACPI device PM on every ACPI platform. Broken D3/runtime-PM for deferred devices.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature core with ongoing honor-dep/RISC-V work in 6.11–6.12. This is a bug in that shipped 6.12 behavior, not a new 7.3-only subsystem.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Config/platform-specific, but not a toy driver. Trigger: ACPI device with _PR0/_PS0 power resources **and** deferred enumeration (honor_deps && dep_unmet). Populations: RISC-V ACPI (PLIC/APLIC auto- dep — 6.12 feature); Intel camera _DEP (INT3472/IVSC); PCI link / CXL host-bridge honor list. Unaffected: devices enumerated immediately (typical x86).
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Every boot on matching firmware. Not a race. Not unprivileged- syscall. Common on RISC-V ACPI boards with powered I2C/USB; less common on generic x86.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Power-resource ref leak → _OFF skipped → rails stay on in D3; runtime suspend does not actually power the device. Not oops/corruption/CVE. Severity **HIGH** for PM correctness and battery/embedded power; **MEDIUM** as a generic “will this brick 6.12 laptops?” risk. Author’s logs match the code (still in use is the ref_count != 0 debug in acpi_power_off_unlocked()).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: HIGH for RISC-V ACPI 6.12 users and any honor-dep + _PR0 device; restores D3/_OFF and avoids powering devices before deps exist.
- Risk: LOW. Five lines, maintainer-designed, uses the existing attach init path. Common (non-deferred) devices only shift init from add to attach in the same scan, before probe.
- Ratio: benefit > risk for this tree because 6.12 shipped RISC-V auto- deps that make the leak easy to hit.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real, reproduced leak; D3 does not turn resources off
- Buggy code and RISC-V honor-dep trigger are in 6.12.111
- Small, obviously correct, standalone
- ACPI maintainer specified v2 and applied it
- Tested with before/after traces
- Applies cleanly here
AGAINST:
- Not crash/security/filesystem corruption
- Changes first power-init timing for all ACPI devices
- Unused resources of deferred devices may _OFF after scan (intended; DMI quirks exist for broken firmware)
- No Cc: stable (not a negative per rules)
- Relatively new mainline (7.3-rc, ~Aug 2026)
UNRESOLVED:
- Mainline SHA not in this checkout (cannot merge-base the upstream commit). Not needed: the diff matches local code.
- No evidence of a revert in the month after apply (lore v2 thread is apply-only).
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — maintainer-designed; hardware logs.
2. Real bug that affects users? **PASS** — SpacemiT K3; any RISC-V ACPI _PR0 + PLIC dep.
3. Important issue? **PASS** — sticky power resources break runtime D3/_OFF; serious PM bug, not a crash. Matches “etc.” for production PM.
4. Small and contained? **PASS** — 5 lines, two ACPI files.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — contexts match; bug exists here.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID/quirk/DT/build/docs add). Qualifies as a normal bugfix.
**Step 9.4: MAKE YOUR DECISION**
This tree added RISC-V interrupt-controller honor deps. Combined with early acpi_bus_init_power(), deferred present devices leak power- resource refs and cannot leave D0 electrically. The fix is the attach- time init path this tree already has, plus marking power-resource objects initialized. That is appropriate for 6.12.y.
Verification:
- [Phase 1] Parsed tags: author SOB, Rafael SOB + changelog edits, lore Link; no Fixes/Cc:stable/syzbot
- [Phase 2] Diff: −4/+1; remove early init; delay initialized; set it in acpi_add_power_resource()
- [Phase 2] Confirmed acpi_power_on_unlocked/acpi_power_off_unlocked refcount vs “still in use” log
- [Phase 3] git describe HEAD / make kernelversion: p-6.12-3 / 6.12.111
- [Phase 3] blame: early init 1b1f3e1699a988 (2015); initialized 202317a573b20d (2013)
- [Phase 3] git merge-base --is-ancestor 15f210f43e95f HEAD and v6.12: YES (RISC-V honor list)
- [Phase 3] git merge-base --is-ancestor 9d9bcae47fd5a HEAD: YES (INT3472 honor)
- [Phase 3] git log --grep="Defer device power initialization" -- drivers/acpi/: empty (not applied)
- [Phase 4] b4 mbox v2: Rafael “Applied as 7.3-rc material”
- [Phase 4] b4 mbox v1: Rafael requested this approach; author confirmed K3
- [Phase 5] callers: acpi_add_single_object → get_power_flags; attach re-init; RISC-V arch_acpi_add_auto_dep → acpi_scan_add_dep with PLIC/APLIC honor_dep
- [Phase 6] local scan.c:1160 and 1844 still buggy; power.c lacks initialized = true
- [Phase 6] three hunks match this tree (clean apply)
- [Phase 8] failure: D3 does not _OFF; severity HIGH for PM, not oops
- UNVERIFIED: exact mainline SHA in torvalds.git (git.kernel.org HTML blocked); does not affect the local-tree decision
**YES**
drivers/acpi/power.c | 1 + drivers/acpi/scan.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/acpi/power.c +1 -0
@@ -959,6 +959,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)strscpy (acpi_device_class (device),ACPI_POWER_CLASS ); device->power.state =ACPI_STATE_UNKNOWN ; device->flags.match_driver = true; + device->flags.initialized = true;/* Evaluate the object to get the system level and resource order. */ status =acpi_evaluate_object (handle,NULL ,NULL , &buffer);
drivers/acpi/scan.c +0 -4
@@ -1144,9 +1144,6 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)if (!list_empty (&device->power.states[ACPI_STATE_D3_HOT ].resources)) device->power.states[ACPI_STATE_D3_COLD ].flags.valid =1 ; } - -if (acpi_bus_init_power (device)) - device->flags.power_manageable =0 ; }static void acpi_bus_get_flags (struct acpi_device *device)
@@ -1826,7 +1823,6 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,acpi_init_properties (device);acpi_bus_get_flags (device); device->flags.match_driver = false; - device->flags.initialized = true; device->flags.enumeration_by_parent =acpi_device_enumeration_by_parent (device);acpi_device_clear_enumerated (device);
Signature · 1 line
2.53.0
Re: [PATCH AUTOSEL 6.18-6.1] ACPI: scan: Defer device power initialization
Hi Sasha,
Please drop this from AUTOSEL for all targeted stable branches.
This patch has been reverted. And Rafael has started a new thread to discuss a replacement fix.
Link:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Thanks,
Peixin
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.18-6.1] ACPI: scan: Defer device power initialization
Quoted 4 lines · Peixin Xie
Please drop this from AUTOSEL for all targeted stable branches.
This patch has been reverted. And Rafael has started a new thread to discuss a replacement fix.
Dropped from all trees, thanks.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 1/1 rpmsg: char: Check for ongoing chrdev destroy
In reply to Sasha LevinFrom: Chris Lew <[email protected]>
[ Upstream commit 1f9c2897afb0fe86c1fdf4f5e23c5fb8f7442f6d ]
A null pointer panic is observed when stopping a remoteproc and closing a character device using the RPMSG_DESTROY_EPT_IOCTL. There is a race where each context calls rpmsg_chrdev_eptdev_destroy(). The thread that runs second will call cdev_device_del() for a second time, which fails because the first call already removed the device from sysfs. Add a check at the beginning of destroy and exit early if the destroy call has already been done.
[ 26.654130] Call trace [ 26.656658] kernfs_find_and_get_ns+0x28/0x8 [ 26.661140] sysfs_unmerge_group+0x2c/0x7 [ 26.665357] dpm_sysfs_remove+0x38/0x8 [ 26.669305] device_del+0xa4/0x3e [ 26.672811] cdev_device_del+0x28/0x7 [ 26.676675] rpmsg_chrdev_eptdev_destroy+0x68/0x98 [ 26.682765] rpmsg_eptdev_ioctl+0x130/0x11c8 [ 26.688318] __arm64_sys_ioctl+0xb4/0x10 [ 26.692448] invoke_syscall+0x50/0x12 [ 26.696312] el0_svc_common.constprop.0+0xc8/0xf [ 26.701151] do_el0_svc+0x24/0x3 [ 26.704570] el0_svc+0x40/0x17 [ 26.707810] el0t_64_sync_handler+0x120/0x13 [ 26.712288] el0t_64_sync+0x1a0/0x1a
---
LLM Generated explanations, may be completely bogus:
I have the race, callers, prerequisites, and mailing-list thread. Compiling the full 9-phase verdict for this 7.3-rc4 tree.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
Record: [rpmsg: char:] [Check] Check for ongoing chrdev destroy — serialize/idempotent-ize rpmsg_chrdev_eptdev_destroy() so a second destroy does not run cdev_device_del() again.
**Step 1.2: Tags**
Record:
- Signed-off-by: Chris Lew <[email protected]> (author)
- Signed-off-by: Vishnu Santhosh <[email protected]> (submitter)
- `Link: https://lore.kernel.org/r/20260406-rpmsg-char-fix-chrdev-
[email protected]`
- Signed-off-by: Bjorn Andersson <[email protected]> (remoteproc/rpmsg maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence expected)
- SHA: 1f9c2897afb0fe86c1fdf4f5e23c5fb8f7442f6d
**Step 1.3: Body**
Record:
[Bug] Concurrent rpmsg_chrdev_eptdev_destroy() from remoteproc teardown and RPMSG_DESTROY_EPT_IOCTL.
[Symptom] NULL-pointer panic in kernfs_find_and_get_ns via device_del/cdev_device_del (arm64 ioctl stack provided). [Root cause] Second destroy calls cdev_device_del() after the first already removed the device from sysfs.
[Fix] Under ept_lock, if eptdev->rpdev is already NULL, return 0. [Versions] None stated.
**Step 1.4: Hidden bug fix?**
Record: No — this is an explicit race/panic fix, not cleanup disguised as a fix.
---
## Phase 2: Diff analysis
**Step 2.1: Inventory**
Record: drivers/rpmsg/rpmsg_char.c only, **+5 / -0**. Function:rpmsg_chrdev_eptdev_destroy(). Single-file surgical fix.
**Step 2.2: Flow change**
Record: Before: every caller locked, set rpdev = NULL, tore down the endpoint, unlocked, woke readers, then always cdev_device_del() + put_device(). After: if rpdev is already NULL, unlock and return; only the first destroy does sysfs/cdev teardown.
**Step 2.3: Bug mechanism**
Record: **Race / double device_del**. First destroy clears rpdev under ept_lock then deletes the device. Second destroy used to delete again → NULL deref in sysfs. Guard reuses the existing rpdev == NULL “already released” flag from 17b88a2050e9d.
**Step 2.4: Fix quality**
Record: Minimal and consistent with rpmsg_eptdev_open() (!rpdev → -ENETRESET). Mutex serializes the check/set. Second path also skips a second put_device(), which is correct (only one destroy should drop the register/init ref). Regression risk is low; remaining window is “second thread still takes ept_lock after teardown started,” which is safe while the ioctl file or device_for_each_child() holds a device ref.
---
## Phase 3: Git history
**Step 3.1: Blame**
Record: Destroy body dates to c0cdc19f84a471 (“rpmsg: Driver for user space endpoint interface”, **v4.11-rc1**). eptdev->rpdev = NULL from 17b88a2050e9d (**v6.3-rc1**). cdev_device_del from 7a534ae89e34e (v5.17 era). This 5-line guard is 1f9c2897afb0fe (v7.3-rc1).
**Step 3.2: Fixes: tag**
Record: None. Implicitly completes the v6.3 rpdev = NULL locking, which did not make destroy idempotent.
**Step 3.3: Related commits (path-limited)**
Record:
- 17b88a2050e9d — lock + rpdev = NULL (prerequisite for this check)
- c23965b7f7d99 — ctrl_lock in rpmsg_ctrldev_remove (CREATE vs remove only; does **not** cover endpoint DESTROY ioctl)
- 467233a4ac29b — avoid double destroy of default endpoint
- 7a534ae89e34e — switch to cdev_device_del
- Standalone v1 patch, not n/m
**Step 3.4: Author**
Record: Chris Lew is a regular Qualcomm rpmsg/glink contributor; Vishnu submitted; Bjorn Andersson (maintainer) applied it.
**Step 3.5: Dependencies**
Record: Needs ept_lock and eptdev->rpdev = NULL in destroy (17b88a2050e9d). Both are in this tree (git merge-base --is-ancestor exit 0). Applies standalone here.
---
## Phase 4: Mailing list
**Step 4.1:** b4 dig -c 1f9c2897afb0fe →
https://lore.kernel.org/r/20260406-rpmsg-char-fix-chrdev-destroy-
[email protected]b4 dig -a: **v1 only**. Thread: submission + Bjorn “Applied, thanks!” (1f9c2897afb0fe). No NAK, no review comments, no reviewer `Cc:
stable`.
**Step 4.2:** b4 dig -w: To/Cc Bjorn Andersson, Mathieu Poirier, linux-remoteproc, linux-kernel, Deepak Singh, Chris Lew.
**Step 4.3:** Bug report is the in-message crash trace (Qualcomm remoteproc + DESTROY ioctl). No syzbot/bugzilla.
**Step 4.4:** Single-patch series; no sibling patches required.
**Step 4.5:** lore.kernel.org WebFetch returned 403. b4 dig -m got the full thread (2 messages). No stable-list discussion found in that thread.
---
## Phase 5: Semantic / call-path analysis
**Step 5.1:** Modified: rpmsg_chrdev_eptdev_destroy().
**Step 5.2: Callers** (verified with grep):
1. rpmsg_eptdev_ioctl() / RPMSG_DESTROY_EPT_IOCTL — userspace ioctl (stack in the commit)
2. rpmsg_chrdev_remove() — device_for_each_child(..., rpmsg_chrdev_eptdev_destroy) on rpmsg device removal
3. rpmsg_ctrldev_remove() — same for the control device when remoteproc/rpmsg device goes away
**Step 5.3:** Callees: mutex_lock/unlock, rpmsg_destroy_ept, wake_up_interruptible, cdev_device_del → device_del → dpm_sysfs_remove, put_device.
**Step 5.4:** Reachable from userspace ioctl while firmware is stopped. ctrl_lock only wraps CREATE/RELEASE on the **ctrl** fd, not DESTROY on the **endpoint** fd — so the race is real.
**Step 5.5:** Same !rpdev pattern already used in rpmsg_eptdev_open(). No other copy of this exact double-destroy bug in-tree.
---
## Phase 6: This checkout
**Step 6.1:** Local tree: **v7.3-rc4-27-gf0100363d8c37**, VERSION=7 PATCHLEVEL=3 (7.3.0-rc4).
Buggy function exists at drivers/rpmsg/rpmsg_char.c. Dual call paths exist. Commit is already an ancestor (git merge-base --is-ancestor 1f9c2897afb0fe HEAD → 0) because it landed in **v7.3-rc1**. That is the mainline landing, not a reason to reject on technical merit. Parent of the commit still has the unguarded destroy.
**Step 6.2:** Parent destroy matches this tree aside from the 5-line guard. Backport difficulty: **clean apply** onto any tree that already has 17b88a2050e9d.
**Step 6.3:** No later follow-up on this file after 1f9c2897afb0fe. No alternate fix for this double-cdev_device_del race.
---
## Phase 7: Subsystem
**Step 7.1:** drivers/rpmsg/ — IMPORTANT for Android/embedded remoteproc (Qualcomm, TI, ST), not core mm/VFS. Panic on a user ioctl still matters.
**Step 7.2:** Mature driver (since v4.11), ongoing Qualcomm/Linaro fixes. This is a long-standing race, not a brand-new API.
---
## Phase 8: Impact and risk
**Step 8.1:** Users with CONFIG_RPMSG_CHAR who stop a remote processor while userspace DESTROYs an endpoint (typical Qualcomm/Android rpmsg).
**Step 8.2:** Trigger: remoteproc stop **and** RPMSG_DESTROY_EPT_IOCTL. Timing-dependent but demonstrated. Unprivileged userspace with the endpoint fd can be one side of the race.
**Step 8.3:** Failure: kernel NULL deref / oops in device_del. **Severity: CRITICAL**.
**Step 8.4:** Benefit high (prevents oops). Risk very low (5 lines, existing lock/flag). Ratio strongly favors backport.
---
## Phase 9: Synthesis
**For:** Real oops with stack; userspace-reachable race; 5-line idempotent destroy; maintainer-applied; prereqs present; matches stable rules.
**Against:** No Fixes:/Cc: stable; no extra Reviewed-by; rpmsg- char not universal on desktops; uses rpdev as a destroyed flag (already established in v6.3).
**Unresolved:** Direct lore HTTP 403 (thread recovered via b4). No independent stable@ discussion.
**Stable rules:**
1. Obviously correct and tested? **PASS** — lock + existing flag; crash reproduced by author.
2. Real user bug? **PASS** — oops on remoteproc stop + ioctl.
3. Important? **PASS** — kernel panic.
4. Small/contained? **PASS** — +5 lines, one function.
5. No new features/APIs? **PASS**.
6. Applies to this tree? **PASS** — same function/callers; prereq 17b88a2050e9d present.
**Exception category:** None needed; this is a normal crash fix.
This is a textbook stable candidate: a small, obviously correct guard that stops a double cdev_device_del() oops when remoteproc teardown races RPMSG_DESTROY_EPT_IOCTL. The affected code and the rpdev = NULL flag it depends on are in this tree.
Verification:
- [Phase 1] Parsed tags: Chris Lew/Vishnu SOB, Bjorn SOB, lore Link; no Fixes/Reported-by/Cc stable
- [Phase 2] Diff: +5 lines in rpmsg_chrdev_eptdev_destroy() after mutex_lock(&eptdev->ept_lock)
- [Phase 2] Confirmed cdev_device_del() always calls device_del() (fs/char_dev.c); second device_del matches the dpm_sysfs_remove/kernfs_find_and_get_ns stack
- [Phase 3] git blame: rpdev = NULL from 17b88a2050e9d (v6.3-rc1); function from c0cdc19f84a471 (v4.11-rc1)
- [Phase 3] git merge-base --is-ancestor 17b88a2050e9d HEAD → present; 1f9c2897afb0fe also ancestor (landed v7.3-rc1)
- [Phase 3] Parent of 1f9c2897afb0fe still does unconditional cdev_device_del
- [Phase 4] b4 dig -c/-a/-w/-m: v1 only; Bjorn applied; maintainers CC’d; no NAK
- [Phase 4] WebFetch lore/stable: 403; thread contents verified from /tmp/rpmsg-destroy-thread.mbox
- [Phase 5] Callers: ioctl DESTROY, rpmsg_chrdev_remove, rpmsg_ctrldev_remove; ctrl_lock does not cover DESTROY
- [Phase 6] git describe HEAD → v7.3-rc4-27-gf0100363d8c37; make kernelversion → 7.3.0-rc4
- [Phase 8] Failure mode: NULL deref oops, CRITICAL
- UNVERIFIED: public lore HTML (403); whether a given older LTS lacks 17b88a2050e9d (this tree has it)
**YES**
drivers/rpmsg/rpmsg_char.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rpmsg/rpmsg_char.c +5 -0
@@ -79,6 +79,11 @@ int rpmsg_chrdev_eptdev_destroy(struct device *dev, void *data)struct rpmsg_eptdev *eptdev =dev_to_eptdev (dev);mutex_lock (&eptdev->ept_lock); +if (!eptdev->rpdev) { +mutex_unlock (&eptdev->ept_lock); +return 0 ; + } + eptdev->rpdev =NULL ;if (eptdev->ept) {/* The default endpoint is released by the rpmsg core */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 soundwire: dmi-quirks: add a global ghost list
In reply to Sasha LevinFrom: Bard Liao <[email protected]>
[ Upstream commit b7a5d101d7d267922e828c40135bcaccf8cfb3bf ]
Not like other ghost devices, the 0x000000D010010500 ADR doesn't belong to any codec. We should disable it in all devices.
---
LLM Generated explanations, may be completely bogus:
The local tree is Linux **7.3.0-rc4**. This is a hardware quirk that disables a bogus SoundWire ACPI _ADR on Intel hosts; the same class of ghost-device quirks has already been treated as stable material.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
- Subsystem prefix: soundwire: dmi-quirks:
- Action verb: **add** (adds a global ghost-ADR table)
- Claimed intent: disable ACPI _ADR 0x000000D010010500 on every machine because it is not a real codec
Record: [soundwire/dmi-quirks] [add] [global ghost ADR list to disable a firmware-invented SoundWire device]
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
- Fixes: **absent** (expected for this review pipeline; not a negative signal)
- Reported-by: **absent**
- Tested-by: **absent**
- Reviewed-by: Charles Keepax (Cirrus; author of the earlier per-machine ghost-Realtek quirks); Pierre-Louis Bossart (SoundWire expert)
- Acked-by: **absent**
- Link: https://patch.msgid.link/20260703011656.2572959-1-yung- [email protected]
- Cc: stable: **absent** (expected)
- Signed-off-by: Bard Liao (author, Intel SoundWire); Vinod Koul (SoundWire maintainer). Ignore any Sasha Levin SOB if present; none is on this commit.
Record: Author + two subsystem reviewers + maintainer SOB. No user/syzbot report. No Fixes/Cc-stable.
Step 1.3: ANALYZE THE COMMIT BODY TEXT
The body is two sentences: unlike DMI-matched ghost codecs, _ADR 0x000000D010010500 does not belong to any codec, so it should be disabled on all devices. No stack trace, no machine list, no kernel- version range.
Decoded _ADR (MIPI DisCo layout in include/linux/soundwire/sdw.h):
link_id=0, version=0, unique_id=0, mfg_id=0xd010, part_id=0x0105, class_id=0. That is not a known in-tree codec (Realtek is 0x025d). It is firmware garbage, not a real part.
Record: [Bug: ACPI exposes a non-codec SoundWire _ADR] [Symptom:
kernel enumerates a phantom slave, which can break machine-driver / function-topology matching] [No version info] [Root cause: BIOS _ADR is not a real codec; remap to 0 so core skips it]
Step 1.4: DETECT HIDDEN BUG FIXES
Not disguised cleanup. It is an explicit hardware workaround: treat a bogus ACPI device as missing.
Record: [Not a hidden fix; it is a hardware quirk. Same pattern as ghost_realtek[] remapping to 0.]
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
- File: drivers/soundwire/dmi-quirks.c only
- +20 / -1 (21-line change)
- New table global_ghost_adr[]; function sdw_dmi_override_adr() updated (break → goto out, then a global remap loop)
Record: [1 file, +20/-1] [sdw_dmi_override_adr] [single-file surgical quirk]
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Before: sdw_dmi_override_adr() only remapped addresses if DMI matched adr_remap_quirk_table.
After:
1. DMI remap still runs first. On a hit, goto out so a machine- specific remap wins and is not overwritten.
2. Otherwise walk global_ghost_adr[]. If addr == 0x000000D010010500, set addr = 0.
Caller find_slave() in drivers/soundwire/slave.c already does if (!addr) return false; (since 2021), so a zero _ADR is not enumerated.
Record: [DMI remap still preferred; unmatched 0x000000D010010500 is forced to 0 and skipped during ACPI slave discovery]
Step 2.3: IDENTIFY THE BUG MECHANISM
Category **(h) hardware workaround**, using the existing remap-to-zero disable path.
Record: [Hardware quirk] [BIOS lists a fake SoundWire device; remap to 0 so Intel SoundWire enumeration ignores it]
Step 2.4: ASSESS THE FIX QUALITY
Obviously correct: same remap-to-0 used by ghost_realtek[]. Pierre- Louis noted on-list that zero is ignored by existing core logic. Regression risk is low: only _ADR 0x000000D010010500 is dropped, and reviewers state it is not a real codec. ARRAY_SIZE includes the {} terminator (one extra compare of adr==0); harmless. goto out is required so a DMI remap is not then clobbered by the global list.
Record: [Minimal, obviously correct] [Regression risk: low; worst case would be disabling a real device with this exact _ADR, which the author/reviewers say does not exist]
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINESsdw_dmi_override_adr() and remap-to-0 skip date to **6558b667a7297** (“soundwire: add override addr ops”, 2021-03-22, first in **v5.13**). File introduced by **f6594cdfec4cd** (v5.12-rc2-2). Per-machine ghost Realtek disable: **4dab2b904414f** (in **v7.2**).
Record: [Quirk infrastructure since v5.13] [This specific ADR workaround is new in 7.3; the BIOS bug is not a recent kernel regression]
Step 3.2: FOLLOW THE FIXES: TAG
No Fixes: tag.
Record: [N/A — no Fixes tag] [Buggy “code” is firmware; kernel side is missing a quirk]
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Related commits on this file: 4dab2b904414f (ghost Realtek, DMI- matched), then more ASUS/Lenovo DMI rows, then this global list, then more per-machine Realtek ghosts. This commit is not patch N/M.
Record: [Same-file ghost-device series, but this patch is standalone] [No extra kernel commit required for remap-to-0 to work]
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Bard Liao is a regular Intel SoundWire contributor (many cadence/intel_ace2x commits). Reviewed by Keepax and Bossart; applied by Vinod Koul.
Record: [Intel SoundWire contributor; patch vetted by subsystem experts/maintainer]
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS Needs sdw_dmi_override_adr + if (!addr) return false in find_slave() — both present since v5.13. Does not need ghost_realtek[]. Applies standalone on this tree.
Record: [No missing prereqs in this tree] [Standalone]
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSIONb4 dig -c b7a5d101d7d26 matched:
https://patch.msgid.link/20260703011656.2572959-1-yung-
[email protected]b4 dig -a: **v1 only**, dated 2026-07-03. Thread (mbox): Bard submit → Pierre-Louis Reviewed-by (notes zero is ignored by core) → Vinod applied as b7a5d101d7d26. No NAK, no v2.
Record: [lore via b4] [v1 applied as-is] [No NAKs] [No reviewer Cc:
stable] [Keepax Rb already on v1]
Step 4.2: CHECK WHO REVIEWED THE PATCHb4 dig -w recipients: linux-sound, Vinod Koul, Pierre-Louis Bossart, Peter Ujfalusi, Bard Liao. SoundWire maintainer and Intel SoundWire people were on To/Cc.
Record: [Vinod (maintainer), Pierre-Louis, linux-sound; Keepax reviewed]
Step 4.3: SEARCH FOR THE BUG REPORT
No Reported-by, bugzilla, or syzbot. Web search only finds this patch thread. User impact is inferred from the sibling ghost-Realtek commit:
ACPI-listed missing codecs confuse function-topology sound-card creation.
Record: [No public user bug report for this ADR] [Impact inferred from the same ghost-device mechanism, which is documented in 4dab2b904414f]
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES Standalone 1/1. Later dmi-quirks commits only add more DMI rows for Realtek ghosts; they do not fix this patch.
Record: [Standalone] [Follow-ups are unrelated extra DMI IDs]
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Direct lore.kernel.org/stable fetch returned 403. Web search found **AUTOSEL of the sibling** soundwire: dmi-quirks: Disable ghost Realtek devices for **6.18–6.1**, and **no AUTOSEL of this global-ghost commit** (no Fixes/Cc-stable, so it needs this review).
Record: [Sibling ghost-device quirk was AUTOSEL’d into stable] [This commit was not auto-picked; that is why it is here] [UNVERIFIED: raw stable-list HTML]
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: [sdw_dmi_override_adr] [new static table global_ghost_adr]
Step 5.2: TRACE CALLERSsdw_intel_ops.override_adr = sdw_dmi_override_adr in drivers/soundwire/intel_auxdevice.c only. Invoked from find_slave() during ACPI child walk when Intel SoundWire enumerates slaves.
Record: [Intel SoundWire ACPI enumeration only] [Not IRQ/hot path; probe/enumeration]
Step 5.3: TRACE CALLEESdmi_first_match(), dev_dbg(). No alloc, no locks, no I/O.
Record: [DMI match + debug print + table walk]
Step 5.4: FOLLOW THE CALL CHAIN
Intel SoundWire link probe → ACPI walk → find_slave() → override_adr() → skip if 0. Reachable on Intel laptops with SoundWire
+ ACPI (typical modern OEM audio). Unprivileged users do not trigger it directly; it runs at device probe and can break audio setup.
Record: [Reachable on Intel SoundWire machines at enumeration] [Not a syscall crash path]
Step 5.5: SEARCH FOR SIMILAR PATTERNSghost_realtek[] remaps 0x000330025d072201 to 0, but only for DMI- matched ASUS/Lenovo boards. This patch is the same disable, globally, for a different _ADR.
Record: [Same pattern as in-tree ghost Realtek quirks; this ADR is not machine-specific]
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?git describe HEAD = **v7.3-rc4-27-gf0100363d8c37**; make kernelversion = **7.3.0-rc4**. drivers/soundwire/dmi-quirks.c and sdw_dmi_override_adr() are present. find_slave() skips addr==0. Without this quirk, a BIOS that publishes 0x000000D010010500 still enumerates a phantom slave. (git merge-base --is-ancestor b7a5d101d7d26 HEAD is true because this is the mainline tree that already contains the commit; that is not used as a “already selected” NO.)
Record: [Yes — Intel SoundWire DMI override path exists] [Firmware bug; kernel lacked a global skip until 7.3-rc1]
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
On this tree the patch is already the current code. Against the pre- image (v7.2 sdw_dmi_override_adr is the same shape, only fewer DMI rows) it would apply with at most context shift in the DMI table. No API/data-structure change.
Record: [Clean/trivial on this codebase]
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE ghost_realtek[] is here but only matches specific DMI IDs and a different _ADR. It does **not** hide 0x000000D010010500.
Record: [No substitute fix for this ADR]
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY drivers/soundwire/ — Intel SoundWire master + ACPI quirks. Affects Intel-laptop audio, not core mm/fs.
Record: [SoundWire / Intel audio] [IMPORTANT for those machines, PERIPHERAL vs core kernel]
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Active (BRA/BPT, ACE2x, many 7.3 SoundWire commits). dmi-quirks itself is a mature table of BIOS workarounds dating to 2021.
Record: [Active Intel SoundWire; quirk file is a long-lived table]
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED CONFIG_SOUNDWIRE_INTEL machines whose ACPI includes _ADR 0x000000D010010500. Not universal. The author says the ADR is not a codec, so the quirk is intentionally global rather than DMI-limited.
Record: [Intel SoundWire / config-specific; any OEM BIOS with that _ADR]
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Triggered at SoundWire/ACPI enumeration (boot or audio-controller probe), not a race. Not userspace-triggered. How common the BIOS entry is was not documented; Intel submitted it as a global rule, which implies it is not one SKU.
Record: [Boot/probe on matching firmware] [Unprivileged users are not the trigger; they see broken or mis-created audio]
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Not a panic/UAF. Failure mode matches the documented ghost-Realtek
issue: phantom ACPI device confuses topology/machine matching → missing or wrong sound card, probe noise, possible timeouts talking to a device that is not there. That is a real user-visible audio failure on affected laptops.
Record: [Broken/misbuilt audio / failed slave probe] [Severity:
MEDIUM–HIGH for affected hardware; not a generic kernel crash]
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Benefit: restores correct enumeration on machines with this BIOS bug; same class AUTOSEL already accepted for Realtek ghosts. Risk: ~20 lines, one file, existing 0-skip path, expert review. Global match is slightly broader than DMI quirks but the _ADR is not a real vendor/part.
Record: [Benefit: medium-high for Intel SoundWire laptops] [Risk: very low] [Favor applying]
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Hardware quirk/workaround (stable exception category)
- Small, one-file, uses remap-to-0 that core has honored since v5.13
- Reviewed by Keepax and Bossart; applied by Vinod
- Sibling ghost-device dmi-quirks were AUTOSEL’d to 6.1–6.18
- Code and skip-on-zero path exist in this tree
- Standalone; no new API
AGAINST:
- Thin commit message; no public reproducer or Reported-by
- Not a crash/security/corruption bug
- Global (all machines) rather than DMI-scoped UNRESOLVED:
- Could not fetch lore.kernel.org/stable HTML (403)
- No independent confirmation of how many BIOSes contain this _ADR
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — existing mechanism; two expert reviews; maintainer applied v1
2. Fixes a real bug that affects users? **PASS** — phantom ACPI slave breaks audio topology/enumeration
3. Important issue? **PASS** as hardware quirk (broken audio on real Intel laptops), not as a generic panic
4. Small and contained? **PASS** — +20/-1, one file
5. No new features or APIs? **PASS** — table entry + lookup in existing override hook
6. Can apply to the local tree? **PASS** — dmi-quirks.c / sdw_dmi_override_adr / if (!addr) all present
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Hardware quirk/workaround** (SoundWire DMI/_ADR quirk, equivalent to USB/PCI/codec quirk table entries)
Step 9.4: MAKE YOUR DECISION
This is a textbook stable hardware quirk: surgical, reviewed, uses a long-standing disable path, and fixes real OEM firmware that would otherwise present a fake SoundWire device to audio matching. The missing Fixes/Cc-stable tags are why it needs review, not a reason to drop it.
Verification:
- [Phase 1] Tags: Reviewed-by Keepax + Bossart; Link msgid; no Fixes/Reported-by/Cc-stable
- [Phase 1] ADR decode: mfg_id 0xd010 / part_id 0x0105 / class 0 — not an in-tree codec
- [Phase 2] Diff: +20/-1 in dmi-quirks.c; sdw_dmi_override_adr remaps 0x000000D010010500 → 0
- [Phase 2] slave.c if (!addr) return false confirmed at lines 125–129
- [Phase 3] override/zero-skip: 6558b667a7297 (v5.13); dmi-quirks file:
f6594cdfec4cd; ghost_realtek: 4dab2b904414f (v7.2)
- [Phase 3] git merge-base --is-ancestor b7a5d101d7d26 v7.2 → not in v7.2; in v7.3-rc1 via soundwire-7.3-rc1
- [Phase 3] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4
- [Phase 4] b4 dig -c/-a/-w/-m: v1 only; Pierre-Louis Rb + zero-skip note; Vinod applied; no NAK
- [Phase 4] lore WebFetch 403; used b4 mbox instead
- [Phase 4] Web search: sibling “Disable ghost Realtek devices” AUTOSEL 6.18–6.1; this commit not AUTOSEL’d
- [Phase 5] Only hooked from intel_auxdevice.c sdw_intel_ops.override_adr
- [Phase 6] Local dmi-quirks.c already contains global_ghost_adr; ghost_realtek[] does not cover this ADR
- [Phase 8] Failure mode: phantom slave at Intel SoundWire probe → audio topology/machine mismatch, not oops
- UNVERIFIED: how many machines ship this _ADR; stable-list HTML beyond web snippets
The patch is a small Intel SoundWire hardware quirk, it matches stable rules, and the local tree has the code it needs.
**YES**
drivers/soundwire/dmi-quirks.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/soundwire/dmi-quirks.c +20 -1
@@ -15,6 +15,14 @@ struct adr_remap {u64 remapped_adr; }; +static const struct adr_remap global_ghost_adr[] = { + { +0x000000D010010500ull , +0x0000000000000000ull + }, + {} +}; +/* * Some TigerLake devices based on an initial Intel BIOS do not expose * the correct _ADR in the DSDT.
@@ -212,6 +220,7 @@ static const struct dmi_system_id adr_remap_quirk_table[] = {u64 sdw_dmi_override_adr (struct sdw_bus *bus,u64 addr) {const struct dmi_system_id *dmi_id; +int i;/* check if any address remap quirk applies */ dmi_id =dmi_first_match (adr_remap_quirk_table);
@@ -223,10 +232,20 @@ u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)dev_dbg (bus->dev,"remapped _ADR 0x%llx as 0x%llx\n" , addr, map->remapped_adr); addr = map->remapped_adr; -break ; + goto out; } } } +/* remap the ghost ADRs */ +for (i =0 ; i <ARRAY_SIZE (global_ghost_adr); i++) { +if (global_ghost_adr[i].adr == addr) { +dev_dbg (bus->dev,"remapped _ADR 0x%llx as 0x%llx\n" , + addr, global_ghost_adr[i].remapped_adr); + addr = global_ghost_adr[i].remapped_adr; +break ; + } + } +out:return addr; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/msm: detach the ARM DMA mapping before attaching our own domain
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 140b13475302601368c0cf4e193e66126a49feb3 ]
On ARM32 with CONFIG_ARM_DMA_USE_IOMMU, arch_setup_dma_ops() creates a dma_iommu_mapping for every IOMMU-backed device and attaches its domain to the device's IOMMU group. That domain is neither the group's default nor its blocking domain, so when msm_iommu_new() later attaches the domain the driver manages itself, __iommu_attach_group() refuses it:
if (group->domain && group->domain != group->default_domain && group->domain != group->blocking_domain) return -EBUSY;
Both the GPU and the display controller are hit by this on apq8064 (IFC6410), leaving the board with no GPU and no display:
adreno 4300000.gpu: failed to load adreno gpu
adreno 4300000.gpu: probe with driver adreno failed with error -16 mdp4 5100000.display-controller: [drm:msm_drm_kms_init] *ERROR* failed to load kms mdp4 5100000.display-controller: adev bind failed: -16
Other ARM32 DRM drivers that manage their own domains (tegra, rockchip, exynos) drop the arch mapping first. Do the same in msm_iommu_new(), which both the display and the GPU paths go through.
With this the GPU and the KMS device both initialise:
[drm] Initialized msm 1.13.0 for 4300000.gpu on minor 0
[drm] Initialized msm-kms 1.13.0 for 5100000.display-controller on minor 1
Patchwork: https://patchwork.freedesktop.org/patch/743333/
---
LLM Generated explanations, may be completely bogus:
I have the 6.1.188 picture: the -EBUSY attach path is present, qcom_defconfig hits it, and the companion series crashes are not reachable here. Writing up the full analysis.
## Phase 1: Commit message forensics
**Step 1.1:** Record: [drm/msm] [detach] Drop the ARM32 DMA IOMMU mapping so msm can attach its own domain
**Step 1.2:** Record: Tags present:
- Assisted-by: Claude:claude-opus-5
- Reviewed-by: Konrad Dybcio <[email protected]>
- Signed-off-by: Dmitry Baryshkov <[email protected]> (author; ignore pipeline SOBs)
- Patchwork: https://patchwork.freedesktop.org/patch/743333/
- `Link: https://lore.kernel.org/r/20260730-fix-qcom-
[email protected]`
- No Fixes:, no Cc: stable (expected for this review)
- No Reported-by / Tested-by / syzbot
**Step 1.3:** Record: On ARM32 with CONFIG_ARM_DMA_USE_IOMMU, arch_setup_dma_ops() attaches a dma_iommu_mapping domain that is neither the group default nor blocking domain. msm_iommu_new() then iommu_attach_device()s the driver-owned domain and __iommu_attach_group() returns -EBUSY. Symptom on apq8064/IFC6410:
GPU probe fails with -16, MDP4 KMS fails with -16, no GPU and no display. Author reports both devices initialise after the change.
**Step 1.4:** Record: Not a disguised cleanup. Explicit probe-failure fix, matching tegra/rockchip/exynos.
## Phase 2: Diff analysis
**Step 2.1:** Record: One file, drivers/gpu/drm/msm/msm_iommu.c, +22 lines. Functions: file-scope includes; msm_iommu_new(). Surgical, single-file.
**Step 2.2:** Record: Before: msm_iommu_new() attaches its domain immediately. After: if CONFIG_ARM_DMA_USE_IOMMU and a mapping exists, arm_iommu_detach_device() + arm_iommu_release_mapping(), then attach. Probe/init path only; no-ops when the config is off.
**Step 2.3:** Record: [Hardware workaround / logic] ARM DMA domain occupies the group → EBUSY. Same detach-before-attach used by rockchip/exynos in this tree.
**Step 2.4:** Record: Obviously correct; copies an in-tree pattern. Gated so ARM64/non-IOMMU is unchanged. Regression risk is low if the companion iommu/msm crash is not reachable here (verified below). msm_iommu_new() signature differs in 6.1, so the backport is a small contextual insert, not a clean cherry-pick.
## Phase 3: Git history
**Step 3.1:** Record: iommu_attach_device() in msm_iommu_new() is from 52da6d513183cf (Jordan Crouse, 2020). Function exists since 871d812aa43e6 (2013). EBUSY check in this tree is 0286300e604555 (Jason Gunthorpe, 2022-05-09), in 6.1. Rockchip equivalent:8490cad4dc4e2, also in this tree.
**Step 3.2:** Record: No Fixes: tag. Bug is the interaction of ARM DMA attach + msm attaching its own domain + the 6.1 EBUSY check.
**Step 3.3:** Record: Recent msm_iommu.c churn in this tree is unrelated (sgtable WARN, tlb ops). No prior msm ARM-DMA detach. Patch is 3/3 of “Fix GPU and display on ARM32 platforms using the MSM IOMMU”:
1. iommu/msm: track a context master per device and IOMMU
2. iommu/msm: use the IOMMU device for page table allocation
3. this commit
Cover letter: all three needed on **mainline**; patches are independent for different maintainers.
**Step 3.4:** Record: Dmitry Baryshkov is a Qualcomm/msm DRM maintainer; many msm commits in this tree. Konrad reviewed this patch.
**Step 3.5:** Record: Applies standalone to 6.1’s attach site. Patch 1’s fatal NULL deref is blamed on da33e87bd2bf (“iommu: Handle yet another race around registration”) — **not** in this tree (git merge-base --is- ancestor → no). Patch 2’s crash stack uses msm_iommu_identity_attach, which **does not exist** in 6.1 drivers/iommu/msm_iommu.c. Those two are not prerequisites for this -EBUSY fix here.
## Phase 4: Mailing list
**Step 4.1:** Record: b4 dig -c 140b134753026 →
https://patch.msgid.link/20260730-fix-qcom-
[email protected]
v1 and v2 same day. v2: dropped a dev_warn tweak (Konrad); rewrote patch 2 (Robin Murphy). Applied version is v2 3/3. Lore HTTP 403/503; thread recovered via b4 dig -m. No NAKs in the saved mbox. No reviewer Cc: stable.
**Step 4.2:** Record: To/Cc included Rob Clark, Will Deacon, Joerg Roedel, Robin Murphy, dri-devel, iommu, linux-arm-msm, freedreno. Konrad Reviewed-by on this patch.
**Step 4.3:** Record: Author is the reporter; tested on IFC6410. Concrete dmesg for GPU and KMS probe -16.
**Step 4.4:** Record: Series of three; this patch is drm/msm-only. Cover
letter: “only fixing all of them makes the board usable” on mainline. For 6.1, the other two fix post-6.1 IOMMU-core behavior.
**Step 4.5:** Record: No stable@ discussion found (lore.kernel.org/stable search not usable here; mbox has no stable nomination).
## Phase 5: Code semantics
**Step 5.1:** Record: msm_iommu_new().
**Step 5.2:** Record: Callers in this tree:
- adreno_iommu_create_address_space() → GPU probe (adreno_gpu.c)
- mdp4_kms init (mdp4_kms.c) → display
- msm_kms_init_aspace() (msm_drv.c) → MDP/DPU
- a6xx_gmu.c (a6xx; not apq8064)
Probe-time, not IRQ/hot path.
**Step 5.3:** Record: After the new detach: iommu_attach_device(). Detach uses arm_iommu_detach_device / arm_iommu_release_mapping (exported in this tree).
**Step 5.4:** Record: Reachable from platform probe of adreno/mdp4 when the device is IOMMU-mapped. Userspace is not needed; boot on apq8064 with qcom_defconfig is enough.
**Step 5.5:** Record: Same pattern in this tree:rockchip_drm_dma_attach_device(), exynos_drm_dma.c.
## Phase 6: This checkout (6.1.188)
**Step 6.1:** Record: Tree is **6.1.188** (pending-6.1, p-6.1-11-gffee1c0de6cf2). Candidate 140b134753026 is **not** an ancestor of HEAD (name-rev: tags/next-20260821~61^2).
Buggy code is here:
```402:425:drivers/gpu/drm/msm/msm_iommu.c
struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain
*domain)
{
...
ret = iommu_attach_device(iommu->domain, dev);
if (ret) {
kfree(iommu);
return ERR_PTR(ret);
}
return &iommu->base;
}
```Same EBUSY test in drivers/iommu/iommu.c __iommu_attach_group(). arch_setup_dma_ops() → arm_setup_iommu_dma_ops() attaches the ARM mapping. arch/arm/configs/qcom_defconfig has CONFIG_MSM_IOMMU=y, CONFIG_ARM_SMMU=y (selects ARM_DMA_USE_IOMMU), CONFIG_ARCH_MSM8960=y, CONFIG_DRM_MSM=m. DT: qcom- apq8064-ifc6410.dts, GPU adreno-3xx@4300000, MDP mdp@5100000.
**Step 6.2:** Record: Minor backport. 6.1 msm_iommu_new(dev, domain) vs later msm_iommu_new(dev, quirks) with iommu_paging_domain_alloc / kzalloc_obj. Insert the detach block before the existing iommu_attach_device() and add the same #if CONFIG_ARM_DMA_USE_IOMMU stubs rockchip already uses.
**Step 6.3:** Record: No msm ARM-DMA detach in this tree.
## Phase 7: Subsystem
**Step 7.1:** Record: [drm/msm IOMMU] [IMPORTANT] — not core mm/net, but GPU+display on Qualcomm ARM32. Official qcom_defconfig.
**Step 7.2:** Record: msm DRM is active; this ARM32 IOMMU attach path is old and stable.
## Phase 8: Impact and risk
**Step 8.1:** Record: ARM32 Qualcomm with CONFIG_ARM_DMA_USE_IOMMU and msm DRM+IOMMU — qcom_defconfig, apq8064 (IFC6410, Nexus 7 flo, etc.).
**Step 8.2:** Record: Every boot/probe of GPU and display. Not a race. Unprivileged userspace not required.
**Step 8.3:** Record: Probe -EBUSY → no GPU, no display. Severity **HIGH** for those boards (board graphics unusable). Not a generic panic.
**Step 8.4:** Record: Benefit high for affected ARM32 qcom; risk low (config-gated, copies in-tree pattern, ~15 lines in one function). Companion mainline crashes are not the 6.1 detach path (msm_iommu_identity_attach missing; 6.1 arm_iommu_detach_device NULLs dma_ops after detach, and this patch’s extra release_mapping runs with dma_ops already NULL).
## Phase 9: Synthesis
**Evidence FOR:**
- Real, tested probe failure: GPU+KMS -EBUSY on IFC6410
- Mechanism present in 6.1 (attach + EBUSY check + ARM DMA mapping)
- Official qcom_defconfig enables the triggering config
- Small, matches rockchip/exynos already in this tree
- Reviewed by Konrad Dybcio; msm maintainer author
- Hardware-workaround class (existing driver, existing boards)
**Evidence AGAINST:**
- Cherry-pick does not apply cleanly (msm_iommu_new signature)
- Series 3/3; cover letter says all three needed on mainline
- ARM32 / older SoCs only
- Not a UAF/security/panic by itself
**Unresolved:** Whether incomplete multi-IOMMU stream-ID programming (patch 1, “wrong for years”) still limits display/GPU quality after attach succeeds. That did not block probe; this patch fixes the probe blocker.
**Stable rules:**
1. Obviously correct and tested? **PASS** (in-tree pattern; IFC6410)
2. Real bug affecting users? **PASS** (qcom_defconfig apq8064)
3. Important? **PASS** (complete GPU+display failure; quirk/enablement exception)
4. Small? **PASS** (+22 lines, one file; small 6.1 adapt)
5. No new features/APIs? **PASS**
6. Can apply to this tree? **PASS** (minor context adapt)
**Exception:** Hardware workaround for ARM32 IOMMU vs driver-managed domain, same class as existing DRM ARM DMA detach.
This tree is 6.1.188. The attach/-EBUSY bug is here, the devices and defconfig are here, and the mainline series mates that crash on later IOMMU core behavior are not required for this fix.
Verification:
- [Phase 1] Parsed tags: Reviewed-by Konrad; lore/patchwork links; no Fixes/stable/syzbot
- [Phase 2] Diff: +22 in msm_iommu_new(), detach ARM mapping then iommu_attach_device()
- [Phase 3] Blame: attach from 52da6d513183cf (2020); EBUSY 0286300e604555 in this tree; rockchip detach 8490cad4dc4e2 in this tree
- [Phase 3] git merge-base --is-ancestor 140b134753026 HEAD → no (commit is linux-next, not 6.1)
- [Phase 3] Companion Fixes da33e87bd2bf not in 6.1; no identity_attach in 6.1 msm IOMMU
- [Phase 4] b4 dig -c 140b134753026 / -a / -w / -m: v2 3/3, cover letter, Konrad R-b, Robin feedback on patch 2
- [Phase 5] Callers: adreno, mdp4, msm_kms_init_aspace at probe
- [Phase 6] git describe HEAD / Makefile: 6.1.188 pending-6.1; buggy msm_iommu_new() at line 419
- [Phase 6] qcom_defconfig: MSM_IOMMU=y, ARM_SMMU=y, DRM_MSM=m, ARCH_MSM8960=y
- [Phase 8] Failure: GPU/KMS probe -16/-EBUSY, no display; HIGH for those boards
- UNVERIFIED: live IFC6410 boot on 6.1.188 (author tested mainline)
**YES**
drivers/gpu/drm/msm/msm_iommu.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/msm/msm_iommu.c +22 -0
@@ -7,6 +7,15 @@#include <linux/adreno-smmu-priv.h> #include <linux/io-pgtable.h> #include <linux/kmemleak.h> + +#if defined(CONFIG_ARM_DMA_USE_IOMMU ) +#include <asm/dma-iommu.h> +#else +#define arm_iommu_detach_device (...) ({ }) +#define arm_iommu_release_mapping (...) ({ }) +#define to_dma_iommu_mapping (dev) NULL +#endif +#include "msm_drv.h" #include "msm_gpu_trace.h" #include "msm_mmu.h"
@@ -746,6 +755,19 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks)mutex_init (&iommu->init_lock); +/* +* ARM32 attaches a DMA mapping domain to every IOMMU-backed device, +* which would make attaching our own domain fail with -EBUSY. +*/ +if (IS_ENABLED (CONFIG_ARM_DMA_USE_IOMMU )) { +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev); + +if (mapping) { +arm_iommu_detach_device (dev); +arm_iommu_release_mapping (mapping); + } + } + ret =iommu_attach_device (iommu->domain, dev);if (ret) {iommu_domain_free (domain);
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] drm/msm: detach the ARM DMA mapping before attaching our own domain
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/msm: NULL dereference in __free_iova() via msm_iommu_new() detach --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/msm: NULL dereference in __free_iova() via msm_iommu_new() detach --
commit 8a10d4b676f6bf2e4f498788e23c54cc872ffbc5
Author: Dmitry Baryshkov <[email protected]>
drm/msm: detach the ARM DMA mapping before attaching our own domain
This commit detaches and releases the default ARM32 DMA IOMMU mapping in msm_iommu_new() before attaching the driver's own IOMMU domain so that __iommu_attach_group() does not fail with -EBUSY on ARM32 platforms with CONFIG_ARM_DMA_USE_IOMMU enabled.
Quoted 4 lines
drivers/gpu/drm/msm/msm_iommu.c +0
-0
[ ... ]
Quoted 6 lines
drivers/gpu/drm/msm/msm_iommu.c +2
-0@@ -746,6 +755,19 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks)mutex_init (&iommu->init_lock); +/* +* ARM32 attaches a DMA mapping domain to every IOMMU-backed device,
drivers/gpu/drm/msm/msm_iommu.c struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks) · line 769
Quoted 10 lines
drivers/gpu/drm/msm/msm_iommu.c +10
-0+* which would make attaching our own domain fail with -EBUSY. +*/ +if (IS_ENABLED (CONFIG_ARM_DMA_USE_IOMMU )) { +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev); + +if (mapping) { +arm_iommu_detach_device (dev); +arm_iommu_release_mapping (mapping); + } + }
[Severity: High]
Could backporting this patch without the rest of its upstream series cause a NULL pointer dereference in __free_iova() when probing the GPU or display controller on APQ8064?
Upstream commit 140b13475302 ("drm/msm: detach the ARM DMA mapping before attaching our own domain") is patch 3/3 of the series at [email protected], alongside two prerequisite fixes in drivers/iommu/msm_iommu.c:
1/3: "iommu/msm: track a context master per device and IOMMU" 2/3: "iommu/msm: use the IOMMU device for page table allocation"
Neither of those prerequisite patches is present in this tree.
During initial DMA setup in arm_setup_iommu_dma_ops(), __arm_iommu_attach_device(dev, mapping) runs before set_dma_ops(dev, &iommu_ops). Without patch 2/3, msm_iommu_attach_dev() and msm_iommu_domain_config() set priv->cfg.iommu_dev to the client device (dev) instead of the IOMMU hardware device:
drivers/iommu/msm_iommu.c:msm_iommu_domain_config() {
priv->cfg = (struct io_pgtable_cfg) {
.pgsize_bitmap = priv->domain.pgsize_bitmap,
.ias = 32,
.oas = 32,
.tlb = &msm_iommu_flush_ops,
.iommu_dev = priv->dev,
};
}When alloc_io_pgtable_ops() allocates the L1 page table in __arm_v7s_alloc_table(), dev->dma_ops is still NULL, so dma_map_single() uses direct DMA and returns the physical RAM address virt_to_phys(data->pgd) without allocating an IOVA in mapping. Afterward, arm_setup_iommu_dma_ops() sets dev->dma_ops = &iommu_ops.
When msm_iommu_new() now calls arm_iommu_detach_device(dev), iommu_detach_device() runs while dev->dma_ops is still &iommu_ops:
arch/arm/mm/dma-mapping.c:arm_iommu_detach_device() {
...
iommu_detach_device(mapping->domain, dev);
kref_put(&mapping->kref, release_iommu_mapping);
to_dma_iommu_mapping(dev) = NULL;
set_dma_ops(dev, NULL);
}This triggers the following call chain:
iommu_detach_device(mapping->domain, dev)
-> msm_iommu_identity_attach()
-> free_io_pgtable_ops(priv->iop)
-> arm_v7s_free_pgtable()
-> __arm_v7s_free_table()
-> dma_unmap_single(cfg->iommu_dev, __arm_v7s_dma_addr(table), ...)
-> arm_iommu_unmap_page()
-> __free_iova(mapping, iova, len)Because cfg->iommu_dev is the client device and dev->dma_ops is still &iommu_ops, arm_iommu_unmap_page() treats the page table's physical RAM address (for example >= 0x80000000 on APQ8064) as an IOVA handle in mapping->domain, hits WARN_ON(!ARM_V7S_PTE_IS_VALID(pte[i])) in iommu_unmap(), and passes that address to __free_iova():
arch/arm/mm/dma-mapping.c:__free_iova() {
...
spin_lock_irqsave(&mapping->lock, flags);
bitmap_clear(mapping->bitmaps[bitmap_index], start, count);
spin_unlock_irqrestore(&mapping->lock, flags);
}Since arm_iommu_create_mapping() initializes mapping with base = 0, mapping_size = 128 MB, extensions = 32, and nr_bitmaps = 1 (leaving mapping->bitmaps[1..31] NULL), a physical address >= 0x80000000 yields bitmap_index >= 16 and dereferences a NULL mapping->bitmaps[bitmap_index] (or hits BUG_ON(bitmap_index >= mapping->nr_bitmaps) if out of range).
In addition, this tree includes commit da33e87bd2bf ("iommu: Handle yet another race around registration") without patch 1/3 ("iommu/msm: track a context master per device and IOMMU"), so find_iommu_for_dev() and msm_iommu_attach_dev() call list_first_entry(&iommu->ctx_list, ...) on IOMMU instances whose ctx_list is still empty, and insert_iommu_master() does not track per-IOMMU context masters for devices attached to two IOMMU instances (gfx3d/gfx3d1 for the GPU and mdp_port0/mdp_port1 for MDP4).
Should patches 1/3 and 2/3 from the same series also be backported before this change?
Quoted 4 lines
drivers/gpu/drm/msm/msm_iommu.c +1
-0+ ret =iommu_attach_device (iommu->domain, dev);if (ret) {iommu_domain_free (domain);
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 NFSv4: pin the superblock for active state owners
In reply to Sasha LevinFrom: Jia Zhu <[email protected]>
[ Upstream commit 8cb1ce7aa0e8ac30e55f5bccfb80125f2e43e84a ]
NFSv4 open state can outlive the file and dentry that created it. This was observed in production when NFSv4 state recovery, such as after a server reboot or lease expiration, raced with unmount.
The race requires recovery to hold an open state reference while the last open file is closed and the filesystem is unmounted, allowing the superblock's active reference to drop to zero between refcount_inc(&state->count) and nfs4_put_open_state():
state manager umount
nfs4_run_state_manager()
nfs4_do_reclaim()
nfs4_reclaim_open_state()
refcount_inc(&state->count)
...
close last file
generic_shutdown_super()
"Busy inodes after unmount"
nfs_free_server()
nfs4_put_open_state()
iput(inode)
evict()
nfs_clear_inode()
nfs_zap_acl_cache()The "VFS: Busy inodes after unmount" warning is the visible symptom of that lifetime mismatch: superblock teardown proceeds even though the NFS open state still pins an inode. After umount has freed the server, the state manager can then run nfs4_put_open_state() for the last open-state reference. The resulting iput(inode) can evict an NFS inode with freed server data, causing crashes at nfs_zap_acl_cache(). This can be reproduced by delaying the reclaim path before nfs4_put_open_state(), then closing the last file and unmounting the NFS mount.
Pin the superblock while a state owner is active, and drop the pin when the owner becomes idle again, so the NFS server stays alive until all open state associated with the owner has been released.
---
LLM Generated explanations, may be completely bogus:
This is a real NFSv4 recovery-vs-unmount use-after-free that exists in this 6.12 tree. The fix is small, uses the existing nfs_sb_active pattern, and should be backported.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[NFSv4] [pin] pin the superblock for active state owners**
Subsystem prefix: NFSv4. Action verb: **pin** (lifetime/refcount fix, same class as “ensure”/“prevent”). Claimed intent: keep the NFS superblock alive while a state owner is active so umount cannot free nfs_server under recovery.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Verified on 8cb1ce7aa0e8ac30e55f5bccfb80125f2e43e84a:
- **Assisted-by:** Codex:GPT-5
- **Signed-off-by:** Jia Zhu \<[email protected]\> (author)
- **Signed-off-by:** Trond Myklebust \<[email protected]\> (NFS client maintainer; committer)
- **No Fixes:**
- **No Reported-by / Tested-by / Reviewed-by / Acked-by**
- **No Link:**
- **No Cc: [email protected]** (expected for this review pipeline; not a negative)
Notable: production report is in the body (“observed in production”), not a Reported-by tag. Maintainer SOB is a strong quality signal.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** NFSv4 open state can outlive the file/dentry. State recovery (nfs4_reclaim_open_state) holds refcount_inc(&state->count) across a window where the last file can be closed and the mount unmounted.
- **Symptom:** VFS: Busy inodes after unmount, then crash in nfs_zap_acl_cache() after nfs_free_server().
- **Failure mode:** umount tears down the superblock/nfs_server while recovery still pins an inode via open state. Later nfs4_put_open_state() → iput() → evict() → nfs_clear_inode() → nfs_zap_acl_cache() → NFS_PROTO(inode) dereferences freed nfs_server.
- **Version info:** none in the message. Race is in long-standing NFSv4 reclaim/umount code.
- **Root cause:** open-state lifetime is not tied to s_active / nfs_server lifetime.
- **Fix:** nfs_sb_active() while a state owner is counted; nfs_sb_deactive() when so_count hits 0.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not hidden.** Explicit production crash/UAF with a race diagram and reproduction (delay reclaim, close last file, umount). Not cleanup/refactor.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** fs/nfs/nfs4state.c only (+33/-7, 40 lines)
- **Functions:**
- **Added:** nfs4_get_state_owner_active_locked()
- **Modified:** nfs4_find_state_owner_locked(),
`nfs4_insert_state_owner_locked()`, `nfs4_alloc_state_owner()`,
`nfs4_get_state_owner()`, `nfs4_put_state_owner()`- **Scope:** single-file surgical lifetime fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
1. **Idle-owner revival (find/insert, cl_lock held):** before: always list_del_init(so_lru) + atomic_inc(so_count). After: if so_count == 0, pin SB via nfs_sb_active(); if pin fails (umount already dropped s_active), return NULL instead of reviving.
2. **New owner alloc:** after kzalloc, call nfs_sb_active(server->super); fail allocation if umount is underway.
3. **Duplicate insert:** if insert returns an existing owner, free the new one **and** drop the extra pin taken in alloc.
4. **Last put:** save sb before dropping so_count; on 0, put on LRU, drop cl_lock, then nfs_sb_deactive(sb) (may call deactivate_super()).
Pin is 0/1 per owner: taken on 0→1, dropped on 1→0. Extra so_count bumps (reclaim, close, opendata) do not take extra pins.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[Use-after-free / lifetime race] [superblock and nfs_server freed while NFSv4 open state still holds an inode]**
Verified crash path in this tree:
- nfs4_reclaim_open_state() does refcount_inc(&state->count) then later nfs4_put_open_state() (fs/nfs/nfs4state.c).
- nfs4_put_open_state() does iput(inode) then nfs4_put_state_owner().
- nfs_kill_super() calls nfs_free_server() even if inodes remain.
- nfs_clear_inode() → nfs_zap_acl_cache() → NFS_PROTO(inode) → NFS_SERVER(inode)->nfs_client->rpc_ops (include/linux/nfs_fs.h), which is UAF if s_fs_info was already freed.
Category: **race + UAF**. Same established NFS pattern as delegation/unlink/opendata SB pins.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** high. Pin/unpin is balanced (alloc pin, duplicate-insert deactive, last-put deactive). nfs_sb_active() is atomics-only, so it is safe under cl_lock. nfs_sb_deactive() runs after dropping cl_lock because deactivate_super() can sleep.
- **Regression risk:** low–medium. Umount now waits until owners go idle (intended; matches other NFS pins). New OPEN during umount can fail if s_active==0 (correct). Imbalance would hang umount or leak s_active; the get/put pairing is straightforward.
- **Red flags:** none for APIs/features. AI-assisted, but maintainer- committed with unchanged v1.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Idle LRU + atomic_inc(so_count) in find/insert: 0aaaf5c424c7ff (“NFS: Cache state owners after files are closed”, Chuck Lever, 2011) — **is an ancestor of HEAD**.
- nfs4_put_state_owner LRU move: 7bf97bc27308cf (2012).
- nfs4_alloc_state_owner: structure since d1e284d50a1506 (2012); kzalloc(sizeof(*sp)) still used in **this** 6.12 tree.
- Reclaim extra open-state ref: long-standing nfs4_reclaim_open_state().
Bug is in code present for many years, not post-6.12.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Introducer is the 2011 LRU caching plus reclaim holding open-state refs without an SB pin. Both exist in this tree.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: recent fs/nfs/nfs4state.c work is other recovery/hang fixes (71e07bb1556c7, a848c29e34861, 8f6a7c9467eaf). No prerequisite refactor for this pin. **Standalone**, not patch X/Y.
Parent of 8cb1ce7aa0e8 is 932a8cf6abb2b (unrelated sunrpc pipefs UAF). Not required here.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Jia Zhu has no other commits on fs/nfs/ in this tree. Trond (maintainer) committed it. Related historical pin: 9f0f8e12c48e4 “NFSv4: Pin the superblock while we're returning the delegation” (2015) **is** in this tree.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: **None.** Needs existing nfs_sb_active/nfs_sb_deactive (fs/nfs/super.c; present). kzalloc_obj in the mainline hunk is **not** used in this tree’s nfs4_alloc_state_owner (still kzalloc(sizeof(*sp))). Backport keeps kzalloc and adds the nfs_sb_active check. kzalloc_obj the macro exists in 6.12 include/linux/slab.h but is not a dependency of the fix.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 8cb1ce7aa0e8 → https://patch.msgid.link/20260707133623.230
[email protected]
- b4 dig -a: **v1 only**, 2026-07-07, Jia Zhu. Applied version **is** v1.
- b4 mbox: **1 message, no replies, no NAK, no v2.**
- Merged via Trond’s NFS pull for Linux 7.3 (tags/nfs-for-7.3-1), into Linus as part of 73e3f0710014. SHA 8cb1ce7aa0e8, 2026-08-17.
- Pull letter lists it under Jia Zhu and describes “NFSv4: Fix another state manager race with umount” under **Other bugfixes** (not the “Stable fixes” bullet list). That is description of this race, not a second patch in the shortlog.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To Trond Myklebust, Anna Schumaker; Cc linux-nfs, linux-kernel. No on-list review comments. Maintainer applied it (~6 weeks later).
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: no syzbot/bugzilla. Author states **production** observation and a concrete repro (delay reclaim, close last file, umount). Verified reclaim/put_open_state/nfs_zap_acl_cache code matches the diagram.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: standalone. Same 7.3 pull also has cf616096a0f3 “NFS: Pin the struct nfs_server during a FREE_STATEID call” — **different bug**, **not** an ancestor of this HEAD, **not** required for this patch.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search returned **403**. **UNVERIFIED** whether it was discussed on stable@. No evidence it was rejected. Absence of Cc: stable is expected.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
Record: nfs4_get_state_owner_active_locked (new), nfs4_find_state_owner_locked, nfs4_insert_state_owner_locked, nfs4_alloc_state_owner, nfs4_get_state_owner, nfs4_put_state_owner. Related unchanged: nfs4_reclaim_open_state, nfs4_do_reclaim, nfs4_put_open_state.
**Step 5.2: TRACE CALLERS**
Record:
- nfs4_get_state_owner(): nfs4_do_open() (nfs4proc.c), nfs4file.c (copy/open context). Userspace OPEN on NFSv4.
- nfs4_put_state_owner(): nfs4_put_open_state, __nfs4_close, nfs4_do_reclaim, opendata free, several nfs4proc.c paths. Process/workqueue context (iput, RPC completion). nfs_sb_deactive() → deactivate_super() is sleepable; those paths already sleep.
- nfs4_do_reclaim() uses atomic_inc_not_zero(&sp->so_count) (already-active owners only). With this patch those owners already hold the SB pin from the original get.
**Step 5.3: TRACE CALLEES**
Record: nfs_sb_active / nfs_sb_deactive (super.c): first pin keeps an extra s_active; last nfs_sb_deactive calls deactivate_super(). Same helpers as unlink, pnfs, delegation, callback, opendata.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: reachable from NFSv4 OPEN + lease recovery + umount. State manager is a kthread (nfs4_run_state_manager). Unprivileged users with an NFSv4 mount can close the last file and umount (typically admin for umount). Recovery after server reboot/lease expiry is a **common** enterprise path. **Yes, user-triggerable on any NFSv4 client.**
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: nfs_sb_active already used in unlink.c, pnfs.c, nfs4proc.c (opendata), inode.c, delegation.c, callback_proc.c. 9f0f8e12c48e4 is the same class of fix. This extends that pattern to state owners.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** Tree is **6.12.111** (pending-6.12, p-6.12-3-gc504cf0baa3d8).
git merge-base --is-ancestor 8cb1ce7aa0e8 HEAD → **not an ancestor**.
Local nfs4_find_state_owner_locked still does unpinned atomic_inc; nfs4_put_state_owner has no nfs_sb_deactive; reclaim still refcount_inc + nfs4_put_open_state. Bug is here.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **minor context only.** Same function bodies except alloc uses kzalloc(sizeof(*sp), gfp_flags) here vs kzalloc_obj(*sp, gfp_flags) upstream. Rest should apply with fuzz or a one-line context tweak. No structural conflict.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: no nfs4_get_state_owner_active_locked. Delegation SB pin is present; it does not cover this reclaim/open-state race. No alternate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: **[fs/nfs NFSv4 client] [IMPORTANT]**
Not core mm/VFS, but NFSv4 is widely used (enterprise NAS, diskless, containers). Crash is in client umount/recovery.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: mature, still actively fixed. State-owner LRU dates to 2011; this is a long-standing lifetime hole, not a new-subsystem issue.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: **NFSv4 client users** (CONFIG_NFS_V4). Trigger: recovery (reboot/lease expiry) racing last close + umount. Production report from ByteDance.
**Step 8.2: TRIGGER CONDITIONS**
Record: needs NFSv4 state recovery overlapping last-file close and umount. Timing-dependent but **reproduced** (delay before nfs4_put_open_state) and seen in production. Umount is typically privileged; recovery is not a syzbot syscall gadget, but the crash is real.
**Step 8.3: FAILURE MODE SEVERITY**
Record: **UAF → kernel oops/crash after “Busy inodes after unmount”.** NFS_PROTO() loads nfs_client from freed nfs_server. **Severity:
HIGH/CRITICAL.**
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** high — prevents production NFSv4 umount crash/UAF.
- **Risk:** low–medium — ~33 lines, one file, established helpers. Umount waits for idle owners (correct). Pin imbalance would hang umount; pairing is clear.
- **Ratio:** benefit outweighs risk.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Production crash/UAF with a clear race diagram and repro.
- Buggy code is in this 6.12 tree; fix is not.
- Small, one-file, uses existing nfs_sb_active/nfs_sb_deactive.
- NFS maintainer (Trond) committed it; merged to mainline for 7.3.
- Same class as prior NFS SB-pin fixes already in this tree.
- Reclaim path verified: extra open-state ref without SB pin; nfs_kill_super frees server with busy inodes.
**AGAINST:**
- No Fixes:/Cc: stable (expected; not a reason to reject).
- No on-list review replies; AI-assisted. Mitigated by maintainer SOB.
- Pull letter put it under “Other bugfixes” not “Stable fixes” (likely because it lacked Cc: stable).
- Umount may wait longer while owners drain — intended, same as other NFS pins.
- Tiny backport context (kzalloc vs kzalloc_obj).
**UNRESOLVED:**
- lore.kernel.org/stable returned 403; no confirmed stable@ thread.
- No public Tested-by besides the author’s production/repro claim (unverified independently, but code path matches).
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — pin/unpin is balanced; production + explicit repro; maintainer applied v1 unchanged.
2. Fixes a real bug that affects users? **PASS** — production UAF/crash.
3. Important (crash/security/corruption/deadlock)? **PASS** — crash/UAF on umount during recovery. **HIGH/CRITICAL**.
4. Small and contained? **PASS** — +33/-7, one file.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — same functions; minor kzalloc context only.
**Step 9.3: EXCEPTION CATEGORIES**
Record: none of device-ID/quirk/DT/build/docs. Qualifies as a normal important bugfix.
**Step 9.4: DECISION**
Backport to this 6.12.y tree. The lifetime hole is here, the failure is a real crash, and the fix is the same SB-pin pattern NFS already uses.
---
### What this solves for stable users
On NFSv4, lease recovery can hold an open-state ref while the last file is closed and the mount is unmounted. VFS then warns Busy inodes after unmount, nfs_free_server() frees nfs_server, and the later iput in nfs4_put_open_state() oopses in nfs_zap_acl_cache() via NFS_PROTO(). Pinning the superblock for the life of an active state owner keeps nfs_server alive until that state is dropped.
### Risk vs benefit
Benefit is high (production oops). Risk is low: ~30 lines, existing helpers, umount waits instead of tearing down under live state. Backport may need to keep kzalloc(sizeof(*sp), gfp_flags) instead of kzalloc_obj.
---
### Verification
- **[Phase 1]** git describe HEAD / Makefile: **6.12.111**, branch pending-6.12. Tags on 8cb1ce7aa0e8: Assisted-by Codex, SOB Jia Zhu
+ Trond; no Fixes/Cc stable/Reported-by.
- **[Phase 2]** Diff: +33/-7 in fs/nfs/nfs4state.c. Local reclaim/put_open_state/nfs_clear_inode/NFS_PROTO match the crash story.
- **[Phase 2]** nfs_sb_active/nfs_sb_deactive in fs/nfs/super.c confirmed (atomics; last deactive → deactivate_super).
- **[Phase 3]** git blame on find/put: LRU caching 0aaaf5c424c7ff (2011) **is** ancestor. git merge-base --is-ancestor 8cb1ce7aa0e8 HEAD → **false**.
- **[Phase 3]** Parent 932a8cf6abb2b is unrelated sunrpc UAF; not a prerequisite.
- **[Phase 4]** b4 dig -c 8cb1ce7aa0e8: lore msgid [email protected]. -a: v1 only. -w:
Trond + Anna + linux-nfs. b4 mbox: 1 message, no replies.
- **[Phase 4]** LKML GIT PULL 2026-08-26: Jia Zhu commit listed; merged to Linus (73e3f0710014).
- **[Phase 4]** lore.kernel.org and lore stable search: **403** — UNVERIFIED stable@ discussion.
- **[Phase 5]** Callers: nfs4_do_open, nfs4file.c, reclaim, opendata, close. nfs4_do_reclaim uses atomic_inc_not_zero (active owners only → pin already held).
- **[Phase 6]** Local find/insert/put still unpinned. Alloc still kzalloc(sizeof(*sp)) vs upstream kzalloc_obj.
- **[Phase 7]** CONFIG_NFS_V4 exists; NFSv4 client is important for LTS.
- **[Phase 8]** Failure: UAF/oops after busy-inodes warning. Severity HIGH/CRITICAL.
- **UNVERIFIED:** independent tester beyond author; stable@ archive contents.
**YES**
fs/nfs/nfs4state.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-)
fs/nfs/nfs4state.c +33 -7
@@ -403,6 +403,26 @@ const struct cred *nfs4_get_clid_cred(struct nfs_client *clp)return cred; } +static bool +nfs4_get_state_owner_active_locked (struct nfs4_state_owner *sp) +{ +struct nfs_server *server = sp->so_server; + +/* +* A counted state owner may dereference so_server until the final +* nfs4_put_state_owner(). Pin the superblock when reviving an idle +* owner so umount cannot free the server underneath it. +*/ +if (atomic_read (&sp->so_count) ==0 ) { +if (!nfs_sb_active (server->super)) +return false; +if (!list_empty (&sp->so_lru)) +list_del_init (&sp->so_lru); + } +atomic_inc (&sp->so_count); +return true; +} +static struct nfs4_state_owner *nfs4_find_state_owner_locked (struct nfs_server *server,const struct cred *cred) {
@@ -421,9 +441,8 @@ nfs4_find_state_owner_locked(struct nfs_server *server, const struct cred *cred)else if (cmp >0 ) p = &parent->rb_right;else { -if (!list_empty (&sp->so_lru)) -list_del_init (&sp->so_lru); -atomic_inc (&sp->so_count); +if (!nfs4_get_state_owner_active_locked (sp)) +return NULL ;return sp; } }
@@ -449,9 +468,8 @@ nfs4_insert_state_owner_locked(struct nfs4_state_owner *new)else if (cmp >0 ) p = &parent->rb_right;else { -if (!list_empty (&sp->so_lru)) -list_del_init (&sp->so_lru); -atomic_inc (&sp->so_count); +if (!nfs4_get_state_owner_active_locked (sp)) +return NULL ;return sp; } }
@@ -501,6 +519,10 @@ nfs4_alloc_state_owner(struct nfs_server *server, sp =kzalloc (sizeof (*sp), gfp_flags);if (!sp)return NULL ; +if (!nfs_sb_active (server->super)) { +kfree (sp); +return NULL ; + } sp->so_seqid.owner_id =atomic64_inc_return (&server->owner_ctr); sp->so_server = server; sp->so_cred =get_cred (cred);
@@ -586,8 +608,10 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,spin_lock (&clp->cl_lock); sp =nfs4_insert_state_owner_locked (new);spin_unlock (&clp->cl_lock); -if (sp != new) +if (sp != new) {nfs4_free_state_owner (new); +nfs_sb_deactive (server->super); + } out:nfs4_gc_state_owners (server);return sp;
@@ -609,6 +633,7 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp) {struct nfs_server *server = sp->so_server;struct nfs_client *clp = server->nfs_client; +struct super_block *sb = server->super;if (!atomic_dec_and_lock (&sp->so_count, &clp->cl_lock))return ;
@@ -616,6 +641,7 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp) sp->so_expires = jiffies;list_add_tail (&sp->so_lru, &server->state_owners_lru);spin_unlock (&clp->cl_lock); +nfs_sb_deactive (sb); }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 misc: ibmvmc: release send buffer on write errors
In reply to Sasha LevinFrom: Yousef Alhouseen <[email protected]>
[ Upstream commit fd62c1f591372f7dc4c5bc041569c2f0a4a86be1 ]
ibmvmc_get_valid_hmc_buffer() marks the selected send buffer busy before ibmvmc_write() validates the backing storage or copies data from user space. Error exits after that point leave the buffer permanently busy.
Keep the buffer pointer until ownership is handed to the hypervisor, and mark it free again on local write failures. Also report an RDMA send failure instead of returning a successful byte count.
---
LLM Generated explanations, may be completely bogus:
The local checkout is **v7.3-rc4** (7.3.0-rc4). The ibmvmc write path and the finite send-buffer pool have been here since the driver landed in v4.18; this is a small leak/false-success fix on that path.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[misc/ibmvmc] [release] [free the HMC send buffer when ibmvmc_write() fails after taking it]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Signed-off-by:** Yousef Alhouseen \<[email protected]\> (author)
- **Link:** https://patch.msgid.link/20260624185925.2133-1-
[email protected]
- **Signed-off-by:** Greg Kroah-Hartman \<[email protected]\> (char-misc maintainer; applied)
- No **Fixes:**, **Reported-by:**, **Tested-by:**, **Reviewed-by:**, **Acked-by:**, or **Cc: stable** (absence is expected for this review)
- Ignored: any pipeline **Signed-off-by: Sasha Levin** / **Upstream commit** markers (none in git show)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** ibmvmc_get_valid_hmc_buffer() sets buffer->free = 0 before ibmvmc_write() checks backing storage, copies from userspace, or RDMA-sends. Error exits after that leave the buffer **permanently busy**.
- **Symptom:** writes start returning -EBUSY once the pool is exhausted; RDMA failures were also reported as a **successful byte count**.
- **Version info:** none in the message. Driver introduced in v4.18 (0eca353e7ae75).
- **Root cause (author):** buffer taken too early; not returned on local failure; ibmvmc_send_msg() return ignored.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not disguised.** Explicit resource-leak + wrong-success-return fix.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** drivers/misc/ibmvmc.c — **+8 / −2** (commit stat: 10 lines changed)
- **Function:** ibmvmc_write() only
- **Scope:** single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Verified against parent of fd62c1f591372 and current ibmvmc_write():
- **Before:** vmc_buffer uninitialized; after ibmvmc_get_valid_hmc_buffer() the buffer is busy; goto out on missing real_addr_local, copy_from_user failure, zero-length write (p == buffer), or ignored ibmvmc_send_msg() failure never sets free = 1. Success path always returned p - buffer even if RDMA failed.
- **After:** vmc_buffer = NULL at declaration. On ibmvmc_send_msg() failure, ret = -EIO and goto out. On send success, vmc_buffer = NULL so the buffer stays with the hypervisor. out: sets vmc_buffer->free = 1 if the pointer is still held.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category (a) + (g):** error-path resource leak of a finite buffer pool; ignored RDMA error treated as success.
- **Mechanism:** ibmvmc_get_valid_hmc_buffer() does buffer[i].free = 0 (lines 336–339). Default pool is **32** (DEFAULT_BUF_POOL_SIZE), range 16–64. Each leaked buffer is gone until the HMC session is reset. Zero-length write() takes a buffer, skips the copy loop, hits if (p == buffer) goto out, and leaks one slot. Bad user pointers (-EFAULT) and h_copy_rdma() failures do the same. The send-failure path previously returned a **positive byte count**.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** obviously correct. NULL init is required so early goto out (before a buffer is taken) does not free garbage. Clearing the pointer only after successful ibmvmc_send_msg() matches ibmvmc_send_msg() transferring ownership (buffer->owner = VMC_BUF_OWNER_HV) only after RDMA succeeds. Assignment of free = 1 is done under the already-held hmc->lock (does not call ibmvmc_free_hmc_buffer(), which would deadlock).
- **Regression risk:** low. Does not change locking, APIs, or data structures. Worst case is incorrectly marking a buffer free after HV already owns it; that is avoided by NULLing the pointer on success.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record: Buggy ibmvmc_write / ibmvmc_get_valid_hmc_buffer / ibmvmc_send_msg introduced by **0eca353e7ae75** (“misc: IBM Virtual Management Channel Driver (VMC)”, Bryant G. Ly, 2018-04-25). **git describe --contains:** v4.18-rc1~135^2~18. Present for the life of the driver.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Introducer identified by blame:0eca353e7ae75. **git merge-base --is-ancestor 0eca353e7ae75 HEAD:** yes. No intermediate write-path buffer-release fix in git log -- drivers/misc/ibmvmc.c.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent ibmvmc commits are independent (inbound length check 18189e5d84aa0, named vio_device_id initializers). Not a numbered series. Standalone.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Yousef Alhouseen is not the listed maintainer (Brad Warrum / Ritu Agarwal). Same author has a sibling ibmvmc receive-path bounds fix. Not a prerequisite.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. The hunk only uses ibmvmc_send_msg(), vmc_buffer->free, and the existing out: unlock. **Applies standalone.** Nearby inode_set_mtime_to_ts() is untouched.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- **b4 dig -c fd62c1f591372:** https://patch.msgid.link/20260624185925
[email protected]
- **b4 dig -a:** **v1 only** (2026-06-24)
- **b4 dig -m:** thread is the patch only; **no replies, no NAK, no
Cc: stable suggestion**
- **WebFetch lore.kernel.org:** **403** — discussion recovered via b4 mbox instead
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (**b4 dig -w**): To IBM maintainers Brad Warrum, Ritu Agarwal; Cc Arnd Bergmann, Greg Kroah-Hartman, linux-kernel. **No public Reviewed-by/Acked-by.** Greg applied it (char-misc).
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by / bugzilla / syzbot. Bug is from code inspection. **UNVERIFIED:** number of production hits.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone [PATCH], not n/m. Sibling 18189e5d84aa0 (oversized inbound CRQ) is a different bug.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable WebFetch **403**. **UNVERIFIED** whether stable@ discussed this. No Cc: stable on the patch.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: **ibmvmc_write()** (modified). Helpers involved, not changed:
**ibmvmc_get_valid_hmc_buffer()**, **ibmvmc_send_msg()**.
**Step 5.2: TRACE CALLERS**
Record: ibmvmc_write is .write in ibmvmc_fops (drivers/misc/ibmvmc.c ~1394–1397). Reachable from **write(2)** on the misc device /dev/ibmvmc. ibmvmc_send_msg has a **single**
caller: ibmvmc_write. ibmvmc_ioctl_sethmcid() also calls ibmvmc_get_valid_hmc_buffer() (line 1250); **this patch does not fix that path.**
**Step 5.3: TRACE CALLEES**
Record: ibmvmc_get_valid_hmc_buffer (marks busy), copy_from_user, ibmvmc_send_msg → h_copy_rdma then ibmvmc_send_crq. Error paths now return the buffer under hmc->lock.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: userspace write() → VFS → ibmvmc_write. Triggerable from the management partition with /dev/ibmvmc open (PowerVM HMC-alternative). **Zero-length write** and **copy_from_user failure** do not need hypervisor errors.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: ibmvmc_ioctl_sethmcid() takes a buffer, then fails on !buffer->real_addr_local **after dropping the lock**, without setting free = 1. Same class of leak, **unfixed by this commit**. Does not make this write-path fix incomplete for its own bug.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Record:
- **git describe HEAD:** v7.3-rc4-27-gf0100363d8c37
- **make kernelversion / Makefile:** 7.3.0-rc4
- Driver file present; buggy pattern is the original 2018 ibmvmc_write() (parent of fd62c1f591372). **git merge-base --is- ancestor 0eca353e7ae75 HEAD:** yes. Bug is **not** post-branch.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** on this tree. The hunk does not depend on timestamp-accessor or kmalloc-obj churn. No conflicting rewrite of ibmvmc_write().
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No earlier write-buffer-release fix. 97b715b62e5b4 is GFP_ATOMIC under spinlock in DMA alloc, unrelated.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **drivers/misc IBM VMC** (CONFIG_IBMVMC, depends on PPC_PSERIES). **PERIPHERAL** for the kernel as a whole; **IMPORTANT** for PowerVM management partitions (HMC alternative via /dev/ibmvmc).MAINTAINERS: “IBM Power Virtual Management Channel Driver”, Supported.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature/low-churn since 2018; a handful of mechanical and two 2026 correctness fixes. Long-lived bug, not a new-subsystem issue.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver-specific / config-specific / platform-specific:** CONFIG_IBMVMC on pseries PowerVM management partitions.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- **Common/easy:** write(fd, buf, 0) after the session is ready — takes a buffer, skips the copy loop, leaks it. Also -EFAULT from a bad user pointer.
- **Less common:** missing real_addr_local; h_copy_rdma() failure.
- Privileged vs unprivileged: miscdevice has **no .mode**; typical /dev/ibmvmc policy is management-partition specific (**UNVERIFIED** whether world-writable on shipped distros). Any opener of the device can trigger it.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Exhausting **32** (default) send buffers → all further writes **-EBUSY** until session reset: management channel **DoS / hang**.
- Ignored RDMA error → userspace sees a **successful write** for a message that was **not** sent: **lost management traffic**.
- **Severity: HIGH** for this driver (not a kernel oops; operational failure of the VMC).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record: **Benefit: high** for ibmvmc users (prevents permanent send-pool exhaustion and false success). **Risk: very low** (8 lines, error path, no API/lock/order change). **Ratio: strongly favors backport.**
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real finite-pool leak since v4.18, user-triggerable from write(2) (including count 0).
- False success on RDMA send failure.
- 8-line, obviously correct fix; NULL-init + free-on-error + check send return.
- Driver and buggy code exist in this 7.3-rc4 tree; no missing prerequisites.
- Merged by Greg KH; IBM maintainers were CC’d.
**AGAINST:**
- Peripheral (PPC_PSERIES / PowerVM only), not a universal crash.
- No Fixes/Reported-by/Tested-by; no mailing-list review comments (v1 applied as-is).
- Does not fix the similar ioctl sethmcid leak.
**UNRESOLVED:**
- lore.kernel.org HTTP 403; stable@ discussion not fetched (b4 mbox used instead).
- Production hit count unknown.
- /dev/ibmvmc default permissions on distros unknown.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — logic matches ownership rules; merged to char-misc. No extra Tested-by.
2. Fixes a real bug that affects users? **PASS** — leaked send buffers and false-success writes on /dev/ibmvmc.
3. Important issue? **PASS** — pool exhaustion disables the management channel; silent dropped messages. HIGH for this driver.
4. Small and contained? **PASS** — +8/−2, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — same ibmvmc_write() structure; clean apply.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **None** (not a device-ID/quirk/DT/build/docs exception). Qualifies as a normal small bugfix.
**Step 9.4: MAKE YOUR DECISION**
This tree has had the 2018 ibmvmc write path for its entire life. The patch returns a send buffer that was marked busy and then abandoned, and it stops treating RDMA failure as a successful write. That is a real, user-visible failure of the PowerVM management channel, with a tiny contained fix and no dependencies.
**What problem it solves for this tree:** after ibmvmc_get_valid_hmc_buffer() marks a slot busy, ibmvmc_write() could goto out without free = 1 (zero-length write, -EFAULT, missing backing store, or h_copy_rdma failure). Default **32** slots then stay busy and later writes get -EBUSY. Failed RDMA also used to return a positive count.
**Risk vs benefit:** very low risk vs high benefit for ibmvmc users on this tree.
Verification:
- [Phase 1] git show fd62c1f591372 --format=fuller: subject/body/tags as recorded; no Fixes/Reported-by
- [Phase 2] Parent ibmvmc_write via git show fd62c1f591372^:drivers/misc/ibmvmc.c: no free-on-error; ibmvmc_send_msg() return ignored
- [Phase 2] Current ibmvmc_write (lines 1039–1144): NULL init, send check, free = 1 on out
- [Phase 2] ibmvmc_get_valid_hmc_buffer sets free = 0; ibmvmc_send_msg returns on h_copy_rdma failure before owner = HV
- [Phase 2] drivers/misc/ibmvmc.h: DEFAULT_BUF_POOL_SIZE 32, min 16, max 64
- [Phase 3] git blame on write/get/send: 0eca353e7ae75; git describe --contains 0eca353e7ae75 → v4.18-rc1
- [Phase 3] git merge-base --is-ancestor 0eca353e7ae75 HEAD and fd62c1f591372 HEAD: both true
- [Phase 3] git log --oneline -- drivers/misc/ibmvmc.c: no prerequisite series
- [Phase 4] b4 dig -c/-a/-w/-m: v1 lore URL; CC IBM maintainers + Greg/Arnd; mbox is patch-only
- [Phase 4] WebFetch lore/stable: 403; treated as UNVERIFIED for public review/stable@
- [Phase 5] grep: ibmvmc_write only from ibmvmc_fops.write; ibmvmc_send_msg only from ibmvmc_write
- [Phase 5] ibmvmc_ioctl_sethmcid still has a related leak (not a reason to drop this write fix)
- [Phase 6] git describe HEAD / Makefile: v7.3-rc4 / 7.3.0-rc4; driver present
- [Phase 7] Kconfig IBMVMC depends on PPC_PSERIES; MAINTAINERS Supported
- [Phase 8] Failure mode verified from code: pool exhaustion → -EBUSY; ignored send rc → false success
- UNVERIFIED: stable@ archives; field reports; /dev/ibmvmc distro permissions
**YES**
drivers/misc/ibmvmc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/misc/ibmvmc.c +8 -2
@@ -1040,7 +1040,7 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { struct inode *inode; -struct ibmvmc_buffer *vmc_buffer; +struct ibmvmc_buffer *vmc_buffer =NULL ;struct ibmvmc_file_session *session;struct crq_server_adapter *adapter;struct ibmvmc_hmc *hmc;
@@ -1130,9 +1130,15 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer,dev_dbg (adapter->dev,"write: file = 0x%lx, count = 0x%lx\n" , (unsigned long )file, (unsigned long )count); -ibmvmc_send_msg (adapter, vmc_buffer, hmc, count); +if (ibmvmc_send_msg (adapter, vmc_buffer, hmc, count)) { + ret = -EIO ; + goto out; + } + vmc_buffer =NULL ; ret = p - buffer; out: +if (vmc_buffer) + vmc_buffer->free =1 ;spin_unlock_irqrestore (&hmc->lock, flags);return (ssize_t )(ret); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 riscv: kprobes: Prevent probes in breakpoint handlers
In reply to Sasha LevinFrom: Rui Qi <[email protected]>
[ Upstream commit e7d8ea6c6d1bc685a8943ffad2d3679be92d164f ]
The ftrace selftest multiple_kprobes.tc registers kprobe events on the first 256 text symbols from /proc/kallsyms. If handle_break() is selected as a probe target on RISC-V, the breakpoint exception path can trap again before it reaches the kprobe breakpoint handler. That recursively enters do_trap_break() and can make the system unresponsive.
Mark handle_break() and its local probe dispatch helpers as nokprobe symbols so they are added to the kprobe blacklist, matching other low-level breakpoint exception paths.
---
LLM Generated explanations, may be completely bogus:
This is a 3-line RISC-V kprobe blacklist restore that prevents recursive breakpoint traps from hanging the machine. The local tree is **6.12.111** (pending-6.12); the buggy handle_break() path is present and the patch applies cleanly.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [riscv: kprobes] [Prevent] [Stop kprobes on RISC-V breakpoint exception handlers so a probe on that path cannot recurse]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Signed-off-by: Rui Qi \<[email protected]\> (author)
- Reviewed-by: Nam Cao \<[email protected]\>
- Link: https://patch.msgid.link/20260806043807.2583001-1-
[email protected]
- Signed-off-by: Paul Walmsley \<[email protected]\> (RISC-V maintainer)
- No Fixes: tag (expected)
- No Reported-by / Tested-by / Cc: stable
- No syzbot
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: multiple_kprobes.tc plants kprobes on the first 256 /proc/kallsyms text symbols. If handle_break() is one of them, the breakpoint exception path hits another ebreak before kprobe_breakpoint_handler() runs.
- Symptom: recursive do_trap_break() → system unresponsive (hang).
- Root cause: those C helpers are not on the kprobe blacklist.
- Fix: NOKPROBE_SYMBOL() on handle_break(), probe_breakpoint_handler(), and probe_single_step_handler().
- Version info: none in the message. The hang is RISC-V + kprobes, not a new-kernel-only issue.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. The subject says “Prevent” and the body describes a hang. This is an explicit bug fix.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: arch/riscv/kernel/traps.c only (+3 / −0)
- Functions: probe_single_step_handler, probe_breakpoint_handler, handle_break
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Before: all three are normal .text symbols. handle_break() is global, so it is always in kallsyms. A kprobe on it patches ebreak at the function entry.
- Path: ebreak → do_trap_break() (noinstr) → handle_break() → ebreak again → nested do_trap_break() → hang/stack blow-up. kprobe_breakpoint_handler() is never reached because the trap happens at the start of handle_break().
- After: the three symbols go in _kprobe_blacklist. register_kprobe() rejects them via within_kprobe_blacklist() (kernel/kprobes.c).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: [Logic / kprobe blacklist gap] [Breakpoint exception helpers were probeable; probing them recurses into the same handler.] Category is closest to a hang/deadlock-class failure, not UAF.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: NOKPROBE_SYMBOL() is the standard way to blacklist. x86 does the same with NOKPROBE_SYMBOL(do_int3). RISC-V already uses __kprobes on kprobe_breakpoint_handler() itself.
- Minimal: three annotation lines, no control-flow change.
- Regression risk: very low. Blacklisting only refuses probes on those symbols; normal breakpoint/BUG/kgdb handling is unchanged.
- linux/kprobes.h is already included in traps.c. With CONFIG_KPROBES=n, NOKPROBE_SYMBOL is a no-op.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- handle_break() created by f0bddf50586da (“riscv: entry: Convert to generic entry”, in v6.4-rc1). That commit **removed** NOKPROBE_SYMBOL(do_trap_break) when splitting do_trap_break() into a noinstr wrapper plus a C handle_break().
- Wrappers probe_*_handler() added by 9f564b92cf6d0 (“riscv: Only consider swbp/ss handlers for correct privileged mode”, in v6.6-rc6).
- Both are ancestors of this 6.12 tree.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. The dropped blacklist is from f0bddf50586da. Earlier, 2349a3b26e29b (“riscv: add do_page_fault and do_trap_break into the kprobes blacklist”, 2021) added NOKPROBE_SYMBOL(do_trap_break) with **Cc: stable** and Fixes:c22b0bcb1dd02 (“riscv: Add kprobes supported”). This patch restores that protection after the generic-entry split.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent traps.c churn (irq enable in exception handling, misaligned traps) does not retarget these three functions. Not part of a multi-patch series (standalone v1→v2 style-only). No extra prerequisite beyond code already in 6.12.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Rui Qi is not the RISC-V maintainer. One other RISC-V commit in this tree (8b76013038478, stacktrace). Reviewer Nam Cao has substantial RISC-V kprobes work. Maintainer Paul Walmsley queued the patch.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. Uses existing NOKPROBE_SYMBOL. Standalone. git apply --check of the three-line hunk on this tree succeeded (exit 0).
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c <msgid> failed: commit is not in this checkout (Cannot find a commit matching …).
- lore.kernel.org fetches returned HTTP 403.
- Recovered from LKML/patchew/openwall:
- v1: 2026-08-04, msgid
`[email protected]` - v2: 2026-08-06, msgid `[email protected]` (applied version)
- v2 changelog: drop blank line before NOKPROBE_SYMBOL(); add Nam Cao Reviewed-by. No technical redesign.
- Paul Walmsley: “Thanks, queued for v7.3.” No NAK.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: v1 CC included Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti, Thomas Gleixner, Nam Cao, linux-riscv, linux-kernel. Nam Cao Reviewed-by on v2. RISC-V maintainer applied it.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No bugzilla/syzbot link. Concrete trigger is in-tree:tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc (first 256 kallsyms text symbols). Author describes a hang; that matches the code path.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Single patch, not 2/N. No follow-up required from the v2 discussion.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search returned 403. No evidence this was rejected for stable. The 2021 predecessor (2349a3b26e29b) was explicitly Cc: stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: probe_single_step_handler, probe_breakpoint_handler, handle_break. Callers of handle_break() are only the two branches of do_trap_break().
**Step 5.2: TRACE CALLERS**
Record:
- Exception vector in arch/riscv/kernel/entry.S (RISCV_PTR do_trap_break)
- do_trap_break() (noinstr / __trap_section) already blacklisted via __noinstr_text_* in populate_kprobe_blacklist()
- do_trap_break() → handle_break() (not noinstr, not blacklisted today)
- handle_break() → probe helpers → kprobe_*_handler() (__kprobes, already blacklisted) or SIGTRAP/BUG/kgdb
Context: breakpoint exception, including kernel ebreak from kprobes.
**Step 5.3: TRACE CALLEES**
Record: user_mode(), uprobe_* / kprobe_* handlers, force_sig_fault, notify_die, report_bug, handle_cfi_failure, die(). No allocations or new locks in the patch (annotations only).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from userspace tracing when CONFIG_KPROBES is on:
write to kprobe_events or equivalent (typically CAP_SYS_ADMIN / CAP_PERFMON). Also reachable from the ftrace kprobe selftest. Not a default-defconfig path (CONFIG_KPROBES is optional, RISC-V defconfig does not set it), but distro/debug kernels enable it.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same pattern on x86 (NOKPROBE_SYMBOL(do_int3)), s390, powerpc, loongarch kprobe handlers. RISC-V kprobe_breakpoint_handler already uses __kprobes. The missing piece is the C trampoline handle_break(), which is what generic-entry introduced.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. arch/riscv/kernel/traps.c lines 269–305 define the three functions with no NOKPROBE_SYMBOL. HAVE_KPROBES is selected for RISC-V when !XIP_KERNEL. Bug introduced when NOKPROBE_SYMBOL(do_trap_break) was dropped in v6.4 (f0bddf50586da); wrappers present since v6.6. Present throughout 6.12.y.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Clean apply. Local do_trap_break() has extra local_irq_enable/disable from 32b14e757404c, below the insertion points, so it does not conflict. git apply --check succeeded.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No NOKPROBE_SYMBOL in traps.c now. do_trap_break is still noinstr-blacklisted, which is not enough because it calls out to handle_break().
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: [arch/riscv kprobes/traps] [IMPORTANT for RISC-V tracing; PERIPHERAL relative to all architectures]. Not core mm/scheduler, but a hang in the arch breakpoint path.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: RISC-V traps/kprobes are mature in 6.12 (kprobes since 5.13). This is a long-standing hole, not a brand-new feature bug.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: RISC-V kernels with CONFIG_KPROBES (and not XIP). Tracing users, ftrace kprobe selftests, distro kernels that enable kprobes. Not every 6.12 user.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Plant a kprobe on handle_break (or the static helpers if they have kallsyms entries), then any kernel/user breakpoint that enters handle_break(). The selftest can do that if handle_break is among the first 256 text symbols (address-order, so platform-dependent). Explicit perf probe / kprobe_events on that symbol is a reliable trigger. Needs tracing privilege, not an unprivileged local DoS on typical configs.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: [Recursive breakpoint exception → hang / unresponsive system] [CRITICAL for those who hit it]. Not data corruption. Not an unprivileged security bug on typical kprobe policy.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: HIGH for RISC-V kprobe users (prevents hang; restores blacklist that stable already shipped once).
- Risk: VERY LOW (3 annotation lines, no runtime logic change).
- Ratio: strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real hang: recursive ebreak in the breakpoint path.
- In-tree selftest is a plausible trigger; any probe on handle_break is a hard trigger.
- Restores protection that 2349a3b26e29b put on do_trap_break (Cc:
stable) and that f0bddf50586da dropped.
- Matches other architectures’ nokprobe on low-level BP handlers.
- 3 lines, obviously correct, reviewed by Nam Cao, queued by Paul Walmsley.
- Buggy code is in this 6.12 tree; patch applies cleanly.
AGAINST:
- Not on by default in RISC-V defconfig (CONFIG_KPROBES optional).
- Needs privileged tracing to trigger.
- No Fixes:/Cc: stable on this commit (not a negative per the review rules).
- Arch-specific, so only RISC-V 6.12 users benefit.
UNRESOLVED:
- Exact Nam Cao review email body (lore 403). v2 only changed whitespace and added Reviewed-by.
- Whether handle_break is in the first 256 kallsyms on a typical 6.12 RISC-V vmlinux (unverified; hang if probed is verified from code regardless).
- b4 dig could not run against a SHA not in this checkout.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — standard NOKPROBE_SYMBOL; maintainer queued; reviewer Ack.
2. Fixes a real bug that affects users? **PASS** — hang when kprobes lands on handle_break.
3. Important issue (crash, security, corruption, deadlock)? **PASS** — system hang / unresponsive.
4. Small and contained? **PASS** — +3 lines, one file.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — git apply --check clean on 6.12.111.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. It is a normal hang fix.
**Step 9.4: MAKE YOUR DECISION**
This belongs on 6.12.y. It restores a kprobe blacklist that this tree lost in the generic-entry split, with essentially no behavioral change except refusing probes that can wedge the machine.
Detailed explanation:
The problem is that RISC-V kprobes implement software breakpoints with ebreak. do_trap_break() is noinstr (already blacklisted), but it immediately calls handle_break(), which is ordinary C text. If a kprobe is installed on handle_break(), the first instruction is ebreak, so the exception path traps again before kprobe_breakpoint_handler() can run. That recurses until the system stops responding. Marking the three symbols NOKPROBE_SYMBOL puts them on the same blacklist register_kprobe() already consults. Stable users who enable kprobes (tracing, selftests, distro debug kernels) are the ones who hit this; the cost of the backport is three annotations.
Verification:
- [Phase 1] Parsed tags: Reviewed-by Nam Cao; Link msgid 20260806043807.2583001-1; Paul Walmsley SOB; no Fixes/syzbot
- [Phase 2] Diff: +3 NOKPROBE_SYMBOL lines in arch/riscv/kernel/traps.c; no control-flow change
- [Phase 2] Confirmed traps.c already #include <linux/kprobes.h>
- [Phase 2] Confirmed register_kprobe() rejects within_kprobe_blacklist() addresses (kernel/kprobes.c ~1593)
- [Phase 2] Confirmed NOKPROBE_SYMBOL writes _kprobe_blacklist (include/asm-generic/kprobes.h)
- [Phase 3] git describe HEAD / make kernelversion:
p-6.12-3-gc504cf0baa3d8, 6.12.111
- [Phase 3] blame: handle_break from f0bddf50586da (v6.4-rc1); wrappers from 9f564b92cf6d0 (v6.6-rc6)
- [Phase 3] git show f0bddf50586da: removed NOKPROBE_SYMBOL(do_trap_break) while splitting the function
- [Phase 3] 2349a3b26e29b originally blacklisted do_trap_break with
Cc: stable
- [Phase 3] git merge-base --is-ancestor both introducing commits are in HEAD
- [Phase 4] b4 dig: no matching commit in this tree (UNVERIFIED via b4)
- [Phase 4] v1/v2 recovered from lkml.iu.edu / openwall / patchew; v2 is style-only + Reviewed-by
- [Phase 4] Paul Walmsley: queued for v7.3 (patchew)
- [Phase 4] lore.kernel.org and stable@ search: HTTP 403 (UNVERIFIED via lore)
- [Phase 4] Nam Cao review body: UNVERIFIED (openwall msg id collision); Reviewed-by on v2 is verified
- [Phase 5] Callers: entry.S → do_trap_break → handle_break; do_trap_break is __trap_section/noinstr
- [Phase 5] kprobe_breakpoint_handler already __kprobes in arch/riscv/kernel/probes/kprobes.c
- [Phase 5] Selftest multiple_kprobes.tc confirmed to take first 256 kallsyms text symbols
- [Phase 5] x86 comparison: NOKPROBE_SYMBOL(do_int3) in arch/x86/kernel/traps.c:826
- [Phase 6] Current traps.c has no NOKPROBE_SYMBOL; buggy helpers present at lines 269–305
- [Phase 6] git apply --check of the three-line hunk: exit 0
- [Phase 7] arch/riscv/Kconfig: select HAVE_KPROBES if !XIP_KERNEL
- [Phase 8] RISC-V defconfig does not set CONFIG_KPROBES (trigger is config-specific)
- UNVERIFIED: whether handle_break is in the first 256 kallsyms on a typical 6.12 RISC-V build (does not change the hang if that symbol is probed)
**YES**
arch/riscv/kernel/traps.c | 3 +++ 1 file changed, 3 insertions(+)
arch/riscv/kernel/traps.c +3 -0
@@ -272,6 +272,7 @@ static bool probe_single_step_handler(struct pt_regs *regs)return user ?uprobe_single_step_handler (regs) :kprobe_single_step_handler (regs); } +NOKPROBE_SYMBOL (probe_single_step_handler);static bool probe_breakpoint_handler (struct pt_regs *regs) {
@@ -279,6 +280,7 @@ static bool probe_breakpoint_handler(struct pt_regs *regs)return user ?uprobe_breakpoint_handler (regs) :kprobe_breakpoint_handler (regs); } +NOKPROBE_SYMBOL (probe_breakpoint_handler);void handle_break (struct pt_regs *regs) {
@@ -303,6 +305,7 @@ void handle_break(struct pt_regs *regs)else die (regs,"Kernel BUG" ); } +NOKPROBE_SYMBOL (handle_break); asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 mmc: block: reject invalid perdev_minors before division
In reply to Sasha LevinFrom: Xu Rao <[email protected]>
[ Upstream commit 5253aee00a4383cb0482d5e99bde48b8054ae2c0 ]
The mmcblk.perdev_minors module parameter is parsed as a signed int and is used during mmc_blk_init() to compute the number of supported block devices.
Passing perdev_minors=0 makes the init path divide by zero when it computes max_devices. Negative values are invalid as well and would make max_devices negative before it is later used as an IDA limit.
Reject non-positive perdev_minors values before registering any mmcblk resources.
---
LLM Generated explanations, may be completely bogus:
I have the bug mechanism, history, and review thread. Compiling the nine-phase verdict for this 7.3-rc4 tree.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Record: **[mmc/block] [reject] reject invalid perdev_minors before division**
- Subsystem: mmc: block:. Verb: **reject** (guard / prevent invalid input). Intent: do not use a non-positive module parameter as a divisor.
**Step 1.2: Tags**
- Record:
- Signed-off-by: Xu Rao <[email protected]> (author)
- `Signed-off-by: Ulf Hansson <[email protected]>` (MMC maintainer; committed 2026-07-10) - **No** `Fixes:`, `Reported-by:`, `Tested-by:`, `Reviewed-by:`, `Acked-by:`, `Link:`, or `Cc: [email protected]`
- Absence of Fixes: / Cc: stable is expected for this review and is not a negative signal
- SHA in this tree: 5253aee00a4383cb0482d5e99bde48b8054ae2c0
**Step 1.3: Body**
- Record:
- **Bug:** mmcblk.perdev_minors is a signed int module parameter.
`mmc_blk_init()` computes `max_devices` as `(1 << MINORBITS) /
perdev_minors`. - **Symptoms:** perdev_minors=0 → divide-by-zero in init. Negative values → negative max_devices, later used as an IDA upper bound.
- **Version info:** none in the message.
- **Root cause:** no validation before division / IDA use. Fix: reject <= 0 before registering any mmcblk resources.
**Step 1.4: Hidden bug fix?**
- Record: **No disguise.** This is an explicit crash/UB fix, not cleanup-as-fix.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- Record:
- File: drivers/mmc/core/block.c — **+5 / −0**
- Function: mmc_blk_init()
- Scope: **single-file surgical fix**
**Step 2.2: Code flow**
- Record: **Before:** mmc_blk_init() registers the RPMB bus and chrdev region, then does max_devices = min(MAX_DEVICES, (1 << MINORBITS) / perdev_minors) with no check. **After:** if perdev_minors <= 0, log and return -EINVAL **before** any of those registrations (no leak on the new error path).
Verified parent of the fix (no check):
``` max_devices = min(MAX_DEVICES, (1 << MINORBITS) / perdev_minors); ```
**Step 2.3: Bug mechanism**
- Record: **Logic / correctness + memory-safety (div-by-zero, invalid IDA limit)**
- perdev_minors == 0: integer division by zero in mmc_blk_init() (oops / exception on init).
- perdev_minors < 0: signed division yields a negative max_devices; ida_alloc_max(..., max_devices - 1, ...) takes unsigned int max, so the negative value **wraps** to a huge limit (include/linux/idr.h). Probe then uses devidx * perdev_minors for first_minor.
- Same divisor is also used in mmc_get_devidx() (`disk->first_minor
/ perdev_minors`).
**Step 2.4: Fix quality**
- Record: **Obviously correct and minimal.** Matches Kconfig (MMC_BLOCK_MINORS range 4–256). Valid defaults (8) unchanged. Regression risk **very low**: only rejects values that already crash or mis-size the IDA. Early return happens before bus_register, so no new leak.
## Phase 3: Git history
**Step 3.1: Blame**
- Record:
- perdev_minors module param: 5e71b7a64cb4c (“mmc: make number of mmcblk minors configurable”, Olof Johansson, 2010) — **v2.6.37-rc1**.
- Division (1 << MINORBITS) / perdev_minors: a26eba614afff0 (“mmc:
block: Increase max_devices”, Ben Hutchings, 2014) — **v3.19-rc1**.
- Bug is over a decade old in this lineage, not new 7.x code.
**Step 3.2: Fixes: tag**
- Record: **No Fixes: tag.** Introducing commits above are in this tree (ancient ancestors of HEAD).
**Step 3.3: File history**
- Record: Recent block.c work is unrelated (RPMB unregister, MQ retry). git log --grep=perdev_minors -- drivers/mmc/ shows only this fix plus old param/prefix commits. **Standalone, not a series.** No follow-ups on block.c after 5253aee.
**Step 3.4: Author**
- Record: Xu Rao has one other recent MMC commit (mmc: spi: reset bytes_xfered...). Not the subsystem maintainer. **Ulf Hansson** (MMC maintainer) applied it.
**Step 3.5: Dependencies**
- Record: **None.** The check uses existing perdev_minors and pr_err. Applies on its own.
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**
- Record: b4 dig -c 5253aee00a438 matched patch-id 291b9622c960b2f250c74c590d7e9916013372a3.
- Lore/msgid: `https://patch.msgid.link/C7A17066496D0ABA+2026070609250
[email protected]`
- **v1 only** (b4 dig -a); committed version is that v1.
- Ulf Hansson (10 Jul 2026): **“Applied for next, thanks!”** — no NAK, no requested respin.
- Direct lore.kernel.org fetch returned **403**; thread confirmed via b4 + LKML/openwall mirrors.
**Step 4.2: Recipients (b4 dig -w)**
- Record: [email protected], [email protected], Avri Altman, Bean Huo, Shawn Lin, Jens Wiklander, **Kees Cook**, plus others. Maintainer was To: and merged the patch. No reviewer Reviewed-by in git.
**Step 4.3: Bug report**
- Record: **No Reported-by / syzbot / bugzilla.** Author describes the mechanism; no public crash log found.
**Step 4.4: Series**
- Record: **Standalone single patch**, not N/M.
**Step 4.5: Stable list**
- Record: Web search of lore.kernel.org/stable for perdev_minors did **not** turn up a nomination or a rejection of this patch. Direct lore fetch was 403. **UNVERIFIED** that nobody ever asked stable@; no evidence of a known NAK for stable either.
## Phase 5: Semantic / call graph
**Step 5.1: Functions**
- Record: **mmc_blk_init only** (plus it protects later use of perdev_minors in mmc_get_devidx, mmc_blk_alloc_req, mmc_blk_alloc_rpmb_part).
**Step 5.2: Callers**
- Record: module_init(mmc_blk_init) only — boot (builtin, CONFIG_MMC_BLOCK=y default) or modprobe mmcblk. Not a hot path, not IRQ, not a syscall except via privileged module load / kernel cmdline.
**Step 5.3: Callees**
- Record: After the new check: bus_register, alloc_chrdev_region, register_blkdev, mmc_register_driver. The new path calls none of these.
**Step 5.4: Reachability**
- Record: **Yes, from admin/boot configuration.** module_param(perdev_minors, int, 0444) — set at load (mmcblk.perdev_minors=0) or on the kernel command line if builtin. **Not** writable later (0444). **Unprivileged users cannot set it** on a normal system. Kconfig range 4 256 cannot produce 0; only the module/boot param can.
**Step 5.5: Similar patterns**
- Record: perdev_minors exists only in this file. No sibling mmc driver with the same hole. Pattern is the usual “signed module_param used as divisor without a positivity check.”
## Phase 6: This checkout
**Step 6.1: Buggy code in this tree?**
- Record:
- git describe HEAD → **v7.3-rc4-27-gf0100363d8c37**
- make kernelversion → **7.3.0-rc4**
- The mmc block driver and the division **are present**. The **unfixed** sequence is the parent of 5253aee; **HEAD already contains the fix** (git merge-base --is-ancestor 5253aee00a438 HEAD → yes).
- Commit first landed via MMC for **v7.3** (git describe 5253aee → v7.2-rc2-25-g5253aee00a438; **not** an ancestor of v7.2). Bug **introduction** is v3.19-era, long before this branch.
- Being an ancestor of this mainline/rc HEAD is expected for a candidate; it is not “already selected for stable.”
**Step 6.2: Backport difficulty**
- Record: **Clean apply on this tree** (hunk matches mmc_blk_init exactly). No extra helpers required.
**Step 6.3: Related fixes already here**
- Record: This **is** the fix. No alternate/earlier validation of perdev_minors. No follow-up revert.
## Phase 7: Subsystem context
**Step 7.1:**
- Record: **drivers/mmc/core (MMC block)** — **IMPORTANT** (eMMC/SD block devices; CONFIG_MMC_BLOCK defaults to y). Not core mm/VFS, not staging.
**Step 7.2:**
- Record: File is actively maintained (RPMB, MQ recovery, etc.). The **bug site** (max_devices = … / perdev_minors) has been stable since 2014.
## Phase 8: Impact and risk
**Step 8.1: Who is affected**
- Record: Users of mmcblk who pass **mmcblk.perdev_minors=0 or a negative value** (cmdline or modprobe). Default Kconfig path is fine. Population: **config/admin-specific**, not universal.
**Step 8.2: Trigger**
- Record: One-shot at mmc_blk_init. **Not** timing-dependent. **Not** triggerable by an unprivileged syscall on a typical system.
Commonness: **low** (must override a param whose Kconfig range is already 4–256).
**Step 8.3: Failure mode**
- Record:
- = 0: divide-by-zero → **oops / exception during MMC block init**. Builtin + panic_on_oops → boot failure; otherwise mmcblk fails and eMMC/SD never appear (root-on-eMMC can fail to boot).
- < 0: negative max_devices → **unsigned wrap in ida_alloc_max**, wrong minors, possible further corruption of device numbering.
- Severity: **HIGH** if triggered (crash / failed storage), **MEDIUM overall** because the trigger is an invalid privileged parameter.
**Step 8.4: Risk–benefit**
- Record: **Benefit: high for a tiny hardening/crash fix** (prevents init oops; clean -EINVAL). **Risk: very low** (5 lines, error path only, no API/lock/struct change). Ratio: **favorable**.
## Phase 9: Synthesis
**Step 9.1: Evidence**
**For backporting**
- Real divide-by-zero in mmc_blk_init when perdev_minors=0.
- Negative values produce a negative max_devices and wrap in ida_alloc_max().
- 5-line, obviously correct check before any resource registration.
- Bug in code since ~v3.19; param since v2.6.37; MMC block present in this 7.3-rc4 tree.
- No dependencies; standalone; maintainer applied it with no objections.
- CONFIG_MMC_BLOCK is default y — driver is widely built.
**Against**
- No Reported-by / syzbot; no evidence of production hits.
- Trigger is privileged (boot arg / modprobe), param is 0444.
- No Reviewed-by; v1 merged as-is.
- Not a hot-path race or unprivileged UAF.
**Unresolved**
- lore.kernel.org HTTP 403; used b4 + LKML mirrors.
- No hit on stable@ for this subject (search quality limited).
**Step 9.2: Stable rules**
1. Obviously correct and tested? **PASS** — trivial positivity check; maintainer merged to MMC next. No extra Tested-by, but the change is reviewable by inspection.
2. Fixes a real bug that affects users? **PASS** — div-by-zero / invalid IDA limit if the param is set wrong.
3. Important (crash/security/corruption/deadlock)? **PASS** — kernel oops on init; storage devices never register. Not unprivileged security.
4. Small and contained? **PASS** — +5 lines, one function.
5. No new features/APIs? **PASS**.
6. Can apply to this tree? **PASS** — same file/function; no missing prereqs.
**Step 9.3: Exception category**
- Record: **None** (not a device ID/quirk/DT/docs-only change). It is a normal small bugfix.
**Step 9.4: Decision**
This tree is **7.3.0-rc4**. The MMC block driver and the unvalidated division exist here; the patch is self-contained and matches local mmc_blk_init(). A 5-line reject of non-positive perdev_minors prevents a real init-time divide-by-zero and a broken IDA limit, with negligible regression risk. That meets stable-kernel-rules for this checkout.
### Why it matters here
Invalid mmcblk.perdev_minors is enough to oops while bringing up mmcblk (or to wrap the IDA max). On systems with builtin mmcblk (the default), that is boot-time. The fix fails init with -EINVAL instead.
### Risk vs benefit
Benefit is avoiding a crash/failed MMC probe; risk is a check that does not run for any Kconfig-legal default.
### Concerns
No in-the-wild report; trigger needs a bad privileged param. That lowers urgency but does not make the patch unsafe or feature-like. No backport rework needed on this tree.
---
**Verification:**
- [Phase 1] Parsed message/tags: author + Ulf SOB only; no Fixes/Reported-by/Cc stable. SHA 5253aee00a438.
- [Phase 2] Diff: +5 in mmc_blk_init(); git show 5253aee^:drivers/mmc/core/block.c confirmed unvalidated (1 << MINORBITS) / perdev_minors.
- [Phase 2] ida_alloc_max() in include/linux/idr.h takes unsigned int max — negative max_devices - 1 wraps (verified).
- [Phase 2] MINORBITS is 20 in include/linux/kdev_t.h (verified).
- [Phase 2] Kconfig MMC_BLOCK_MINORS range 4 256, default 8; CONFIG_MMC_BLOCK default y (verified).
- [Phase 3] git blame: param 5e71b7a64cb4c (v2.6.37-rc1); division a26eba614afff0 (v3.19-rc1).
- [Phase 3] git log --grep=perdev_minors -- drivers/mmc/: this commit
+ old param commits only; no series/follow-up.
- [Phase 3] git log --author='Xu Rao' -- drivers/mmc/: this + one unrelated spi fix.
- [Phase 4] b4 dig -c 5253aee00a438: msgid [email protected]; v1 only; Ulf CC’d.
- [Phase 4] LKML: Ulf “Applied for next, thanks!” — no NAK.
- [Phase 4] lore.kernel.org WebFetch: **403**. Stable@ search: **no relevant thread found**.
- [Phase 5] mmc_blk_init only via module_init; module_param(..., 0444) — admin/boot only (verified in block.c).
- [Phase 5] Call sites of perdev_minors: init division, mmc_get_devidx, md->disk->minors / first_minor (grep verified).
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4.
- [Phase 6] git merge-base --is-ancestor 5253aee00a438 HEAD = yes; git merge-base --is-ancestor 5253aee00a438 v7.2 = not in v7.2.
- [Phase 6] HEAD already has the if (perdev_minors <= 0) block at block.c:3340 (this is the mainline commit under review, not a stable-queue marker).
- [Phase 8] Failure mode: div-by-zero oops at mmcblk init, or IDA limit wrap for negatives.
- UNVERIFIED: full lore.kernel.org thread HTML (403); whether stable@ ever discussed this hash.
**YES**
drivers/mmc/core/block.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/core/block.c +5 -0
@@ -3407,6 +3407,11 @@ static int __init mmc_blk_init(void) {int res; +if (perdev_minors <=0 ) { +pr_err ("mmcblk: invalid minors per device: %d\n" , perdev_minors); +return -EINVAL ; + } + res =bus_register (&mmc_rpmb_bus_type);if (res <0 ) {pr_err ("mmcblk: could not register RPMB bus type\n" );
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 soundwire: dmi-quirks: Disable ghost Realtek on Asus Zenbook Duo
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit ca02ffd4975ca5249abf0cfb750a495d23b453ee ]
The Asus Zenbook Duo also has a Realtek device in the ACPI that doesn't exist in the physical hardware. This confuses the machine driver into attempting to create DAI links for the device. Add a quirk to remove this device.
---
LLM Generated explanations, may be completely bogus:
This is a DMI hardware quirk for this 6.12 tree. The ghost_realtek remap table is already here; the commit only adds board UX8407AA.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[soundwire / dmi-quirks] [Disable] Disable ghost Realtek on Asus Zenbook Duo.** “Disable” is a bug-fix verb: stop enumerating a non- existent ACPI codec.
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Charles Keepax (author)
- Reviewed-by: Pierre-Louis Bossart (SoundWire/Intel audio)
- Link: https://patch.msgid.link/20260720095741.3592825-1-
[email protected]
- Signed-off-by: Vinod Koul (SoundWire maintainer; applied as ca02ffd4975c)
- No Fixes:, Reported-by:, Tested-by:, Cc: stable (absence expected)
- Ignore pipeline SOBs/Upstream markers
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: Asus Zenbook Duo ACPI lists a Realtek SoundWire device that is not on the board.
- Symptom: machine driver tries to create DAI links for that ghost codec → wrong/broken sound card.
- Root cause: firmware _ADR for a phantom RT722 (same class as UX5406AA / Lenovo entries already in this tree).
- No stack trace; hardware/firmware description.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a disguised cleanup. It is an explicit hardware quirk.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/soundwire/dmi-quirks.c (+7 / −0)
- Function/data: adr_remap_quirk_table[] only
- Scope: single-file surgical DMI entry
- New match: DMI_SYS_VENDOR "ASUS" + DMI_BOARD_NAME "UX8407AA" → existing ghost_realtek
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record: Before, UX8407AA was not in the table, so ACPI _ADR 0x000330025d072201 (RT722 on link3) was used as-is. After, that _ADR is remapped to 0, so find_slave() skips the device.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: **Hardware workaround (DMI quirk).** Same ghost_realtek map already in tree:
```97:104:drivers/soundwire/dmi-quirks.c
static const struct adr_remap ghost_realtek[] = {
/* rt722 on link3 */
{
0x000330025d072201ull,
0x0000000000000000ull
},
{}
};
```sdw_dmi_override_adr() applies that map. find_slave() then drops a zero address:
```109:113:drivers/soundwire/slave.c
if (bus->ops->override_adr)
addr = bus->ops->override_adr(bus, addr);
if (!addr)
return false;
```Intel ops already wire this (override_adr = sdw_dmi_override_adr in intel_auxdevice.c). intel_init.c builds ctx->ids from registered slaves, so SOF machine select in hda_sdw_machine_select() never sees the ghost.
Step 2.4: ASSESS THE FIX QUALITY
Record: Copy of existing ASUS/Lenovo rows; DMI-gated; no API/locking/hot-path change. Regression risk is limited to mis-matched board strings on UX8407AA only.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record: PTL ghost_realtek rows come from 30e7fb61a64ba (“Disable ghost Realtek devices”), backport of upstream 4dab2b904414 (Charles Keepax, 2026-05-20). Already in this tree. UX8407AA is not.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Introduced bug is firmware, not a kernel commit.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent dmi-quirks.c history is quirk additions. Sibling IDs already here: UX5406AA, Lenovo 83QK, 83SF. Upstream context also has B9406CAA; that ID is **not** in this tree and is **not** required for UX8407AA.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Charles Keepax is a regular SoundWire/ASoC contributor (Cirrus). Same author added the original ghost_realtek table. Reviewed by Pierre-Louis Bossart; applied by Vinod Koul.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: Needs ghost_realtek + sdw_dmi_override_adr + Intel override_adr. All present (30e7fb61a64ba). Standalone; not patch x/y. Original May 2026 series (ptl-match Chrome matches, then ghost_realtek) is independent of this July follow-up.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c ca02ffd4975c → https://patch.msgid.link/20260720095741.359
[email protected]
- b4 dig -a: single v1, no later revision
- Pierre-Louis Bossart: Reviewed-by; noted this will keep happening as more BIOS bugs ship; not a NAK
- Vinod Koul: Applied, thanks
- No NAKs, no Cc: stable in review (not a negative)
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: To Vinod Koul; Cc Yung-Chuan Liao, Pierre-Louis Bossart, linux- sound, linux-kernel, Cirrus patches. Appropriate maintainers.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No syzbot/bugzilla. Author report of shipping ACPI. Same firmware class as quirks already in 6.12. Related AUTOSEL for 6.12:platform/x86: asus-nb-wmi: add DMI quirk for ASUS Zenbook Duo UX8407AA — this SKU is already treated as 6.12-relevant.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Standalone 1/1. Follow-up to 4dab2b904414 / 30e7fb61a64ba, already here.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: **UNVERIFIED** — lore.kernel.org/stable returned 403. No evidence this was rejected for stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: No function body change. Data: adr_remap_quirk_table.
Consumer: sdw_dmi_override_adr().
Step 5.2: TRACE CALLERS
Record:
- sdw_dmi_override_adr ← Intel sdw_intel_ops.override_adr
- find_slave() during ACPI slave walk
- Boot/probe only, Intel SoundWire platforms with matching DMI
Step 5.3: TRACE CALLEES
Record: dmi_first_match(), remap loop, dev_dbg(). No alloc/locks.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Reachable at SoundWire probe on UX8407AA. Not a syscall UAF; broken audio on that laptop. hda_sdw_machine_select() uses hdev->sdw->ids from registered slaves, so skipping the ghost changes machine matching and DAI-link construction.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Same pattern already used for UX5406AA and two Lenovo SKUs. This extends that list.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record:
- Tree: **pending-6.12**, make kernelversion = **6.12.111** (p-6.12-2-gd38d58a4e0359)
- drivers/soundwire/dmi-quirks.c present; ghost_realtek present; UX8407AA **absent**
- PTL SOF support present (pci-ptl.c, soc-acpi-intel-ptl-match.c with RT722 link0/link3)
- Mechanism that makes a zero _ADR drop the slave is present
- Candidate ca02ffd4975c is **not** an ancestor of HEAD (expected)
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Lore hunk (insert before first LENOVO ghost_realtek row) **git apply --check clean**. Full upstream context mentioning B9406CAA is not required. Difficulty: **clean apply**.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: Generic ghost-Realtek table yes; this board ID no. No substitute UX8407AA SoundWire quirk.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: **soundwire DMI quirks** (Intel laptop audio). **IMPORTANT** for those machines; DMI-gated so not CORE-wide.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Mature quirk table (since ~2021) with ongoing DMI additions. This is the usual enablement pattern, not a new subsystem.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Driver/platform-specific**: ASUS board UX8407AA (Zenbook Duo). Everyone else unchanged.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Every boot/probe on that DMI. No race. Unprivileged users get broken audio; they cannot trigger it on other machines.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: Wrong DAI links / wrong SOF machine (e.g. matching ptl_rt722_l3 on a ghost RT722) or probe of a codec that is not there. **HIGH** for that SKU (no/wrong audio), not a panic.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: audio enumeration correct on a shipping PTL laptop; same class as quirks already in 6.12
- Risk: very low (7 lines, DMI-gated, existing table)
- Ratio: strongly favors backport
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Hardware quirk / DMI ID on an existing driver — stable exception
- Real firmware bug: ghost Realtek in ACPI
- User-visible: machine driver builds DAI links for hardware that does not exist
- +7 lines, copy of existing entries
- ghost_realtek + Intel override path already in 6.12.111
- Applies cleanly
- Reviewed by Bossart, applied by Koul
- Same author/table as UX5406AA already in this tree
- PTL SoundWire/SOF present
- Zero blast radius off that DMI match
AGAINST:
- One laptop SKU
- No Reported-by/syzbot (normal for DMI quirks)
- PTL match table in 6.12 is still mostly RT711/RT722 (function-topology DAI building is stronger on later/ARL paths); the skip still prevents ghost-slave probe and false ptl_rt722_l3 match
- lore.kernel.org/stable search 403
UNRESOLVED:
- Exact UX8407AA DMI strings not independently dumped
- Stable-list discussion not fetched (HTTP 403)
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — identical to existing rows; maintainer Reviewed-by/applied
2. Fixes a real bug that affects users? **PASS** — ghost ACPI codec breaks card/DAI setup
3. Important issue? **PASS** — broken audio on a shipping laptop (HIGH for that SKU)
4. Small and contained? **PASS** — 7 lines, one table
5. No new features or APIs? **PASS** — DMI quirk only
6. Can apply to the local tree? **PASS** — lore hunk applies; prerequisites present
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Hardware quirk / DMI workaround** on an existing SoundWire quirk table.
Step 9.4: MAKE YOUR DECISION
This belongs on 6.12.y. The bug exists here, the fix is the established DMI pattern, and it does not depend on B9406CAA or later function- topology work.
------------------------------------------------
What problem it solves for this tree
------------------------------------------------
Asus Zenbook Duo UX8407AA ships ACPI for a Realtek RT722 on SoundWire link3 that is not physically present. Without the quirk, Intel SoundWire registers that slave, SOF machine select can treat it as real, and sof_sdw can create DAI links for it. Remapping that _ADR to 0 drops the ghost device. The remap table and call path are already in 6.12.111; this only names the board.
Risk vs benefit
------------------------------------------------
Benefit is working (or at least not mis-probed) audio on that SKU. Risk is a DMI-only table row. No new APIs, no locking, no cross-subsystem change.
Concerns
------------------------------------------------
None that block backport. B9406CAA in some upstream context is a different board and is not a prerequisite. Apply is clean with the lore hunk.
Verification:
- [Phase 1] Parsed subject/tags from the provided message; no Fixes/syzbot; Reviewed-by Bossart; Link msgid 20260720095741.3592825-1
- [Phase 2] Diff is +7 lines in adr_remap_quirk_table; ghost_realtek maps RT722 link3 _ADR to 0
- [Phase 2] Confirmed find_slave() returns false on !addr; Intel ops set override_adr
- [Phase 3] git blame PTL block → 30e7fb61a64ba (backport of 4dab2b904414); UX8407AA not present
- [Phase 3] git merge-base --is-ancestor 30e7fb61a64ba HEAD → yes; ca02ffd4975c → no
- [Phase 3] Author history in drivers/soundwire/ includes the original ghost-Realtek quirk
- [Phase 4] b4 dig -c ca02ffd4975c → lore msgid; -a v1 only; -w Vinod/Bossart/linux-sound
- [Phase 4] Patchew/openwall: Bossart Reviewed-by; Vinod applied ca02ffd4975c
- [Phase 4] WebSearch: related 6.12 AUTOSEL asus-nb-wmi quirk for UX8407AA
- [Phase 5] Callers: sdw_dmi_override_adr ← find_slave ← Intel probe; ctx->ids from registered slaves
- [Phase 6] git describe HEAD p-6.12-2; make kernelversion 6.12.111; PTL SOF files present
- [Phase 6] git apply --check of lore hunk: clean
- [Phase 8] Failure mode: wrong DAI links / ghost codec probe; DMI-gated
- UNVERIFIED: lore.kernel.org/stable search (403); live DMI dump of UX8407AA
The patch is a small, existing-pattern DMI quirk; prerequisites are in this tree and it applies cleanly.
**YES**
drivers/soundwire/dmi-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/soundwire/dmi-quirks.c +7 -0
@@ -200,6 +200,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)ghost_realtek, }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUS" ), + DMI_MATCH(DMI_BOARD_NAME, "UX8407AA"), + }, + .driver_data = (void *)ghost_realtek, + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amd/pm: Validate Vega10 PPTable subtable bounds
In reply to Sasha LevinFrom: Yang Wang <[email protected]>
[ Upstream commit 9914149f99fd2ddcfd2a8c1053a57d96ec43448e ]
v1:
Vega10 PPTable parsing uses VBIOS-provided offsets, revision fields and entry counts to locate subtables. Malformed data can otherwise drive out-of-bounds reads from soft_pp_table_size, and voltage lookup tables can overrun their fixed-size destination arrays.
Add shared bounds helpers and validate fixed-size subtables, dynamic entry arrays and revision-specific layouts before consuming thermal, fan, power-tune, clock dependency, PCIE, hard-limit and voltage lookup data.
v2:
if ucRevId is not matched, fallback to default table size instead of returning -EINVAL.
---
LLM Generated explanations, may be completely bogus:
This is a memory-safety fix for Vega10 PowerPlay table parsing in **6.18.53**. The buggy offset/ucNumEntries handling is in this tree and is reachable at probe and via the pp_table sysfs write path.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[drm/amd/pm] [Validate] [reject malformed Vega10 PPTable subtables before parsing]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Signed-off-by: Yang Wang \<[email protected]\> (author)
- Reviewed-by: Asad Kamal \<[email protected]\>
- Reviewed-by: Kenneth Feng \<[email protected]\>
- Signed-off-by: Alex Deucher \<[email protected]\> (amdgpu maintainer)
- No Fixes:, Reported-by:, Tested-by:, Link:, or Cc: stable (absence expected)
- Pipeline markers ignored: [Upstream commit 9914149f99fd...], Sasha Levin SOB
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** Vega10 PPTable parsers trust VBIOS offsets, ucRevId, and ucNumEntries without checking they fit in soft_pp_table_size. Voltage lookup copies ucNumEntries into arrays allocated with a fixed max_levels.
- **Symptom:** out-of-bounds reads of the PPTable buffer; destination- array overrun on voltage lookup.
- **Version info:** none in the message. Code dates to Vega10 powerplay (2017).
- **Root cause:** pointer = powerplay_table + le16_to_cpu(offset) with no size check; lookup loop bound is ucNumEntries while allocation uses max_levels (8 or 4).
- **v2:** unknown ucRevId falls back to a default table size instead of -EINVAL (fan / power-tune), to avoid rejecting real tables.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. Explicit bounds validation for OOB read and array overrun.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File:
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c (+459 / −105, 564 lines touched)
- New helpers: vega10_pp_table_has_space, get_vega10_subtable, validate_vega10_table_entries, plus per-subtable getters (gfxclk, clk, mclk, mm, pcie, hard-limit, thermal, fan, power-tune, voltage lookup)
- Callers updated: init_thermal_controller, init_over_drive_limits, init_powerplay_extended_tables, init_dpm_2_parameters
- Scope: single-file, systematic validation of existing parsers (not a cross-subsystem refactor)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** init_* computed subtable pointers as (unsigned long)powerplay_table + le16_to_cpu(offset) and passed them straight into parsers.
- **After:** helpers require non-zero offset, header-in-bounds, ucNumEntries != 0 (PCIE allows 0), and offset + header + N*entry_size <= soft_pp_table_size. Voltage lookup also requires ucNumEntries <= max_levels.
- **Paths:** probe-time vega10_pp_tables_initialize and pp_dpm_set_pp_table → amd_powerplay_reset → hwmgr_hw_init → pptable_init. Error paths return -1/-EINVAL instead of parsing.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** buffer overflow / out-of-bounds (memory safety)
- **OOB read:** VBIOS/sysfs offsets and entry counts can point past soft_pp_table_size.
- **Heap write OOB:** get_vddc_lookup_table() at v6.18.53 does kzalloc(struct_size(..., max_levels)) then loops i < ucNumEntries. If ucNumEntries > 8 (VDDC) or > 4 (VDDMEM/VDDCI), it writes past the allocation.
- **Fix:** overflow-safe offset <= size && size <= table_size - offset; reject oversized lookup tables before get_vddc_lookup_table().
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Overflow check is the usual unsigned form and is correct.
- GFXCLK unknown ucRevId still returns -EINVAL, matching existing get_gfxclk_voltage_dependency_table().
- Fan/power-tune unknown rev uses a fallback size (v2), reducing brick risk on odd BIOS revisions.
- init_over_drive_limits() now fails if the gfxclk table is missing/malformed; previously it always returned 0 (and could read garbage). Valid Vega10 tables have this subtable; AMD reviewed that change.
- Regression risk: medium for a large parser change, mitigated by v2 fallback and maintainer review. No public API change.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record: Unvalidated thermal-controller pointer and get_vddc_lookup_table() come from f83a9991648bb (“drm/amd/powerplay:
add Vega10 powerplay support (v5)”, 2017-03-29), contained in **v4.12-rc1**. Present in this 6.18.53 tree (git merge-base --is- ancestor f83a9991648bb v6.18.53).
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Buggy code is the original 2017 parser, not a recent regression.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Same-author series on this branch:
- 10510a4c2c397 drm/amd/pm: Validate Vega hwmgr PowerPlay table bounds (parent; adds get_vega10_state_array)
- this commit (vega10 subtables)
- fc93a02036e5f Tonga subtables (2/3, other file)
- mailing-list 3/3: remaining legacy PPLIB (processpptables.c) This patch is **standalone for Vega10**. 2/3 and 3/3 touch other files.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Yang Wang is an AMD pm contributor with several PPTable bounds patches. Reviewed by Asad Kamal and Kenneth Feng; applied by Alex Deucher.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS** Record:
- Parent 10510a4c2c397 is **not** in v6.18.53. It applies cleanly to v6.18.53. This commit applies cleanly **on top of that parent**; without it, the first hunk fails because v6.18.53 still has check_powerplay_tables instead of get_vega10_state_array.
- Functional dependency is weak (insert context only). Helpers use existing soft_pp_table_size.
- 2/3 and 3/3 are not required for this file.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 9914149f99fd2ddcfd2a8c1053a57d96ec43448e → https://patch.m
sgid.link/[email protected]
- v1: https://patch.msgid.link/20260623102319.413960-1-
[email protected]
- v2 applied (fallback instead of -EINVAL on unmatched fan/power-tune rev)
- Reviewers: Asad Kamal “Series is Reviewed-by”; Kenneth Feng same. No NAK in the saved mbox.
- lore.kernel.org/amd-gfx WebFetch returned 403; thread recovered via b4 dig -m.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To/Cc: amd-gfx, Alex Deucher, Hawking Zhang, Kenneth Feng, Asad Kamal. AMD graphics maintainers were on the patch.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot/bugzilla/Reported-by. Issue is from code audit of untrusted table parsing, not a public crash report.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: [PATCH v2 1/3] this; 2/3 Tonga; 3/3 remaining PPLIB. Self- contained for Vega10. Separate Asad Kamal “clamp ucNumEntries” series exists; this tree’s 6.18.53 baseline has neither.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search was blocked (403 / WebSearch error). UNVERIFIED whether stable@ already discussed this.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: New validators listed above; modified init_thermal_controller, init_over_drive_limits, init_powerplay_extended_tables, init_dpm_2_parameters. vega10_pp_tables_initialize unchanged except it now sees errors from those inits.
**Step 5.2: TRACE CALLERS**
Record:
- vega10_pptable_funcs.pptable_init → vega10_pp_tables_initialize
- hwmgr.c: hwmgr->pptable_func->pptable_init(hwmgr) during hwmgr init
- pp_dpm_set_pp_table() copies userspace buffer into soft_pp_table / soft_pp_table_size, then amd_powerplay_reset() → hwmgr_hw_init() → pptable_init
- Also boot: ATOM VBIOS via smu_atom_get_data_table()
**Step 5.3: TRACE CALLEES**
Record: le16_to_cpu, offsetof, PP_ASSERT_WITH_CODE, existing get_*_voltage_dependency_table / get_vddc_lookup_table after validation. No new allocations in the helpers.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from GPU probe (Vega10) and from sysfs pp_table (0644 read, owner-write: S_IRUGO | S_IWUSR). Not unprivileged; still a documented upload/re-init path. Boot path runs on every Vega10 load.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same pattern in Tonga (process_pptables_v1_0.c) and legacy PPLIB (processpptables.c) — patches 2/3 and 3/3. Voltage-lookup heap overrun is the same max_levels vs ucNumEntries bug.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. v6.18.53 vega10_processpptables.c still does raw offset arithmetic in init_thermal_controller, init_over_drive_limits, init_powerplay_extended_tables, init_dpm_2_parameters, and the get_vddc_lookup_table() overflow loop. Introduced v4.12, still here. git describe HEAD = **v6.18.53-5049-g0f0bdc2b0dffb**; make kernelversion = **6.18.53**.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Does not apply to bare v6.18.53 (first hunk expects get_vega10_state_array). Parent 10510a4c2c397 applies cleanly to v6.18.53 (vega10/12/20); this commit then applies cleanly. Backport
difficulty: **clean apply if parent is taken; otherwise one-hunk context tweak**.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: git log v6.18.53 --grep=PPTable -- vega10_processpptables.c empty. No vega10_pp_table_has_space / pp_entries_max in v6.18.53. No earlier fix for this bug in 6.18.53.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **drm/amd/pm (legacy powerplay / Vega10 hwmgr)**. Criticality:
**IMPORTANT** — vendor GPU power/thermal init, not core mm/net, but boot-critical for Vega 56/64 and related cards. Not staging.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: amdgpu pm is active; this particular file is mature (2017 parser, occasional UBSAN/flex-array cleanups). Long-standing bug, not a new-code issue.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Vega10 amdgpu users (CONFIG_DRM_AMDGPU). Driver-specific, not universal.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- Normal valid VBIOS: not triggered.
- Truncated/corrupt VBIOS or crafted pp_table sysfs write: triggered.
- Sysfs write is root (S_IWUSR). Documented: “Writing to the file will attempt to upload a new powerplay table and re-initialize powerplay.”
- Not an unprivileged attack; still a real kernel heap overflow from a supported interface.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY** Record:
- Heap write past kzalloc in get_vddc_lookup_table() → **HIGH/CRITICAL** (corruption / crash).
- OOB reads of PPTable → **HIGH** (KASAN/oops, possible info leak).
- Severity: **HIGH**.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** high for Vega10 — stops heap overflow and OOB reads on malformed tables, including sysfs reload.
- **Risk:** medium — +459 lines, parser now fails closed; v2 fallback and AMD review reduce brick risk. No API change.
- **Ratio:** benefit outweighs risk for 6.18.y Vega10 users.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real heap overflow: ucNumEntries vs max_levels in voltage lookup (verified in v6.18.53 source).
- Real OOB reads from VBIOS/sysfs offsets (verified).
- Triggerable via documented pp_table sysfs write (pp_dpm_set_pp_table).
- Bug present since v4.12; still in 6.18.53.
- Single file; helpers are overflow-safe; v2 avoids hard-fail on unknown fan/power-tune rev.
- Reviewed-by AMD; applied by Deucher.
- Parent + this apply cleanly to v6.18.53.
AGAINST:
- Large (+459); not a 10-line patch.
- Needs parent for a clean apply (or a small context edit).
- No public crash/syzbot report; valid OEM VBIOS is fine.
- init_over_drive_limits can now fail probe if gfxclk table is absent.
UNRESOLVED:
- Stable-list discussion (lore 403).
- Full v1 review text (msgid.link 403); v2 intent is in the commit message.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — overflow-safe size check; AMD Reviewed-by; v2 regression tweak.
2. Fixes a real bug that affects users? **PASS** — heap overflow + OOB read; sysfs upload path.
3. Important issue (crash, security, corruption, deadlock)? **PASS** — HIGH, memory safety.
4. Small and contained? **PASS** — one file, no new APIs/refactor; line count is high but mechanical validation.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** with parent 10510a4c2c397 (verified apply); otherwise minor first-hunk rework.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. Ordinary memory- safety fix.
**Step 9.4: MAKE YOUR DECISION**
This should go to **this** 6.18.53 tree. The voltage-lookup overflow and unvalidated subtable walks are in 6.18.53. The patch is large but contained and reviewed. Take the parent bounds commit first so it applies cleanly.
------------------------------------------------------------
What problem it solves and why it matters to 6.18 users
------------------------------------------------------------
Vega10 powerplay treats PPTable offsets and ucNumEntries as trusted. A truncated VBIOS or a crafted pp_table sysfs write can read past soft_pp_table_size and, in get_vddc_lookup_table(), write past a heap object sized with max_levels (8/4) while looping ucNumEntries. That is crash/corruption on GPU init or table reload.
Does it meet stable rules?
Yes: real memory-safety bug, no new API, one file, AMD-reviewed. Size is the only stretch; it is validation, not a redesign.
Risk vs benefit
Benefit is a closed heap overflow and OOB read on a supported reload path. Risk is probe failure on malformed/unexpected tables; v2 fallback and existing GFXCLK rev checks limit that. Parent should be applied first.
Concerns
Depends on 10510a4c2c397 for a clean apply to 6.18.53. Sibling 2/3 and 3/3 are other ASICs/files, not required for this fix.
Verification:
- [Phase 1] Tags: author Yang Wang; Reviewed-by Asad Kamal, Kenneth Feng; SOB Alex Deucher; no Fixes/syzbot
- [Phase 2] Diff: +459/−105 in one file; vega10_pp_table_has_space uses offset <= size && size <= table_size - offset
- [Phase 2] v6.18.53 get_vddc_lookup_table: alloc max_levels, loop ucNumEntries — heap overflow confirmed
- [Phase 3] Blame: f83a9991648bb (2017); git merge-base --is-ancestor f83a9991648bb v6.18.53 → yes; git describe --contains → v4.12-rc1
- [Phase 3] No Fixes: tag; parent 10510a4c2c397 not in v6.18.53
- [Phase 4] b4 dig -c 9914149f99fd: v2 1/3 at patch.msgid.link/20260623134917.443011-1; v1 same day; mbox: both AMD reviewers Acked the series; no NAK
- [Phase 4] lore WebFetch 403; discussion taken from b4 dig -m /tmp/vega10-pptable.mbox
- [Phase 4] UNVERIFIED: stable@ thread
- [Phase 5] Callers: pptable_init from hwmgr.c; pp_dpm_set_pp_table sets soft_pp_table then amd_powerplay_reset
- [Phase 5] AMDGPU_DEVICE_ATTR_RW(pp_table) → S_IRUGO | S_IWUSR
- [Phase 6] git describe HEAD = v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion = 6.18.53
- [Phase 6] Bare v6.18.53: this patch does not apply; parent applies cleanly; parent then this applies cleanly
- [Phase 6] No PPTable bounds fix already in v6.18.53 for this file
- [Phase 8] Failure mode: heap OOB write / OOB read; severity HIGH
- UNVERIFIED: v1 mailing-list body (403); whether gfxclk offset is ever 0 on shipping Vega10 VBIOS
**YES**
.../powerplay/hwmgr/vega10_processpptables.c | 564 ++++++++++++++---- 1 file changed, 459 insertions(+), 105 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_processpptables.c +459 -105
@@ -63,6 +63,46 @@ static const void *get_powerplay_table(struct pp_hwmgr *hwmgr)return table_address; } +static bool vega10_pp_table_has_space (struct pp_hwmgr *hwmgr,size_t offset, +size_t size) +{ +size_t table_size = hwmgr->soft_pp_table_size; + +return offset <= table_size && size <= table_size - offset; +} + +static int get_vega10_subtable (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +u16 table_offset,size_t table_size,const void **table) +{ +PP_ASSERT_WITH_CODE ((table_offset !=0 ), +"Invalid PowerPlay Table!" , return -1 ); +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + + *table = (const void *)(((unsigned long )powerplay_table) + table_offset); + +return 0 ; +} + +static int validate_vega10_table_entries (struct pp_hwmgr *hwmgr, +u16 table_offset,size_t entries_offset, +u8 num_entries,size_t entry_size) +{ +size_t table_size; + +PP_ASSERT_WITH_CODE ((num_entries !=0 ), +"Invalid PowerPlay Table!" , return -1 ); + + table_size = entries_offset + num_entries * entry_size; +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + +return 0 ; +} +static int get_vega10_state_array (struct pp_hwmgr *hwmgr,const ATOM_Vega10_POWERPLAYTABLE *powerplay_table,const ATOM_Vega10_State_Array **state_array)
@@ -102,6 +142,293 @@ static int get_vega10_state_array(struct pp_hwmgr *hwmgr,return 0 ; } +static int get_vega10_gfxclk_dependency_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const ATOM_Vega10_GFXCLK_Dependency_Table **gfxclk_dep_table) +{ +const ATOM_Vega10_GFXCLK_Dependency_Table *table; +u16 table_offset; +size_t table_size; +size_t entry_size; + + table_offset =le16_to_cpu (powerplay_table->usGfxclkDependencyTableOffset); +if (!table_offset) +return -EINVAL ; + +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, +sizeof (*table))), +"Invalid PowerPlay Table!" , return -1 ); + + table = (const ATOM_Vega10_GFXCLK_Dependency_Table *) + (((unsigned long )powerplay_table) + table_offset); +PP_ASSERT_WITH_CODE ((table->ucNumEntries !=0 ), +"Invalid PowerPlay Table!" , return -1 ); + +if (table->ucRevId ==0 ) + entry_size =sizeof (ATOM_Vega10_GFXCLK_Dependency_Record); +else if (table->ucRevId ==1 ) + entry_size =sizeof (ATOM_Vega10_GFXCLK_Dependency_Record_V2); +else +PP_ASSERT_WITH_CODE (false, +"Unsupported GFXClockDependencyTable Revision!" , + return -EINVAL ); + + table_size = offsetof(ATOM_Vega10_GFXCLK_Dependency_Table , entries) + + table->ucNumEntries * entry_size; +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + + *gfxclk_dep_table = table; + +return 0 ; +} + +static int get_vega10_clk_dependency_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +u16 table_offset, +const ATOM_Vega10_SOCCLK_Dependency_Table **clk_dep_table) +{ +const ATOM_Vega10_SOCCLK_Dependency_Table *table; +int ret; + + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + + ret =validate_vega10_table_entries (hwmgr, table_offset, + offsetof(ATOM_Vega10_SOCCLK_Dependency_Table , + entries), + table->ucNumEntries, +sizeof (ATOM_Vega10_CLK_Dependency_Record)); +if (ret) +return ret; + + *clk_dep_table = table; + +return 0 ; +} + +static int get_vega10_mclk_dependency_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const ATOM_Vega10_MCLK_Dependency_Table **mclk_dep_table) +{ +const ATOM_Vega10_MCLK_Dependency_Table *table; +u16 table_offset; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usMclkDependencyTableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + + ret =validate_vega10_table_entries (hwmgr, table_offset, + offsetof(ATOM_Vega10_MCLK_Dependency_Table , + entries), + table->ucNumEntries, +sizeof (ATOM_Vega10_MCLK_Dependency_Record)); +if (ret) +return ret; + + *mclk_dep_table = table; + +return 0 ; +} + +static int get_vega10_mm_dependency_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const ATOM_Vega10_MM_Dependency_Table **mm_dep_table) +{ +const ATOM_Vega10_MM_Dependency_Table *table; +u16 table_offset; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usMMDependencyTableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + + ret =validate_vega10_table_entries (hwmgr, table_offset, + offsetof(ATOM_Vega10_MM_Dependency_Table , + entries), + table->ucNumEntries, +sizeof (ATOM_Vega10_MM_Dependency_Record)); +if (ret) +return ret; + + *mm_dep_table = table; + +return 0 ; +} + +static int get_vega10_pcie_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const Vega10_PPTable_Generic_SubTable_Header **pcie_table) +{ +const ATOM_Vega10_PCIE_Table *table; +u16 table_offset; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usPCIETableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + +if (!table->ucNumEntries) { + *pcie_table = (const Vega10_PPTable_Generic_SubTable_Header *)table; +return 0 ; + } + + ret =validate_vega10_table_entries (hwmgr, table_offset, + offsetof(ATOM_Vega10_PCIE_Table , + entries), + table->ucNumEntries, +sizeof (ATOM_Vega10_PCIE_Record)); +if (ret) +return ret; + + *pcie_table = (const Vega10_PPTable_Generic_SubTable_Header *)table; + +return 0 ; +} + +static int get_vega10_hard_limit_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const ATOM_Vega10_Hard_Limit_Table **hard_limit_table) +{ +const ATOM_Vega10_Hard_Limit_Table *table; +u16 table_offset; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usHardLimitTableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + + ret =validate_vega10_table_entries (hwmgr, table_offset, + offsetof(ATOM_Vega10_Hard_Limit_Table , + entries), + table->ucNumEntries, +sizeof (ATOM_Vega10_Hard_Limit_Record)); +if (ret) +return ret; + + *hard_limit_table = table; + +return 0 ; +} + +static int get_vega10_thermal_controller_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const ATOM_Vega10_Thermal_Controller **thermal_controller) +{ +u16 table_offset; + + table_offset =le16_to_cpu (powerplay_table->usThermalControllerOffset); + +return get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (**thermal_controller), + (const void **)thermal_controller); +} + +static int get_vega10_fan_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const Vega10_PPTable_Generic_SubTable_Header **fan_table) +{ +const Vega10_PPTable_Generic_SubTable_Header *header; +u16 table_offset; +size_t table_size; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usFanTableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*header), (const void **)&header); +if (ret) +return ret; + +if (header->ucRevId ==10 ) + table_size =sizeof (ATOM_Vega10_Fan_Table); +else if (header->ucRevId ==0xb ) + table_size =sizeof (ATOM_Vega10_Fan_Table_V2); +else if (header->ucRevId >0xb ) + table_size =sizeof (ATOM_Vega10_Fan_Table_V3); +else + table_size =sizeof (*header); + +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + + *fan_table = header; + +return 0 ; +} + +static int get_vega10_power_tune_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +const Vega10_PPTable_Generic_SubTable_Header **power_tune_table) +{ +const Vega10_PPTable_Generic_SubTable_Header *header; +u16 table_offset; +size_t table_size; +int ret; + + table_offset =le16_to_cpu (powerplay_table->usPowerTuneTableOffset); + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*header), (const void **)&header); +if (ret) +return ret; + +if (header->ucRevId ==5 ) + table_size =sizeof (ATOM_Vega10_PowerTune_Table); +else if (header->ucRevId ==6 ) + table_size =sizeof (ATOM_Vega10_PowerTune_Table_V2); +else + table_size =sizeof (ATOM_Vega10_PowerTune_Table_V3); + +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + + *power_tune_table = header; + +return 0 ; +} + +static int get_vega10_voltage_lookup_table (struct pp_hwmgr *hwmgr, +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table, +u16 table_offset,uint32_t max_levels, +const ATOM_Vega10_Voltage_Lookup_Table **lookup_table) +{ +const ATOM_Vega10_Voltage_Lookup_Table *table; +size_t table_size; +int ret; + + ret =get_vega10_subtable (hwmgr, powerplay_table, table_offset, +sizeof (*table), (const void **)&table); +if (ret) +return ret; + +PP_ASSERT_WITH_CODE ((table->ucNumEntries !=0 && + table->ucNumEntries <= max_levels), +"Invalid PowerPlay Table!" , return -1 ); + + table_size = offsetof(ATOM_Vega10_Voltage_Lookup_Table , entries) + + table->ucNumEntries *sizeof (ATOM_Vega10_Voltage_Lookup_Record); +PP_ASSERT_WITH_CODE ((vega10_pp_table_has_space (hwmgr, table_offset, + table_size)), +"Invalid PowerPlay Table!" , return -1 ); + + *lookup_table = table; + +return 0 ; +} +static int check_powerplay_tables (struct pp_hwmgr *hwmgr,const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) {
@@ -149,14 +476,16 @@ static int init_thermal_controller(const ATOM_Vega10_Fan_Table *fan_table_v1;const ATOM_Vega10_Fan_Table_V2 *fan_table_v2;const ATOM_Vega10_Fan_Table_V3 *fan_table_v3; - - thermal_controller = (ATOM_Vega10_Thermal_Controller *) - (((unsigned long )powerplay_table) + -le16_to_cpu (powerplay_table->usThermalControllerOffset)); +int ret;PP_ASSERT_WITH_CODE ((powerplay_table->usThermalControllerOffset !=0 ),"Thermal controller table not set!" , return -EINVAL ); + ret =get_vega10_thermal_controller_table (hwmgr, powerplay_table, + &thermal_controller); +if (ret) +return ret; + hwmgr->thermal_controller.ucType = thermal_controller->ucType; hwmgr->thermal_controller.ucI2cLine = thermal_controller->ucI2cLine; hwmgr->thermal_controller.ucI2cAddress = thermal_controller->ucI2cAddress;
@@ -185,9 +514,9 @@ static int init_thermal_controller(if (!powerplay_table->usFanTableOffset)return 0 ; - header = (const Vega10_PPTable_Generic_SubTable_Header *) - (((unsigned long )powerplay_table) + -le16_to_cpu (powerplay_table->usFanTableOffset)); + ret =get_vega10_fan_table (hwmgr, powerplay_table, &header); +if (ret) +return ret;if (header->ucRevId ==10 ) { fan_table_v1 = (ATOM_Vega10_Fan_Table *)header;
@@ -332,12 +661,15 @@ static int init_over_drive_limits(struct pp_hwmgr *hwmgr, const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) { - const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = - (const ATOM_Vega10_GFXCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usGfxclkDependencyTableOffset)); + const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table;bool is_acg_enabled = false;ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_v2; +int ret; + + ret =get_vega10_gfxclk_dependency_table (hwmgr, powerplay_table, + &gfxclk_dep_table); +if (ret) +return ret;if (gfxclk_dep_table->ucRevId ==1 ) { patom_record_v2 =
@@ -900,51 +1232,13 @@ static int init_powerplay_extended_tables(int result =0 ;struct phm_ppt_v2_information *pp_table_info = (struct phm_ppt_v2_information *)(hwmgr->pptable); - -const ATOM_Vega10_MM_Dependency_Table *mm_dependency_table = - (const ATOM_Vega10_MM_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usMMDependencyTableOffset)); -const Vega10_PPTable_Generic_SubTable_Header *power_tune_table = - (const Vega10_PPTable_Generic_SubTable_Header *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usPowerTuneTableOffset)); -const ATOM_Vega10_SOCCLK_Dependency_Table *socclk_dep_table = - (const ATOM_Vega10_SOCCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usSocclkDependencyTableOffset)); -const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = - (const ATOM_Vega10_GFXCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usGfxclkDependencyTableOffset)); -const ATOM_Vega10_DCEFCLK_Dependency_Table *dcefclk_dep_table = - (const ATOM_Vega10_DCEFCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usDcefclkDependencyTableOffset)); -const ATOM_Vega10_MCLK_Dependency_Table *mclk_dep_table = - (const ATOM_Vega10_MCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usMclkDependencyTableOffset)); -const ATOM_Vega10_Hard_Limit_Table *hard_limits = - (const ATOM_Vega10_Hard_Limit_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usHardLimitTableOffset)); -const Vega10_PPTable_Generic_SubTable_Header *pcie_table = - (const Vega10_PPTable_Generic_SubTable_Header *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usPCIETableOffset)); -const ATOM_Vega10_PIXCLK_Dependency_Table *pixclk_dep_table = - (const ATOM_Vega10_PIXCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usPixclkDependencyTableOffset)); -const ATOM_Vega10_PHYCLK_Dependency_Table *phyclk_dep_table = - (const ATOM_Vega10_PHYCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usPhyClkDependencyTableOffset)); -const ATOM_Vega10_DISPCLK_Dependency_Table *dispclk_dep_table = - (const ATOM_Vega10_DISPCLK_Dependency_Table *) - (((unsigned long ) powerplay_table) + -le16_to_cpu (powerplay_table->usDispClkDependencyTableOffset)); +const ATOM_Vega10_MM_Dependency_Table *mm_dependency_table; +const Vega10_PPTable_Generic_SubTable_Header *power_tune_table; +const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table; +const ATOM_Vega10_MCLK_Dependency_Table *mclk_dep_table; +const ATOM_Vega10_Hard_Limit_Table *hard_limits; +const Vega10_PPTable_Generic_SubTable_Header *pcie_table; +const ATOM_Vega10_SOCCLK_Dependency_Table *clk_dep_table; pp_table_info->vdd_dep_on_socclk =NULL ; pp_table_info->vdd_dep_on_sclk =NULL ;
@@ -956,63 +1250,114 @@ static int init_powerplay_extended_tables( pp_table_info->vdd_dep_on_phyclk =NULL ; pp_table_info->vdd_dep_on_dispclk =NULL ; -if (powerplay_table->usMMDependencyTableOffset) - result =get_mm_clock_voltage_table (hwmgr, +if (powerplay_table->usMMDependencyTableOffset) { + result =get_vega10_mm_dependency_table (hwmgr, powerplay_table, + &mm_dependency_table); +if (!result) + result =get_mm_clock_voltage_table (hwmgr, &pp_table_info->mm_dep_table, mm_dependency_table); + } -if (!result && powerplay_table->usPowerTuneTableOffset) - result =get_tdp_table (hwmgr, +if (!result && powerplay_table->usPowerTuneTableOffset) { + result =get_vega10_power_tune_table (hwmgr, powerplay_table, + &power_tune_table); +if (!result) + result =get_tdp_table (hwmgr, &pp_table_info->tdp_table, power_tune_table); + } -if (!result && powerplay_table->usSocclkDependencyTableOffset) - result =get_socclk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usSocclkDependencyTableOffset) { + result =get_vega10_clk_dependency_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usSocclkDependencyTableOffset), + &clk_dep_table); +if (!result) + result =get_socclk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_socclk, - socclk_dep_table); + (const ATOM_Vega10_SOCCLK_Dependency_Table *) + clk_dep_table); + } -if (!result && powerplay_table->usGfxclkDependencyTableOffset) - result =get_gfxclk_voltage_dependency_table (hwmgr, - &pp_table_info->vdd_dep_on_sclk, - gfxclk_dep_table); +if (!result && powerplay_table->usGfxclkDependencyTableOffset) { + result =get_vega10_gfxclk_dependency_table (hwmgr, + powerplay_table, &gfxclk_dep_table); +if (!result) + result =get_gfxclk_voltage_dependency_table (hwmgr, + &pp_table_info->vdd_dep_on_sclk, + gfxclk_dep_table); + } -if (!result && powerplay_table->usPixclkDependencyTableOffset) - result =get_pix_clk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usPixclkDependencyTableOffset) { + result =get_vega10_clk_dependency_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usPixclkDependencyTableOffset), + &clk_dep_table); +if (!result) + result =get_pix_clk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_pixclk, (const ATOM_Vega10_PIXCLK_Dependency_Table *) - pixclk_dep_table); + clk_dep_table); + } -if (!result && powerplay_table->usPhyClkDependencyTableOffset) - result =get_pix_clk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usPhyClkDependencyTableOffset) { + result =get_vega10_clk_dependency_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usPhyClkDependencyTableOffset), + &clk_dep_table); +if (!result) + result =get_pix_clk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_phyclk, (const ATOM_Vega10_PIXCLK_Dependency_Table *) - phyclk_dep_table); + clk_dep_table); + } -if (!result && powerplay_table->usDispClkDependencyTableOffset) - result =get_pix_clk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usDispClkDependencyTableOffset) { + result =get_vega10_clk_dependency_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usDispClkDependencyTableOffset), + &clk_dep_table); +if (!result) + result =get_pix_clk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_dispclk, (const ATOM_Vega10_PIXCLK_Dependency_Table *) - dispclk_dep_table); + clk_dep_table); + } -if (!result && powerplay_table->usDcefclkDependencyTableOffset) - result =get_dcefclk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usDcefclkDependencyTableOffset) { + result =get_vega10_clk_dependency_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usDcefclkDependencyTableOffset), + &clk_dep_table); +if (!result) + result =get_dcefclk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_dcefclk, - dcefclk_dep_table); + (const ATOM_Vega10_DCEFCLK_Dependency_Table *) + clk_dep_table); + } -if (!result && powerplay_table->usMclkDependencyTableOffset) - result =get_mclk_voltage_dependency_table (hwmgr, +if (!result && powerplay_table->usMclkDependencyTableOffset) { + result =get_vega10_mclk_dependency_table (hwmgr, powerplay_table, + &mclk_dep_table); +if (!result) + result =get_mclk_voltage_dependency_table (hwmgr, &pp_table_info->vdd_dep_on_mclk, mclk_dep_table); + } -if (!result && powerplay_table->usPCIETableOffset) - result =get_pcie_table (hwmgr, +if (!result && powerplay_table->usPCIETableOffset) { + result =get_vega10_pcie_table (hwmgr, powerplay_table, + &pcie_table); +if (!result) + result =get_pcie_table (hwmgr, &pp_table_info->pcie_table, pcie_table); + } -if (!result && powerplay_table->usHardLimitTableOffset) - result =get_hard_limits (hwmgr, +if (!result && powerplay_table->usHardLimitTableOffset) { + result =get_vega10_hard_limit_table (hwmgr, powerplay_table, + &hard_limits); +if (!result) + result =get_hard_limits (hwmgr, &pp_table_info->max_clock_voltage_on_dc, hard_limits); + } hwmgr->dyn_state.max_clock_voltage_on_dc.sclk = pp_table_info->max_clock_voltage_on_dc.sclk;
@@ -1140,30 +1485,39 @@ static int init_dpm_2_parameters( }if (powerplay_table->usVddcLookupTableOffset) { -const ATOM_Vega10_Voltage_Lookup_Table *vddc_table = - (ATOM_Vega10_Voltage_Lookup_Table *) - (((unsigned long )powerplay_table) + -le16_to_cpu (powerplay_table->usVddcLookupTableOffset)); - result =get_vddc_lookup_table (hwmgr, - &pp_table_info->vddc_lookup_table, vddc_table,8 ); +const ATOM_Vega10_Voltage_Lookup_Table *vddc_table; + + result =get_vega10_voltage_lookup_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usVddcLookupTableOffset), +8 , &vddc_table); +if (!result) + result =get_vddc_lookup_table (hwmgr, + &pp_table_info->vddc_lookup_table, + vddc_table,8 ); } -if (powerplay_table->usVddmemLookupTableOffset) { -const ATOM_Vega10_Voltage_Lookup_Table *vdd_mem_table = - (ATOM_Vega10_Voltage_Lookup_Table *) - (((unsigned long )powerplay_table) + -le16_to_cpu (powerplay_table->usVddmemLookupTableOffset)); - result =get_vddc_lookup_table (hwmgr, - &pp_table_info->vddmem_lookup_table, vdd_mem_table,4 ); +if (!result && powerplay_table->usVddmemLookupTableOffset) { +const ATOM_Vega10_Voltage_Lookup_Table *vdd_mem_table; + + result =get_vega10_voltage_lookup_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usVddmemLookupTableOffset), +4 , &vdd_mem_table); +if (!result) + result =get_vddc_lookup_table (hwmgr, + &pp_table_info->vddmem_lookup_table, + vdd_mem_table,4 ); } -if (powerplay_table->usVddciLookupTableOffset) { -const ATOM_Vega10_Voltage_Lookup_Table *vddci_table = - (ATOM_Vega10_Voltage_Lookup_Table *) - (((unsigned long )powerplay_table) + -le16_to_cpu (powerplay_table->usVddciLookupTableOffset)); - result =get_vddc_lookup_table (hwmgr, - &pp_table_info->vddci_lookup_table, vddci_table,4 ); +if (!result && powerplay_table->usVddciLookupTableOffset) { +const ATOM_Vega10_Voltage_Lookup_Table *vddci_table; + + result =get_vega10_voltage_lookup_table (hwmgr, powerplay_table, +le16_to_cpu (powerplay_table->usVddciLookupTableOffset), +4 , &vddci_table); +if (!result) + result =get_vddc_lookup_table (hwmgr, + &pp_table_info->vddci_lookup_table, + vddci_table,4 ); }return result;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 fs/namespace: notify pollers of legacy propagation changes
In reply to Sasha LevinFrom: Guopeng Zhang <[email protected]>
[ Upstream commit 0ae44a20835e5cf37d03a83e70c92e92deda3703 ]
Changing mount propagation through the legacy mount API changes user-visible mountinfo contents, including the shared: and master:
optional fields.
The mount_setattr() path already touches the mount namespace after change_mnt_propagation(), so pollers of /proc/<pid>/mountinfo are woken when the namespace event changes.
The legacy mount --make-* path also changes propagation through change_mnt_propagation(), and MOVE_MOUNT_SET_GROUP updates the propagation relationship of the target mount. Both paths currently return without touching the affected mount namespace.
As a result, userspace polling /proc/<pid>/mountinfo can miss these propagation-only changes even though mountinfo has changed.
A simple reproducer that polls /proc/self/mountinfo while changing propagation shows the inconsistency.
Before this change:
legacy MS_SHARED: poll ret=0 revents=0x0
mount_setattr MS_SHARED: poll ret=1 revents=0xa
After this change:
legacy MS_SHARED: poll ret=1 revents=0xa
mount_setattr MS_SHARED: poll ret=1 revents=0xa
Fix this by touching the affected mount namespace after successful propagation changes in do_change_type() and do_set_group().
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: the miss is real in 6.18.53, the helpers exist, and the patch is a small ABI wake-up fix. Below is the full 9-phase write-up.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [fs/namespace] [notify] notify pollers of legacy propagation changes
Subsystem is VFS mount-namespace (fs/namespace.c). Verb is “notify”, which here means adding a missing userspace wake-up after a state change.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Signed-off-by:** Guopeng Zhang <[email protected]> (author)
- **Link:** https://patch.msgid.link/20260601032911.940507-1- [email protected]
- **Signed-off-by:** Christian Brauner (Amutable) <[email protected]> (VFS maintainer; applied the patch)
- **No Fixes: tag** (expected for this review queue)
- **No Cc: stable** (expected)
- **No Reported-by / Tested-by / Reviewed-by / Acked-by**
- Pipeline-only tags ([Upstream commit …], Signed-off-by: Sasha Levin) ignored per instructions
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** mount(MS_SHARED|MS_PRIVATE|MS_SLAVE|MS_UNBINDABLE) (do_change_type) and move_mount(MOVE_MOUNT_SET_GROUP) (do_set_group) change propagation (and therefore /proc/<pid>/mountinfo shared: / master: / unbindable fields) but never call touch_mnt_namespace().
- **Symptom:** poll() on /proc/self/mountinfo returns 0 / revents=0 after a legacy --make-* change. The same change via mount_setattr() already wakes pollers (revents=0xa = EPOLLERR|EPOLLPRI).
- **Failure mode:** userspace that waits on mountinfo can miss a real, user-visible table change.
- **Version info:** none in the message. Bug is in the legacy mount() path, which has existed since shared-subtree days.
- **Root cause (author):** those two paths return after change_mnt_propagation() / SET_GROUP list updates without bumping ns->event or waking ns->poll.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is an explicit correctness/ABI fix:
pollers must be woken when mountinfo contents change.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** fs/namespace.c only (+7 lines, no deletions)
- **Functions:** do_change_type(), do_set_group()
- **Scope:** single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Hunk 1 (do_change_type):** after the change_mnt_propagation() walk, previously returned 0 with no namespace event. After: take guard(mount_locked_reader)(), then touch_mnt_namespace(mnt->mnt_ns), then return 0. Normal success path of mount(--make-shared/slave/private/unbindable). Error paths unchanged.
- **Hunk 2 (do_set_group):** after copying slave/share linkage onto to, previously returned 0. After: same lock + touch_mnt_namespace(to->mnt_ns). Normal success path of MOVE_MOUNT_SET_GROUP. Error paths unchanged.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** logic/correctness + userspace ABI (missing poll wake-up)
- **Mechanism:** touch_mnt_namespace() does ns->event = ++event and wake_up_interruptible(&ns->poll). mounts_poll() in fs/proc_namespace.c waits on that queue and sets EPOLLERR|EPOLLPRI when ns->event changes. show_mountinfo prints shared:%i, master:%i, propagate_from:%i, unbindable from the same propagation state. Those fields change without a corresponding event, so pollers keep a stale view.
- Locking: v1 used lock_mount_hash() (write_seqlock), which bumps mount_lock and forces seqcount readers to retry. Christian asked for guard(mount_locked_reader)() (read_seqlock_excl) so topology seqcount readers are not spuriously invalidated. That is the committed form.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** obviously correct. Same helper already used by mount_setattr_commit() after change_mnt_propagation().
- **Minimal:** two call sites, no API or structural change.
- **Regression risk:** low. Extra exclusive seqlock after namespace_excl matches existing lock order (namespace_sem then mount_lock). Wake-up is after a successful mutation only. Using the reader-exclusive guard avoids extra mount_lock sequence bumps, which is why v1 was revised.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Propagation loop in do_change_type dates to Al Viro / Miklos Szeredi (2008–2011); do_change_type itself goes back to shared-subtree (07b20889e3052, contained in v2.6.15-rc1).
- do_set_group body is from Pavel Tikhomirov (9ffb14ef61bab, contained in v5.15-rc1).
- Neither path ever called touch_mnt_namespace() until this commit.
- mount_setattr_commit() has called touch_mnt_namespace() since e257039f0fc7da / 2a1867219c7b2 (mount_setattr, contained in v5.12-rc1). That is the inconsistency the author measured.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Not applicable. The missing wake-up is original behavior of do_change_type, not a recent regression.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- Related: 12cdd1af7a6d1 do_change_type(): use guards, 7b99ee2c5c83b do_set_group(): use guards (already in v6.18.53; this patch sits on that form).
- cffd0441872e7 uniform permission checks; d8cc0362f918d SET_GROUP graph fix — adjacent but not prerequisites for this wake-up.
- Standalone. Not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Guopeng Zhang is not the VFS maintainer. Other master commits under that name are mostly cgroup/docs. This mount patch was applied by Christian Brauner to vfs-7.3.mount.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record:
- Needs touch_mnt_namespace(), guard(mount_locked_reader)(), do_change_type(), do_set_group(). All exist at v6.18.53 (mount_locked_reader from d154f18575899, contained in the 6.18 cycle).
- Applies standalone. No follow-up in this file after 2026-06-01 that amends this wake-up.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- **b4 dig:** https://patch.msgid.link/20260601032911.940507-1-
[email protected]
- **v1:** 2026-05-29, https://patch.msgid.link/20260529095441.1744006-1-
[email protected]
- **v2:** 2026-06-01 (committed version)
- Christian on v1: lock_mount_hash() would make seqcount readers retry on propagation-only changes; use guard(mount_locked_reader)() instead. Author agreed and sent v2.
- No NAK. Christian applied v2 to vfs/vfs.git branch vfs-7.3.mount (commit 0ae44a20835e).
- No reviewer Cc: stable in the thread.
- lore HTTP fetch returned 403; threads were retrieved with b4 dig -m / b4 mbox.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc Alexander Viro, Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel. Brauner reviewed v1 and merged v2. Viro and Kara were CCed; no extra Acked-by in the mbox.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot, bugzilla, or extra reporters. Evidence is the author’s side-by-side poll reproducer (legacy MS_SHARED: poll ret=0 vs mount_setattr: poll ret=1). Severity from that: userspace misses a mountinfo update. How many users: not quantified; the interfaces (mount --make-*, MOVE_MOUNT_SET_GROUP, poll on mountinfo) are used by systemd/libmount, findmnt --poll, and container runtimes.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Single patch, v1→v2 lock change only. Not part of a larger series.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search via WebFetch was 403. No stable discussion was found in the fsdevel mboxes. UNVERIFIED whether anyone previously requested or rejected this for -stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
semcode MCP is not available. Callers/callees were traced with grep and by reading the functions.
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: do_change_type, do_set_group; they call touch_mnt_namespace and guard(mount_locked_reader).
**Step 5.2: TRACE CALLERS**
Record:
- do_change_type() ← path_mount() when flags include MS_SHARED|MS_PRIVATE|MS_SLAVE|MS_UNBINDABLE ← do_mount() / mount() syscall.
- do_set_group() ← vfs_move_mount() when MNT_TREE_PROPAGATION ← move_mount() with MOVE_MOUNT_SET_GROUP.
- touch_mnt_namespace() also used from commit_tree, set_mount_attributes, mount_setattr_commit, umount/expiry paths.
- mounts_poll() is .poll for /proc/<pid>/mounts and /proc/<pid>/mountinfo.
**Step 5.3: TRACE CALLEES**
Record: change_mnt_propagation() (under namespace_sem exclusive), invent_group_ids(), may_change_propagation(), then the new lock + touch_mnt_namespace() (ns->event++, wake_up_interruptible). No allocation on the added path.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Userspace-reachable via mount(2) and move_mount(2) with CAP_SYS_ADMIN in the relevant namespace (may_change_propagation). Unprivileged user+mount namespaces (containers) can hit it. Pollers of procfs mountinfo are the observers. This is a common container/systemd path, not an obscure config.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: mount_setattr_commit() already does change_mnt_propagation() then touch_mnt_namespace(). Historical 0e55a7cca4b66 (“touch_mnt_namespace when the mount flags change”) and 5addc5dd8836a (make /proc/mounts pollable) are the same contract: if mountinfo/mounts text changes, bump the event. This commit fills the remaining propagation-only hole.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record:
- Local tree: **6.18.53** (Makefile VERSION=6 PATCHLEVEL=18 SUBLEVEL=53; git describe HEAD = v6.18.53-5049-g0f0bdc2b0dffb; branch autosel).
- At **v6.18.53**, do_change_type() and do_set_group() return after propagation updates with **no** touch_mnt_namespace(). The bug is present.
- The autosel cherry-pick (3e32bcbd6febbb) is ignored as pipeline state, not as “already selected.”
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** to v6.18.53. Exact context matches both hunks. guard(mount_locked_reader)() and touch_mnt_namespace() are already in this series.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: mount_setattr_commit() already notifies. No earlier equivalent fix for the legacy/SET_GROUP paths at v6.18.53.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **VFS mount namespace** (fs/namespace.c, fs/proc_namespace.c). **CORE** for anyone using mounts; poll on mountinfo is a long-standing userspace ABI.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained (Brauner/Viro). The bug is old; the new mount API made the missing wake-up obvious by contrast.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Anyone polling /proc/*/mountinfo or /proc/*/mounts while another task changes propagation via legacy mount() or MOVE_MOUNT_SET_GROUP. Typical: systemd/libmount monitors, findmnt --poll, container runtimes. Not universal on every syscall, but not a rare driver either.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Trigger is mount --make-shared/slave/private/unbindable (optionally MS_REC) or move_mount(..., MOVE_MOUNT_SET_GROUP) while a poller is waiting. Needs mount-admin capability in the namespace. Unprivileged in a user+mount ns. Not a race in the kernel sense; it is a missing notification on a fully deterministic path. Common during container setup; easy to miss if the same process both changes propagation and does not poll.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Failure: poll does not wake; userspace keeps a stale view of shared:/master:/unbindable until some later unrelated mount event.
- Actual propagation in the kernel is correct; this is not a graph corruption bug.
- **Severity: MEDIUM.** Userspace ABI miss, not oops/deadlock/corruption. Can make mount monitors and orchestrators act on stale topology.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** medium. Restores the documented poll contract for a change that is already visible in mountinfo, and matches mount_setattr().
- **Risk:** very low. +7 lines, existing helper, lock form chosen by the VFS maintainer specifically to avoid extra seqcount retries.
- **Ratio:** favorable for 6.18.y.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
**For backporting:**
- Real, reproduced bug: legacy MS_SHARED poll ret=0 vs mount_setattr poll ret=1.
- User-visible /proc/<pid>/mountinfo contents change (shared:, master:, unbindable) without a poll event.
- Same subsystem already notifies on the mount_setattr() path; this closes the hole for mount() and MOVE_MOUNT_SET_GROUP.
- 7-line, obviously correct change; VFS maintainer reviewed locking and merged v2.
- Bug and helpers exist in this 6.18.53 tree; patch applies cleanly.
- Reachable from mount(2) / move_mount(2); pollable proc files have been an ABI since 5addc5dd8836a.
**Against backporting:**
- Not a crash, deadlock, data-corruption, or security fix.
- No extra user/syzbot reports; author found it by comparing APIs.
- do_change_type has omitted this wake-up since shared-subtree (~2.6.15) without a flood of reports.
- No Cc: stable in review (absence is expected, not a veto).
- Importance is “oh, that’s not good” ABI correctness, not oops-class.
**Unresolved:**
- Could not query lore.kernel.org/stable over HTTP (403). No evidence the patch was previously rejected for stable.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — matches mount_setattr_commit; v2 lock change from Brauner; author showed before/after poll results.
2. Fixes a real bug that affects users? **PASS** — pollers of mountinfo miss propagation-only updates; documented proc poll ABI (5addc5dd8836a, mounts_poll).
3. Important issue? **PASS** (medium / “oh, that’s not good”) — stale mount-table view for systemd/libmount/container monitors; not oops- class, but it is a userspace-visible contract break on core VFS, not trivia.
4. Small and contained? **PASS** — 7 lines, one file, two success-path sites.
5. No new features or APIs? **PASS** — only wakes existing waiters.
6. Can apply to the local tree? **PASS** — v6.18.53 context matches; mount_locked_reader and touch_mnt_namespace exist.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID, quirk, DT, build, or docs fix). It is a normal small ABI/correctness fix.
**Step 9.4: MAKE YOUR DECISION**
This should be backported to **this** 6.18.53 tree. The bug is present here, the fix is small and already the pattern used by mount_setattr(), and leaving poll silent while mountinfo shared:/master: fields change is a real userspace-visible failure, not a cleanup.
Stable rules in this tree explicitly allow “oh, that’s not good” issues. A broken poll() on /proc/<pid>/mountinfo after mount --make-* is
that: monitors used in production can miss a topology change the kernel already committed. Risk is negligible compared with that benefit.
===============================================================
What the commit solves for stable users
===============================================================
On 6.18.y, mount --make-shared (and related flags) and MOVE_MOUNT_SET_GROUP update propagation and the text of mountinfo, but do not increment mnt_namespace->event or wake ns->poll. Tools waiting on that fd do not re-read, so they can keep stale shared: / master: / unbindable state. mount_setattr() already notifies. The patch adds the same touch_mnt_namespace() after the two missing success paths, under mount_locked_reader so lookup seqcounts are not bumped.
No extra commits are required. No new ABI. Regression risk is a spurious extra wake (harmless) or the brief exclusive seqlock (same class as other namespace operations).
===============================================================
Verification
===============================================================
- [Phase 1] Parsed message/tags: author Guopeng Zhang; Link msgid 20260601032911; SOB Christian Brauner; no Fixes/Reported-by/Cc-stable.
- [Phase 2] Diff: +7 lines in fs/namespace.c; do_change_type and do_set_group success paths only.
- [Phase 2] Confirmed touch_mnt_namespace() increments ns->event and wakes ns->poll (fs/namespace.c ~971–976).
- [Phase 2] Confirmed mounts_poll() waits on ns->poll and sets EPOLLERR|EPOLLPRI on event change (fs/proc_namespace.c 21–37).
- [Phase 2] Confirmed mountinfo prints shared:/master:/unbindable from that state (fs/proc_namespace.c 158–169).
- [Phase 2] Confirmed mount_setattr_commit() already calls touch_mnt_namespace() after change_mnt_propagation() (line 4785).
- [Phase 3] git describe HEAD / make kernelversion / Makefile: this tree is 6.18.53.
- [Phase 3] git merge-base --is-ancestor 3e32bcbd6febbb v6.18.53: not in v6.18.53 (bug still there).
- [Phase 3] git show v6.18.53:fs/namespace.c: both functions return without touch_mnt_namespace.
- [Phase 3] Blame: do_change_type loop 2008–2011; do_set_group 9ffb14ef61bab (v5.15-rc1); git describe --contains 07b20889e3052 → v2.6.15-rc1.
- [Phase 3] mount_locked_reader present at v6.18.53 (d154f18575899 / fs/mount.h:164).
- [Phase 3] Patch context matches v6.18.53 exactly (do_change_type/do_set_group context match: True).
- [Phase 4] b4 dig -c 0ae44a20835e: v2 lore URL; b4 dig -a: v1 2026-05-29, v2 2026-06-01.
- [Phase 4] v1 mbox: Brauner requested guard(mount_locked_reader) instead of lock_mount_hash; v2 applied to vfs-7.3.mount; no NAK.
- [Phase 4] b4 dig -w: Viro, Brauner, Jan Kara, linux-fsdevel CCed.
- [Phase 4] WebFetch lore/stable: 403; UNVERIFIED stable-list history.
- [Phase 5] Callers: path_mount → do_change_type; vfs_move_mount → do_set_group for MOVE_MOUNT_SET_GROUP (UAPI in include/uapi/linux/mount.h).
- [Phase 6] Local 6.18.53 has the bug; helpers present; clean apply.
- [Phase 8] Failure mode: missed poll on mountinfo, severity MEDIUM (ABI), not oops.
- UNVERIFIED: whether systemd/libmount has a public bug for this specific miss; no reporter besides the author.
The patch is small, already matches the mount_setattr() notification path, and restores poll on a core proc file for a change that is already user-visible in this 6.18.y tree.
**YES**
fs/namespace.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/namespace.c +7 -0
@@ -2932,6 +2932,9 @@ static int do_change_type(const struct path *path, int ms_flags)for (m = mnt; m; m = (recurse ?next_mnt (m, mnt) :NULL ))change_mnt_propagation (m, type); +guard (mount_locked_reader)(); +touch_mnt_namespace (mnt->mnt_ns); +return 0 ; }
@@ -3414,6 +3417,10 @@ static int do_set_group(const struct path *from_path, const struct path *to_pathlist_add (&to->mnt_share, &from->mnt_share);set_mnt_shared (to); } + +guard (mount_locked_reader)(); +touch_mnt_namespace (to->mnt_ns); +return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 s390/dasd: Snapshot intrc before freeing the request block
In reply to Sasha LevinFrom: Stefan Haberland <[email protected]>
[ Upstream commit dc3e3f7306cb74066f231251602b1be5aaec7bd8 ]
__dasd_cleanup_cqr() maps the completion result to a block status by reading cqr->intrc, but only after discipline->free_cp() has returned the request block to its memory pool (dasd_eckd_free_cp() ends in dasd_sfree_request()). On SMP another CPU can reallocate that block and overwrite cqr->intrc before it is read, completing the request with the wrong error. proc_bytes is already snapshotted before free_cp() for the same reason; do the same for intrc.
---
LLM Generated explanations, may be completely bogus:
The local tree is **5.10.270** (pending-5.10). The DASD cleanup path here still reads cqr->intrc after the CQR is returned to the per- device pool, so this is a real, self-contained race fix for this checkout.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Record: **[s390/dasd] [Snapshot] Snapshot intrc before freeing the request block**
- Subsystem: s390/dasd (IBM mainframe block driver). Action is “snapshot”, which here means copy a field before free so it cannot be overwritten — a use-after-reuse fix.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Record:
- Reviewed-by: Jan Höppner <[email protected]> (DASD co- maintainer)
- Signed-off-by: Stefan Haberland <[email protected]> (DASD maintainer / author)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Jens Axboe <[email protected]> (block maintainer; applied to the block tree)
- No Fixes:, Reported-by:, Tested-by:, Cc: stable (absence expected for this review)
- Ignore pipeline Signed-off-by: Sasha Levin if present
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
- Record:
- **Bug:** __dasd_cleanup_cqr() maps completion to blk_status_t by reading cqr->intrc *after* discipline->free_cp(). dasd_eckd_free_cp() ends in dasd_sfree_request(), which returns the CQR to the device CCW memory pool.
- **Failure mode:** On SMP another CPU can reallocate that block and overwrite intrc; the original request is completed with the **wrong error**.
- **Root cause:** Same class of bug already handled for proc_bytes (snapshotted before free_cp()); intrc was left unsaved.
- **Version info:** None in the message. The pattern exists since
detailed I/O-error mapping (2013).
**Step 1.4: DETECT HIDDEN BUG FIXES**
- Record: **Not hidden.** Explicit race / use-after-reuse. Cover letter for the 19-patch series ([PATCH 00/19] s390/dasd: ESE Performance improvements) states: “The first 4 patches are fixes for existing bugs in this area.” This is patch 04/19. Later patches are ESE performance features; this one is standalone.
---
## PHASE 2: DIFF ANALYSIS - LINE BY LINE
**Step 2.1: INVENTORY THE CHANGES**
- Record:
- File: drivers/s390/block/dasd.c only (+8 / -2)
- Function: __dasd_cleanup_cqr()
- Scope: **single-file surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
- Record:
- **Before:** proc_bytes = cqr->proc_bytes; then `status =
...->free_cp(cqr, req);` then `switch (cqr->intrc)` on the failed
path (`status == 0`).
- **After:** Also `intrc = cqr->intrc;` before `free_cp()`, then
`switch (intrc)`.- Path: block-layer completion / error mapping after I/O or ERP; not an init-only path.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
- Record:
- **Category:** Use-after-free / use-after-reuse (custom memory pool), with a race.
- **Mechanism:** dasd_sfree_request() drops device->mem_lock after dasd_free_chunk(&device->ccw_chunks, ...). dasd_smalloc_request() on another CPU takes that lock, allocates the same chunk, and memset(cqr, 0, sizeof(*cqr)), then may set a new intrc. Cleanup then maps garbage/zero/intrc from a *different* request.
- Verified in this tree: dasd_eckd_free_cp(), dasd_fba_free_cp(), and dasd_diag_free_cp() all call dasd_sfree_request() after capturing status = cqr->status == DASD_CQR_DONE. status is already a return value; only intrc was still loaded from freed memory.
**Step 2.4: ASSESS THE FIX QUALITY**
- Record:
- **Obviously correct:** copies the already-accepted proc_bytes pattern.
- **Minimal:** one local, one assignment, switch operand change, comment.
- **Regression risk:** very low. Does not change locking, APIs, or success/fail (status was already snapshotted via the return value).
- Context in this tree uses BLK_STS_NEXUS (not BLK_STS_RESV_CONFLICT, renamed later in 7ba150834b840). Backport needs that context tweak only; the logic is identical.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
- Record:
- __dasd_cleanup_cqr since 8e09f21574ea30 (2008).
- switch (cqr->intrc) after free_cp(): d1ffc1f8660e74
(“block/dasd: detailed I/O errors”, 2013) then `2a842acab109f4`
(blk_status_t, 2017).
- `proc_bytes` snapshot: `5e6bdd37c5526` (2020, ESE data-corruption
fix, `Cc: stable`). - Bug present for ~13 years; proc_bytes was fixed in 2020 and **is** in this tree; intrc was not.
**Step 3.2: FOLLOW THE FIXES: TAG**
- Record: No Fixes: tag. Introducing commits d1ffc1f8660e74 and 2a842acab109f4 **are** ancestors of HEAD (git merge-base --is- ancestor exit 0).
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
- Record: Recent dasd.c work is other DASD correctness fixes (ESE, hanging unbind, etc.). This patch does not depend on them. Series patches 02–03 touch dasd_erp.c / dasd_eckd.c, not this hunk.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
- Record: Stefan Haberland is listed in MAINTAINERS for S390 DASD (`M:
Stefan Haberland, M: Jan Hoeppner`). Jan Höppner reviewed. High- confidence maintainer fix.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
- Record: **Standalone.** Needs only __dasd_cleanup_cqr + cqr->intrc after free_cp(), both present. Not blocked on ESE full-track patches 05–19. Applied by Axboe as dc3e3f7306cb74066f231251602b1be5aaec7bd8 (block tree); that SHA is not in this checkout, which is expected.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
- Record:
- Lore/msgid: [email protected] (patch
04/19; msgid `-5` is 1-based including cover).
- `b4 mbox` retrieved a 40-message thread (WebFetch to lore returned
403).
- Cover letter: first four patches are **existing bug fixes**; rest is
ESE performance.
- Jens Axboe: “Applied, thanks!” and listed this as commit
`dc3e3f7306cb74066f231251602b1be5aaec7bd8`. - No NAK. Sashiko flagged **pre-existing** UAFs (flush path cqr->dq after free, req->q after blk_mq_end_request, etc.) — not introduced here; author said leftover findings would be handled separately.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
- Record: DASD maintainers (author + Reviewed-by Höppner); linux-block via Axboe. Correct audience.
**Step 4.3: SEARCH FOR THE BUG REPORT**
- Record: No user/syzbot report. Bug is pool reuse, not kfree, so KASAN often will not fire. Analysis is from code review by the maintainer.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
- Record: 19-patch ESE series. This hunk does not need patches 05–19. Independent of 01–03 for apply/correctness.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
- Record: **UNVERIFIED** — lore.kernel.org/stable WebFetch returned 403. No evidence in the retrieved thread of a stable NAK.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
- Record: __dasd_cleanup_cqr() only.
**Step 5.2: TRACE CALLERS**
- Record (this tree):
1. Block tasklet (dasd_block_tasklet path ~2979): dq = cqr->dq; lock; __dasd_cleanup_cqr(cqr); unlock. Normal I/O completion.
2. dasd_flush_block_queue() ~3085: same cleanup during flush/unbind.
- Called from tasklet / flush, not a rare ioctl-only path.
**Step 5.3: TRACE CALLEES**
- Record: dasd_profile_end (before free), discipline->free_cp → dasd_sfree_request → pool free, then blk_mq_end_request / blk_mq_complete_request / blk_update_request.
**Step 5.4: FOLLOW THE CALL CHAIN**
- Record: userspace I/O → do_dasd_request (blk_mq_ops.queue_rq) → build_cp / dasd_smalloc_request → interrupt/tasklet → __dasd_cleanup_cqr. **Reachable from ordinary block I/O** on DASD. Default nr_hw_queues = 4, so cleanup on one queue does **not** serialize smalloc on another (do_dasd_request only holds that queue’s dq->lock; pool uses device->mem_lock). Internal CCWs also smalloc without dq->lock. Race is real on SMP.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
- Record: proc_bytes already snapshotted in the same function. dasd_erp.c also snapshots proc_bytes around ERP. No other cqr->intrc use after free_cp() in this function.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
- Record: **Yes.** drivers/s390/block/dasd.c __dasd_cleanup_cqr (around 2782–2835):
```2792:2797:drivers/s390/block/dasd.c
proc_bytes = cqr->proc_bytes;
status = cqr->block->base->discipline->free_cp(cqr, req);
if (status < 0)
error = errno_to_blk_status(status);
else if (status == 0) {
switch (cqr->intrc) {
```- make kernelversion / Makefile: **5.10.270**. git describe HEAD:
p-5.10-1-gce56b7a73b64b.
- Introduced: 2013 (d1ffc1f8660e74); present for the entire 5.10 lifetime.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
- Record: **Minor context only.** This tree maps -EPERM to BLK_STS_NEXUS without the later reservation comment. Same function shape. Expected apply: fuzz on the case -EPERM block, or a 3-line manual edit. No structural rework.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
- Record: proc_bytes snapshot is here (5e6bdd37c5526). intrc is still read after free. No substitute fix.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
- Record: drivers/s390/block/dasd* — **IMPORTANT** on s390 (primary disk driver for IBM Z). Not core mm/VFS, but production storage for every DASD user.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
- Record: Mature driver, still receiving correctness fixes. Not staging.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
- Record: **Driver-specific / platform-specific:** s390 DASD (CONFIG_DASD). Default 4 HW queues. Typical enterprise mainframe disks.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
- Record:
- Failed block I/O (free_cp returns 0) **and** another CPU reallocates the CQR from the 2-page ccw_chunks pool before intrc is read.
- Window is a few instructions, but the pool is tiny and multi-queue I/O makes reuse likely under load.
- Unprivileged users can issue disk I/O; they cannot freely choose the race. Not a typical local-root primitive; it is a correctness/memory-safety bug.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
- Record:
- status is already captured, so success vs fail of the request stays correct.
- Wrong intrc maps -EPERM (stolen DASD lock → BLK_STS_NEXUS), -ENOLINK (failfast/transport), -ETIMEDOUT to whatever the reused block contains (usually 0 after memset → BLK_STS_IOERR).
- Stolen-lock reported as generic I/O error can break HA/cluster handling (retry on a volume another system owns).
- **Severity: HIGH** (wrong block completion status; use-after-reuse). Not a panic by itself.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
- Record:
- **Benefit:** High for s390 DASD — correct timeout/transport/reservation errors; closes a real SMP reuse race.
- **Risk:** Very low — ~6 lines, local stack copy, same pattern as
`proc_bytes`.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real SMP use-after-reuse after dasd_sfree_request().
- Wrong blk_status_t on failed I/O, including stolen-lock (-EPERM) vs generic IOERR.
- Tiny, obviously correct, matches existing proc_bytes snapshot in this file.
- DASD maintainer + co-maintainer review; Axboe applied it.
- Author classified it as a bug fix (series patches 1–4), not an ESE feature.
- Buggy code is in 5.10.270; default 4 HW queues make the race plausible.
- No new API/feature.
**AGAINST:**
- No Reported-by / syzbot / panic.
- Typical visible effect is misclassified errors, not a crash.
- Original patch context uses BLK_STS_RESV_CONFLICT (rename not in 5.10).
- Related pre-existing UAFs (flush cqr->dq, req->q) are **not** fixed here — separate issues, not a reason to drop this snapshot.
**UNRESOLVED:**
- Stable-list discussion (lore 403).
- How often the race hits in production (unverified; maintainer asserts it).
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — same snapshot as proc_bytes; reviewed; in mainline block tree.
2. Fixes a real bug that affects users? **PASS** — wrong completion status on DASD I/O.
3. Important (crash, security, corruption, deadlock)? **PASS** — use- after-reuse plus misreported reservation/timeout/transport errors on the s390 disk path.
4. Small and contained? **PASS** — one function, ~6 lines of logic.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — hunk is here; map BLK_STS_RESV_CONFLICT context to BLK_STS_NEXUS.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
- Record: Not a device-ID/quirk/DT/build/doc exception. Ordinary small correctness fix.
**Step 9.4: DECISION**
Backport. The bug exists in this 5.10 tree, the fix is surgical and independent of the ESE performance series, and the risk is negligible compared with completing I/O with a stale intrc.
---
## What the commit solves and why it matters here
__dasd_cleanup_cqr() already saves proc_bytes before free_cp() because that call returns the CQR to a 2-page per-device pool. It still reads cqr->intrc afterward. With default four blk-mq queues, another CPU can dasd_smalloc_request() the same chunk (memset to zero, then a new intrc). Failed requests then get the wrong blk_status_t (timeout, transport, or stolen lock reported as generic I/O error). That is a real SMP race on the main s390 disk driver, not an ESE feature.
## Stable rules / risk vs benefit
Meets the stable bar: real bug, small, no new API, applies with a trivial BLK_STS_NEXUS context tweak. Benefit is correct I/O error reporting and closing use-after-reuse; regression risk is a local integer copy.
## Concerns
- Original diff context uses BLK_STS_RESV_CONFLICT; this tree still has BLK_STS_NEXUS. Adjust context; do not pull the rename.
- Do not pull series patches 05–19 (ESE performance).
- Pre-existing cqr->dq use after free in dasd_flush_block_queue() is out of scope.
## Verification
- **[Phase 1]** Tags: Reviewed-by Höppner; SOB Haberland + Axboe; Link msgid ...1285190-5; no Fixes/Reported-by.
- **[Phase 1]** Cover letter via b4 mbox: “first 4 patches are fixes for existing bugs.”
- **[Phase 2]** Diff: intrc snapshot in __dasd_cleanup_cqr only; +8/-2.
- **[Phase 2]** This tree: free_cp → dasd_sfree_request → dasd_free_chunk(&device->ccw_chunks); smalloc memsets the CQR.
- **[Phase 3]** git blame: switch (cqr->intrc) from 2a842acab109f4 / d1ffc1f8660e74; proc_bytes from 5e6bdd37c5526.
- **[Phase 3]** git merge-base --is-ancestor those SHAs vs HEAD: all present.
- **[Phase 3]** Author is MAINTAINERS DASD M:.
- **[Phase 4]** b4 mbox 40 messages; Axboe applied as dc3e3f7306cb; Sashiko notes are pre-existing, not this hunk.
- **[Phase 4]** WebFetch lore/stable: 403 — UNVERIFIED.
- **[Phase 5]** Callers: block tasklet ~2979, flush ~3085; queue_rq = do_dasd_request; nr_hw_queues = 4.
- **[Phase 6]** make kernelversion 5.10.270; buggy switch (cqr->intrc) at dasd.c:2797.
- **[Phase 6]** BLK_STS_RESV_CONFLICT absent here (include/linux/blk_types.h has BLK_STS_NEXUS only).
- **[Phase 8]** Failure mode verified: status from free_cp return; only error *class* races.
**YES**
drivers/s390/block/dasd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/block/dasd.c +8 -2
@@ -2736,17 +2736,23 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr)struct request *req;blk_status_t error =BLK_STS_OK ;unsigned int proc_bytes; -int status; +int status, intrc; req = (struct request *) cqr->callback_data;dasd_profile_end (cqr->block, cqr, req); +/* +* free_cp() returns the request block to its memory pool, so snapshot +* everything still needed from cqr before calling it - another CPU can +* reallocate and overwrite the block right after. +*/ proc_bytes = cqr->proc_bytes; + intrc = cqr->intrc; status = cqr->block->base->discipline->free_cp (cqr, req);if (status <0 ) error =errno_to_blk_status (status);else if (status ==0 ) { -switch (cqr->intrc) { +switch (intrc) {case -EPERM :/* * DASD doesn't implement SCSI/NVMe reservations, but it
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] s390/dasd: Snapshot intrc before freeing the request block
Sashiko has reviewed this patch and found no issues.
Quoted 12 lines
From: Stefan Haberland <[email protected]>
[ Upstream commit
dc3e3f7306cb74066f231251602b1be5aaec7bd8]
__dasd_cleanup_cqr()maps the completion result to a block status by readingcqr->intrc, but only afterdiscipline->free_cp()has returned the request block to its memory pool (dasd_eckd_free_cp()ends indasd_sfree_request()). On SMP another CPU can reallocate that block and overwritecqr->intrcbefore it is read, completing the request with the wrong error.proc_bytesis already snapshotted beforefree_cp()for the same reason; do the same for intrc.
Quoted 5 lines
Reviewed-by Jan Höppner <[email protected]>Signed-off-by Stefan Haberland <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1