net: dsa: mt7530: check CORE_PLL_GROUP4 access in mt7531_setup()
Subsystems (71)
Sasha Levin
maintainerPATCH 1/1 xsk: account ring allocations to memcg
In reply to Sasha LevinFrom: Zihan Xi <[email protected]>
[ Upstream commit b0057c68df711bf6a62033c072ac61c4f9d3cbc1 ]
AF_XDP rings are allocated from setsockopt() and can be mapped into user space. The shared xskq_create() helper allocates the ring backing memory, but the user-controlled and long-lived allocation is not charged as kmem to the allocating memory cgroup.
The current implementation uses vmalloc_user(), which allocates the backing pages with GFP_KERNEL | __GFP_ZERO. Use the same VM_USERMAP vmalloc path, but pass GFP_KERNEL_ACCOUNT so the ring backing pages are attributed to memcg/kmem and can be constrained by existing cgroup memory limits. This keeps the existing zeroing and mmap semantics while avoiding AF_XDP-specific optmem or RLIMIT_MEMLOCK accounting.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.12.111** (pending-6.12). The AF_XDP ring path still uses unaccounted vmalloc_user(), so this is a real memcg/DoS hole in this checkout, not a no-op.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
- Subsystem: xsk (AF_XDP / net/xdp)
- Action verb: **account** (resource-accounting fix, not a refactor)
- Claimed intent: charge AF_XDP ring backing pages to memcg/kmem
Record: [xsk] [account] charge AF_XDP ring allocations to memcg
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
From the candidate message:
- Acked-by: Stanislav Fomichev <[email protected]>
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Zihan Xi <[email protected]>
- Signed-off-by: Jakub Kicinski <[email protected]>
- Ignore: any Signed-off-by: Sasha Levin (pipeline)
From the original v3 submission (mailing list, not treated as “already selected”):
- Fixes: 423f38329d26 ("xsk: add umem fill queue support and mmap")
- Cc: [email protected]
- Reported-by: Vega <[email protected]>
- Assisted-by: Codex:gpt-5.4
No syzbot, no Tested-by. Absence of Fixes/Cc:stable on the candidate copy is expected and is not a NO signal.
Record: Ack from XDP/BPF reviewer; original submission had Fixes + Cc:stable + Reported-by; applied by netdev maintainer.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Bug: xskq_create() allocates mmapable ring memory from setsockopt() with vmalloc_user() (GFP_KERNEL | __GFP_ZERO). That allocation is user-controlled, long-lived, and **not charged to memcg/kmem**.
Symptom: a task with CAP_NET_RAW in a user+net namespace can request very large RX/TX/fill/completion rings **before bind or packet I/O**. Cover letter includes a PoC (unshare -Urn ./poc, 1<<25 entries) and an OOM panic on **6.12.95** with panic_on_oom.
Root cause: missing __GFP_ACCOUNT on the VM_USERMAP vmalloc path. Author explicitly says panic_on_oom is environment-specific; the defect is missing kmem attribution.
Record: [Bug: unaccounted userspace-triggered vmalloc of AF_XDP rings] [Symptom: memcg-limit bypass / global OOM] [Version: repro on 6.12.95] [Cause: vmalloc_user uses GFP_KERNEL, not GFP_KERNEL_ACCOUNT]
**Step 1.4: DETECT HIDDEN BUG FIXES**
Not disguised. It is a missing-accounting fix. Kernel policy in Documentation/core-api/memory-allocation.rst says untrusted userspace allocations **must** set __GFP_ACCOUNT.
Record: [Not hidden; explicit resource-accounting / isolation bug]
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
File: net/xdp/xsk_queue.c only (~+11 / -1)
- Add #include <asm/shmparam.h>
- Add xskq_vmalloc_user()
- In xskq_create(): vmalloc_user(size) → xskq_vmalloc_user(size)
xskq_destroy() still vfree()s the ring (uncharge is automatic on page free).
Record: [1 file, ~12 lines] [xskq_vmalloc_user added; xskq_create modified] [single-file surgical]
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Before: vmalloc_user() → __vmalloc_node_range(..., GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL, VM_USERMAP, ...)
After: same VM_USERMAP/SHMLBA/zeroing/mmap path, GFP flag is GFP_KERNEL_ACCOUNT | __GFP_ZERO.
Affected path: setsockopt(SOL_XDP, XDP_{RX,TX,UMEM_FILL,UMEM_COMPLETION}_RING) → xsk_setsockopt → xsk_init_queue → xskq_create. Normal allocation path, not an error- path-only change.
Record: [before: unaccounted vmalloc_user] [after: identical vmalloc, charged to memcg]
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Category: resource accounting / isolation (userspace-triggered kernel memory not charged to kmemcg). Secondary failure mode: OOM / panic_on_oom.
Mechanism: GFP_KERNEL vs GFP_KERNEL_ACCOUNT (GFP_KERNEL | __GFP_ACCOUNT). In this tree, __vmalloc_node_range_noprof() honors __GFP_ACCOUNT (page alloc + MEMCG_VMALLOC stat).
Not UAF, leak, race, or bounds check.
Record: [resource accounting] [uncharged mmapable ring pages; fix is GFP_KERNEL_ACCOUNT]
**Step 2.4: ASSESS THE FIX QUALITY**
Obviously correct relative to vmalloc_user() in mm/vmalloc.c (same args except GFP). No new uAPI. vfree() already drops the pages, so no extra unaccount helper (unlike rejected v2 mm_account_pinned_pages).
Regression risk: AF_XDP in a **tight memcg** can now get -ENOMEM where it previously escaped the limit. That is the intended isolation. No lock/API/lifetime change.
Stanislav noted dislike of open-coding __vmalloc_node_range; same pattern already used for mmapable BPF maps after vmalloc_user_node_flags was removed. Acceptable.
Record: [minimal, matches vmalloc_user] [low regression risk; memcg ENOMEM is intended]
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
- Ring helper/mmap: 423f38329d267 (2018, Magnus Karlsson) — “xsk: add umem fill queue support and mmap”
- vmalloc_user switch: 9f78bf330a66c (2023, Xuan Zhuo) — “xsk:
support use vaddr as ring”
- Overflow guard: a12bbb3cccf03 (2023)
Buggy missing accounting dates to the original mmapable queue (2018). vmalloc_user only changed the allocator.
Record: [introduced conceptually in 423f38329d267 (v4.18-era); vmalloc_user since 9f78bf330a66c / v6.3]
**Step 3.2: FOLLOW THE FIXES: TAG**
423f38329d267 **is an ancestor of this HEAD** (git merge-base --is- ancestor exit 0). Original code used __get_free_pages; accounting was missing then too.
Record: [Fixes target in this tree] [no later in-tree substitute for ring memcg charge]
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Recent net/xdp/xsk_queue.c: overflow check, vmalloc conversion, header moves. No existing memcg/optmem/RLIMIT charge on rings.
Series history (mailing list): v1 optmem + socket lifetime coupling; v2 RLIMIT_MEMLOCK; **v3 is standalone 1/1** memcg-only.
Record: [standalone v3; no in-tree prereq refactor]
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Zihan Xi is not an XDP maintainer. Reviewer Stanislav Fomichev is a regular XDP/BPF reviewer and Acked v3. Applied by Jakub Kicinski.
Record: [author: reporter/fixer; reviewer: subsystem regular; maintainer applied]
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Needs __vmalloc_node_range, SHMLBA, VM_USERMAP, GFP_KERNEL_ACCOUNT. All present in 6.12.
Local xskq_create uses kzalloc(sizeof(*q), GFP_KERNEL) vs mainline kzalloc_obj(*q) — **not in the changed hunks**. Functional diff applies.
Record: [no functional dependencies] [applies standalone with trivial context]
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
b4 dig -c <msgid> could not match a local commit (patch not in this tree). b4 mbox retrieved the 4-message thread.
- Cover: https://lists.openwall.net/netdev/2026/07/31/395
- Patch: https://lists.openwall.net/netdev/2026/07/31/392
- Review: https://lists.openwall.net/netdev/2026/07/31/437
v1 optmem, v2 RLIMIT_MEMLOCK, v3 memcg. Applied version is v3 (latest). No NAK. Stanislav Acked. Patchwork-bot accepted it.
Author nominated Cc: stable on v3. Reviewer did not object.
Record: [lore msgid 20260731164623.4694-2] [v1→v3, v3 applied] [Ack, no NAK] [author Cc:stable]
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
To/Cc: netdev, bpf, Magnus Karlsson, Maciej Fijalkowski, Stanislav Fomichev, davem, edumazet, pabeni, horms, ast, daniel, hawk, john.fastabend.
Stanislav reviewed v2 (pushed memcg over RLIMIT_MEMLOCK) and Acked v3.
Record: [Stanislav Fomichev Ack; XDP maintainers were CC'd]
**Step 4.3: SEARCH FOR THE BUG REPORT**
Internal report (Reported-by: Vega) plus full PoC and panic log on 6.12.95. Trigger: socket(AF_XDP) + setsockopt with 2^25 entries, unshare -Urn. No syzbot/bugzilla.
Record: [reproducible OOM/panic on 6.12.95; userns+CAP_NET_RAW]
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
v3 is 0/1 + 1/1. No extra patches required. v1/v2 approaches were dropped.
Record: [self-contained; earlier series versions superseded]
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
No useful hit on lore.kernel.org/stable for this subject. No recorded rejection for 6.12.y.
Record: [no stable-list rejection found]
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: [xskq_vmalloc_user (new), xskq_create (modified)]
**Step 5.2: TRACE CALLERS**
xskq_create is only called from xsk_init_queue() in net/xdp/xsk.c, from xsk_setsockopt for the four ring options. Process context, syscall.
xsk_create() requires ns_capable(net->user_ns, CAP_NET_RAW) — **available to an unprivileged user inside a user namespace**.
Record: [setsockopt path; userns CAP_NET_RAW]
**Step 5.3: TRACE CALLEES**
__vmalloc_node_range → page alloc with GFP; vfree on destroy. No new locks.
Record: [vmalloc/vfree only]
**Step 5.4: FOLLOW THE CALL CHAIN**
socket(AF_XDP) → setsockopt(SOL_XDP, XDP_*_RING, &entries) → xskq_create.
xsk_init_queue only checks entries != 0, power of two, and queue not already set. **No upper bound.** xdp_desc is 16 bytes; 2^25 entries ≈ 512 MiB per RX/TX ring (fill/completion similar with u64 descs). Eight sockets × four rings is multi-GB kernel vmalloc.
Reachable from userspace: **yes**.
Record: [userspace-reachable unbounded vmalloc]
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
UMEM pages are charged via user->locked_vm (xdp_umem_unaccount_pages). BPF mmapable maps use __vmalloc_node_range with accounting flags. Rings were the hole.
vmalloc_user() elsewhere (kcov, perf, videobuf) is a separate question; this patch only fixes AF_XDP.
Record: [UMEM already bounded; rings were not; BPF already accounts mmapable vmalloc]
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Yes. net/xdp/xsk_queue.c:49 is q->ring = vmalloc_user(size);. make kernelversion = **6.12.111**. Repro log is 6.12.95. 423f38329d267 and 9f78bf330a66c are ancestors. No xskq_vmalloc_user / GFP_KERNEL_ACCOUNT in net/xdp.
Record: [buggy code present; bug since 2018 / vmalloc path since ~6.3]
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Expected apply: **clean / trivial context**. Only surrounding difference is kzalloc vs kzalloc_obj. asm/shmparam.h exists (arch/x86/include/asm/shmparam.h, include/asm-generic/shmparam.h). __vmalloc_node_range macro exists in include/linux/vmalloc.h.
Record: [clean apply or one-hunk context tweak]
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
No memcg/optmem/RLIMIT accounting on ring create in this tree.
Record: [no substitute fix present]
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
net/xdp — AF_XDP. Config: CONFIG_XDP_SOCKETS (depends on BPF_SYSCALL, default n).
Criticality: **IMPORTANT** (not core mm/VFS). Used for high-performance networking; also a userns attack surface when enabled.
Record: [net/xdp AF_XDP] [IMPORTANT]
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Mature since 2018; ongoing XDP work. This is an old hole, not a bug in brand-new code.
Record: [mature; hole is long-standing]
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Config-specific (CONFIG_XDP_SOCKETS) plus anyone who can create AF_XDP sockets. Isolation impact is highest for **containers / memcg-limited workloads** on LTS kernels.
Record: [config-specific AF_XDP; high impact for cgroup/container hosts]
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
setsockopt of a large power-of-two ring. No bind, no traffic. Unprivileged in a user ns with CAP_NET_RAW. Easy and deterministic.
Caveat (verified from author): **without a memcg limit**, GFP_KERNEL_ACCOUNT does not stop global OOM (CONSTRAINT_NONE in their prototype). Enforcement is cgroup memory policy.
Record: [easy syscall trigger] [fix enforces memcg, not a global hard cap]
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
- With memcg limits (typical k8s/LTS): bypass of memory.max / kmem → **container isolation hole** (HIGH/CRITICAL for multi-tenant)
- With panic_on_oom: **kernel panic** (CRITICAL in that config)
- Without memcg limits: still global OOM killer after the patch
Record: [memcg bypass + OOM] [HIGH; CRITICAL under panic_on_oom / multi-tenant]
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Benefit: closes documented-required kmem accounting; lets existing cgroup limits constrain a userspace-triggered multi-hundred-MB vmalloc; matches BPF-style mmapable alloc policy.
Risk: ~12 lines, GFP flag only, one file. Possible -ENOMEM for oversized rings inside a small memcg — correct.
Record: [benefit high for container/LTS] [risk very low] [favorable]
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real, documented policy violation: untrusted userspace alloc without __GFP_ACCOUNT
- Concrete PoC and panic on **6.12.95**, this series
- Reachable via userns CAP_NET_RAW + setsockopt, no bind needed
- Unbounded ring size (power-of-two only)
- Small, obviously equivalent to vmalloc_user + account flag
- APIs and buggy code exist in this 6.12.111 tree
- Acked by Stanislav Fomichev; applied by Jakub Kicinski
- Standalone (v3 dropped optmem/RLIMIT machinery)
- UMEM already resource-bounded; rings were the gap
- Author asked for stable; reviewer did not object
AGAINST:
- Does **not** by itself stop global OOM if there is no memcg limit (author confirmed)
- CONFIG_XDP_SOCKETS is not default-on
- Open-codes __vmalloc_node_range (reviewer accepted)
- Can change success/failure of huge rings inside tight memcgs
UNRESOLVED:
- Exact mainline SHA of the applied commit (not in this checkout; thread was retrieved by msgid)
- No stable-list discussion found
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — same vmalloc path as vmalloc_user; PoC/discussion; maintainer Ack
2. Fixes a real bug that affects users? **PASS** — missing kmem charge; OOM/isolation on 6.12
3. Important issue? **PASS** — memcg isolation hole and OOM (panic_on_oom in the report)
4. Small and contained? **PASS** — one file, ~12 lines
5. No new features or APIs? **PASS** — GFP flag only, not a new uAPI
6. Can apply to the local tree? **PASS** — code and helpers present
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Not a device-ID/quirk/DT/docs exception. Ordinary resource-accounting bug fix.
Record: [no exception category; qualifies on primary rules]
**Step 9.4: MAKE YOUR DECISION**
This is a small, correct fix for a userspace-reachable hole that this 6.12 tree still has. LTS hosts that run AF_XDP and cgroups (containers) need the charge so memory.max actually applies. Incomplete as a *global* OOM cap is not a reason to keep rings unaccounted; kernel policy already requires __GFP_ACCOUNT, and that is exactly what this patch adds.
===============================================================
DETAILED EXPLANATION
===============================================================
**Problem:** xskq_create() backs AF_XDP rings with vmalloc_user() (GFP_KERNEL). setsockopt() can request an arbitrary power-of-two entry count with no memcg charge. In a user namespace that grant CAP_NET_RAW, that is a large, long-lived kernel allocation that bypasses cgroup kmem limits. The report includes a panic on 6.12.95 under panic_on_oom.
**Why it matters here:** This checkout is 6.12.111; the vmalloc_user() call is still present. 6.12.y is an LTS line used with cgroups. Charging the pages is what makes existing memory limits apply to this path.
**Rules:** Surgical, no new API, no series prereq, applies with at most trivial kzalloc context. Reviewer-directed design (memcg, not optmem/RLIMIT).
**Risk vs benefit:** Benefit is isolation/OOM under memcg; risk is a GFP flag on one alloc. vfree() already releases pages. The remaining gap (no memcg → still global OOM) is a property of memcg, not a reason to skip the charge.
**Concerns:** Incomplete without cgroup limits; XDP sockets are optional. Neither outweighs backporting the accounting the kernel already requires for untrusted userspace allocations.
===============================================================
Verification:
===============================================================
- [Phase 1] Parsed subject/body/tags from the candidate message; mailing-list v3 also had Fixes: 423f38329d26, Cc: stable, Reported-by:
Vega
- [Phase 2] Diff is one file: helper wrapping __vmalloc_node_range with GFP_KERNEL_ACCOUNT | __GFP_ZERO, VM_USERMAP, SHMLBA — compared to vmalloc_user_noprof() in mm/vmalloc.c:4063-4068
- [Phase 2] Confirmed GFP_KERNEL_ACCOUNT is GFP_KERNEL | __GFP_ACCOUNT in include/linux/gfp_types.h:379
- [Phase 2] Confirmed vmalloc honors __GFP_ACCOUNT in mm/vmalloc.c:3734-3738
- [Phase 3] git blame net/xdp/xsk_queue.c: vmalloc_user from 9f78bf330a66c; helper from 423f38329d267
- [Phase 3] git merge-base --is-ancestor 423f38329d267 HEAD → 0; 9f78bf330a66c → 0
- [Phase 3] git log --oneline -20 -- net/xdp/xsk_queue.c: no memcg accounting already present
- [Phase 3] No GFP_KERNEL_ACCOUNT under net/xdp in this tree
- [Phase 4] b4 dig -c <msgid>: no local commit match; b4 mbox saved 4-message thread
- [Phase 4] Thread: v3 patch, Stanislav Ack, patchwork-bot, cover letter; no NAK
- [Phase 4] Openwall cover+review: PoC, 6.12.95 panic, memcg vs RLIMIT debate
- [Phase 4] WebSearch of lore.kernel.org/stable: no rejection thread found (UNVERIFIED: lore search 403 on some URLs)
- [Phase 5] Callers: only xsk_init_queue ← xsk_setsockopt for four ring optnames
- [Phase 5] xsk_create: ns_capable(net->user_ns, CAP_NET_RAW) at net/xdp/xsk.c:1742
- [Phase 5] xsk_init_queue: no max entries, only power-of-two (net/xdp/xsk.c:1061-1062)
- [Phase 5] struct xdp_desc is 16 bytes (include/uapi/linux/if_xdp.h:155-159)
- [Phase 6] git describe HEAD → p-6.12-2-gd38d58a4e0359; make kernelversion → 6.12.111
- [Phase 6] Current file still has q->ring = vmalloc_user(size) at line 49
- [Phase 6] __vmalloc_node_range and asm/shmparam.h exist in this tree
- [Phase 7] CONFIG_XDP_SOCKETS in net/xdp/Kconfig, default n, depends on BPF_SYSCALL
- [Phase 8] UMEM uses locked_vm in xdp_umem.c; rings do not
- [Phase 8] Documentation/core-api/memory-allocation.rst:53-56 requires __GFP_ACCOUNT for untrusted userspace allocs
- UNVERIFIED: mainline commit SHA (patch not in this checkout)
- UNVERIFIED: whether a later mainline follow-up added a hard ring-size cap (not in this tree)
The patch is a small, correct memcg charge for a userspace-reachable AF_XDP allocation that this 6.12 tree still leaves unaccounted.
**YES**
net/xdp/xsk_queue.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/xdp/xsk_queue.c +11 -1
@@ -9,6 +9,8 @@#include <linux/vmalloc.h> #include <net/xdp_sock_drv.h> +#include <asm/shmparam.h> +#include "xsk_queue.h" static size_t xskq_get_ring_size (struct xsk_queue *q,bool umem_queue)
@@ -21,6 +23,14 @@ static size_t xskq_get_ring_size(struct xsk_queue *q, bool umem_queue)return struct_size (rxtx_ring, desc, q->nentries); } +static void *xskq_vmalloc_user (unsigned long size) +{ +return __vmalloc_node_range (size,SHMLBA ,VMALLOC_START ,VMALLOC_END , +GFP_KERNEL_ACCOUNT | __GFP_ZERO,PAGE_KERNEL , +VM_USERMAP ,NUMA_NO_NODE , +__builtin_return_address (0 )); +} +struct xsk_queue *xskq_create (u32 nentries,bool umem_queue) {struct xsk_queue *q;
@@ -46,7 +56,7 @@ struct xsk_queue *xskq_create(u32 nentries, bool umem_queue) size =PAGE_ALIGN (size); - q->ring =vmalloc_user (size); + q->ring =xskq_vmalloc_user (size);if (!q->ring) {kfree (q);return NULL ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 fbdev: omap2: dsi: do not copy isr table
In reply to Sasha LevinFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 31875c51c31edec57b3620f278680c23a823763b ]
To te able to unregister stuff from isrs, the corresponding table was copied. Nobody seems to unregister stuff that way, so it does not help. But there are stack-allocated objects passed to these isrs giving chances of UAF of these objects if irqs are unregistered while they are handled, so better do not copy that table.
---
LLM Generated explanations, may be completely bogus:
This is a UAF fix in the OMAP2 fbdev DSI IRQ path. The same change is already in this 6.12 tree for the DRM copy of the driver; the fbdev copy of the bug is still present.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [fbdev/omap2/dsi] [do not copy] [stop copying the DSI ISR table before invoking handlers]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Suggested-by: [email protected] (static-analysis bot; this is the original trigger, not a user crash report)
- Signed-off-by: Andreas Kemnade <[email protected]> (author)
- Signed-off-by: Helge Deller <[email protected]> (fbdev maintainer)
- No Fixes: tag (expected for this review queue)
- No Cc: [email protected]
- No Reported-by:, Tested-by:, Reviewed-by:, or Link:
- Ignore Signed-off-by: Sasha Levin / [Upstream commit ...] if present in candidate packaging; they are not part of the technical decision
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: ISR table was memcpy’d so handlers could unregister themselves, then the copy was walked after dropping irq_lock.
- Author claim: nothing unregisters from ISR context, so the copy is unused for its stated purpose.
- Failure mode: stack-allocated objects (DECLARE_COMPLETION_ONSTACK, dsi_packet_sent_handler_data on stack) are passed as ISR arg. If unregister/return happens while the IRQ handler still walks the copy, those objects are used after free.
- No kernel-version range in the message.
- Root cause: lockless copy of function+arg pointers that alias stack objects.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is explicitly a UAF/race fix, even though the subject does not say “fix”.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/video/fbdev/omap2/omapfb/dss/dsi.c (+1 / −8; 9 lines)
- Removes struct dsi_isr_tables isr_tables_copy from struct dsi_data
- In omap_dsi_irq_handler(): drop memcpy, call dsi_handle_isrs() on the live table **while irq_lock is held**, then unlock
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Before: lock → read/ack IRQ status → memcpy table → unlock → dsi_handle_isrs(©) → error/stats
- After: lock → read/ack IRQ status → dsi_handle_isrs(&live table) → unlock → error/stats
- Affected path: hardirq handler (devm_request_irq(..., omap_dsi_irq_handler, IRQF_SHARED, ...))
- Unregister (dsi_unregister_isr*) takes irq_lock, so it now waits until handlers finish
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- Category: use-after-free / race (memory safety)
- Mechanism: copy of ISR arg pointers outlives unregister of stack- allocated completions
- Verified stack objects passed into ISRs in this tree:
- dsi_sync_vc_vp() / dsi_sync_vc_l4():
DECLARE_COMPLETION_ONSTACK + stack dsi_packet_sent_handler_data
- dsi_vc_send_bta_sync(): stack completion registered on **two** tables (global + VC)
- dsi_enter_ulps(): stack completion registered on CIO table
- Concrete UAF in dsi_vc_send_bta_sync(): dsi_handle_isrs() walks global table then VC table. First handler can complete(); waiter unregisters and returns; second handler still runs against the copy with a dangling stack pointer.
- Fix: keep irq_lock across handler dispatch so unregister cannot destroy the objects until handlers return.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct given the locking: unregister cannot proceed while handlers run.
- Minimal; no API change.
- Regression risk is low **if** no ISR unregisters itself (would deadlock on irq_lock). Verified all three callbacks (dsi_completion_handler, dsi_packet_sent_handler_vp, dsi_packet_sent_handler_l4) only complete() and/or read registers. None call dsi_unregister_isr*.
- complete() under a spinlock is valid.
- Holding the lock slightly longer in hardirq is register reads + complete(), not a sleep.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Copy logic and isr_tables_copy blamed to f76ee892a99e6 (“omapfb:
copy omapdss & displays for omapfb”, 2015-12-29).
- Pattern is as old as the fbdev DSS copy in this tree; originally inherited from OMAP DSS ISR support.
- Long-lived bug, not recent code.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: on the fbdev commit. The sibling DRM fix 2c27a84ba8d1b (drm/omap: dsi: Do not copy isr table) has `Fixes:4ae2ddddf44cd ("OMAP: DSS2: DSI: Add ISR support")`. That original ISR support is what fbdev copied.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES** Record:
- Recent dsi.c changes in this tree are unrelated (platform remove, of_graph, timer, pm_runtime).
- Standalone; not patch N/M.
- Cover letter on lore points at a DRM twin:
https://lore.kernel.org/lkml/20260702-dsi- [email protected]/
- That DRM twin **is already in this tree** as 2c27a84ba8d1b (contained in v6.12.110~477).
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record:
- Andreas Kemnade is an OMAP/display contributor; same author wrote the DRM twin.
- Helge Deller (fbdev maintainer) applied the fbdev patch.
- Tomi Valkeinen applied the DRM twin.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS** Record:
- No new functions/types.
- Applies as a logic change on existing omap_dsi_irq_handler / struct dsi_data.
- Context mismatch only: mainline hunk context has timer_delete(); this tree still has del_timer() (8fa7292fee5c5 timer rename is not in 6.12). Not a functional dependency.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 31875c51c31ed: https://patch.msgid.link/20260702-fbomap-
[email protected]
- b4 dig -a: single revision **v1** only; that version was applied.
- Thread: author patch → sashiko-bot review → author reply → Helge Deller “applied.”
- No NAK. Deller accepted it.
- Bot comments were about **pre-existing sibling bugs** (DRM DSI, DISPC copy, unbind timers), not about this change being wrong.
- Author noted the DRM variant in the patch footer.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w):
- To: Helge Deller
- Cc: linux-omap, linux-fbdev, dri-devel, linux-kernel, sashiko-bot
- Appropriate lists; fbdev maintainer applied it.
- No human Reviewed-by besides maintainer application.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record:
- No syzbot/bugzilla user report. Trigger is sashiko-bot static analysis.
- Bug is still real: code in this tree matches the described UAF (stack completions + lockless copy).
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record:
- DRM twin already backported here (2c27a84ba8d1b).
- fbdev DISPC still copies a stack registered_isr in dispc-compat.c (omap_dispc_irq_handler); same pattern, **separate** file, not required for this DSI patch to be correct.
- No revert of either DSI fix on origin/master.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: UNVERIFIED. lore.kernel.org/stable/ and lore message URLs returned HTTP 403. Thread was recovered via b4 dig -m instead. No stable-list discussion could be fetched.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: omap_dsi_irq_handler(); field removed from struct dsi_data. Callers of dsi_handle_isrs() / dsi_call_isrs() unchanged except the table pointer and lock scope.
**Step 5.2: TRACE CALLERS**
Record:
- omap_dsi_irq_handler ← devm_request_irq in DSI bind/probe (dsi.c ~5363). Hardirq, IRQF_SHARED.
- Register/unregister sites are process context, all take irq_lock.
- Sync/BTA/ULPS paths used during DSI frame update, command write, and ULPS enter (dsi_sync_vc from update/disable; dsi_vc_send_bta_sync as .bta_sync; dsi_enter_ulps).
**Step 5.3: TRACE CALLEES**
Record: dsi_handle_isrs → dsi_call_isrs → registered isr(arg, status) → complete() / REG_GET. Then dsi_handle_irq_errors and dsi_collect_irq_stats still after unlock.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from normal display I/O on CONFIG_FB_OMAP2=y + CONFIG_FB_OMAP2_DSS_DSI=y (MIPI DSI panel). Not a syscall fuzzer path, but a real device IRQ + wait-for-completion path. Unprivileged userspace can trigger it by updating the framebuffer on such hardware.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record:
- DRM drivers/gpu/drm/omapdrm/dss/dsi.c in **this tree** already calls dsi_handle_isrs(&dsi->isr_tables, ...) under irq_lock (the backported twin).
- fbdev dispc-compat.c still memcpy’s ISRs then drops the lock; leftover sibling, not a blocker for this patch.
- isr_tables_copy exists only in this fbdev dsi.c in this checkout.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Record:
- git describe HEAD: p-6.12-3-gc504cf0baa3d8
- make kernelversion / Makefile: **6.12.111**
- git merge-base --is-ancestor 31875c51c31ed HEAD → not an ancestor (fix not in this tree)
- Buggy code present: isr_tables_copy at dsi.c:330, memcpy at dsi.c:841-848
- Introduced here via f76ee892a99e6 (v4.5-era copy)
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record:
- git apply --check of 31875c51c31ed fails only because context has timer_delete vs local del_timer.
- The two functional hunks (remove field; move dsi_handle_isrs before unlock) match this tree byte-for-byte aside from that nearby timer name.
- Expected difficulty: **minor context tweak**, not rework.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE** Record:
- DRM equivalent already applied (2c27a84ba8d1b).
- No fbdev DSI equivalent. FB_OMAP2 depends on DRM_OMAP=n, so omapfb users do **not** get the DRM fix.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: drivers/video/fbdev/omap2 — SoC display driver. Criticality:
**PERIPHERAL** (OMAP2+ boards using legacy fbdev, not omapdrm). Still in-tree and user-facing on that hardware.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature/legacy. Low churn; bug has been present since the 2015 omapdss copy. Maintainer (Deller) still takes fixes.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific / config-specific: CONFIG_FB_OMAP2 + CONFIG_FB_OMAP2_DSS_DSI on OMAP2+ with MIPI DSI, and only when DRM omap is disabled.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- Trigger: DSI IRQ concurrent with unregister of a stack-backed ISR after complete() or timeout (dsi_sync_vc_* 10 ms, BTA 500 ms, ULPS 1000 ms).
- Dual-ISR BTA path is the most realistic (two handlers, one stack object).
- Unprivileged userspace can drive framebuffer updates that hit dsi_sync_vc.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Use-after-free of stack completions / handler-data → kernel oops or memory corruption in hardirq. Severity: **HIGH**.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: HIGH for omapfb+DSI users (prevents UAF in IRQ). Population is small, but the DRM twin was already taken into this same 6.12.y tree, which shows the bug class is treated as stable-worthy.
- Risk: LOW (9 lines, verified no self-unregister, complete() under spinlock is fine).
- Ratio: benefit outweighs risk.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real UAF: lockless copy of pointers to DECLARE_COMPLETION_ONSTACK objects
- Dual-ISR BTA path makes the race practical, not only a 1-instruction window
- Small, obviously correct lock-scope change
- All ISR callbacks verified not to unregister (no self-deadlock)
- Code exists in this 6.12.111 tree; bug dates to 2015 copy
- fbdev maintainer applied v1 with no NAK
- Identical DRM fix already in this tree; omapfb users are the leftover affected set
AGAINST:
- No user Reported-by / syzbot (bot-found)
- Peripheral OMAP fbdev DSI, not a core path
- Vanilla patch needs a one-line context adjust (del_timer)
- DISPC has a similar leftover pattern (out of scope for this commit)
UNRESOLVED:
- Could not query lore.kernel.org/stable (HTTP 403)
- No runtime reproduction in this session (analysis is from code + thread)
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — lock documents the intent; maintainer applied; DRM twin already on 6.12.y
2. Fixes a real bug that affects users? **PASS** — UAF on DSI IRQ vs stack completions
3. Important issue? **PASS** — UAF / oops / memory corruption (HIGH)
4. Small and contained? **PASS** — 9 lines, one file
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — functional diff matches; trivial del_timer context
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not an ID/quirk/DT/build/docs exception. It is a normal memory- safety bugfix.
**Step 9.4: MAKE YOUR DECISION**
This should be backported to **this** 6.12.y tree. The buggy isr_tables_copy path is here; the fix is the same one already taken for omapdrm; omapfb is a separate config and still needs it.
Verification:
- [Phase 1] Tags: Suggested-by sashiko-bot; SOB Kemnade + Deller; no Fixes/Cc stable/Reported-by
- [Phase 2] Diff: remove isr_tables_copy; call dsi_handle_isrs(&dsi->isr_tables) before spin_unlock
- [Phase 2] Confirmed stack completions at dsi.c:2298, 2347, 2617, 3115
- [Phase 2] Confirmed ISR callbacks only complete/read MMIO; no unregister
- [Phase 3] Blame: f76ee892a99e6 (2015); ancestor check of 31875c51c31ed vs HEAD: not present
- [Phase 3] DRM twin 2c27a84ba8d1b is in this tree (git merge-base --is-ancestor exit 0; v6.12.110~477)
- [Phase 4] b4 dig: lore msgid 20260702-fbomap-uaf- [email protected]; v1 only; Deller “applied.”
- [Phase 4] UNVERIFIED: stable@ lore search (HTTP 403)
- [Phase 5] Handler installed via devm_request_irq + IRQF_SHARED; sync/BTA/ULPS are the users
- [Phase 6] Local tree 6.12.111; buggy memcpy still at dsi.c:841-848; apply --check fails only on timer_delete vs del_timer
- [Phase 7] Peripheral fbdev OMAP DSI; mutually exclusive with DRM_OMAP
- [Phase 8] Failure mode: hardirq UAF of stack object, severity HIGH
The patch is a small UAF fix that already exists for the DRM clone in this tree, applies with a trivial context tweak, and matches stable rules.
**YES**
drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dsi.c +1 -8
@@ -326,8 +326,6 @@ struct dsi_data {spinlock_t irq_lock;struct dsi_isr_tables isr_tables; -/* space for a copy used by the interrupt handler */ -struct dsi_isr_tables isr_tables_copy;int update_channel;#ifdef DSI_PERF_MEASURE
@@ -838,15 +836,10 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)timer_delete (&dsi->te_timer);#endif -/* make a copy and unlock, so that isrs can unregister -* themselves */ -memcpy (&dsi->isr_tables_copy, &dsi->isr_tables, -sizeof (dsi->isr_tables)); +dsi_handle_isrs (&dsi->isr_tables, irqstatus, vcstatus, ciostatus);spin_unlock (&dsi->irq_lock); -dsi_handle_isrs (&dsi->isr_tables_copy, irqstatus, vcstatus, ciostatus); -dsi_handle_irq_errors (dsidev, irqstatus, vcstatus, ciostatus);dsi_collect_irq_stats (dsidev, irqstatus, vcstatus, ciostatus);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 HID: Intel-thc-hid: Intel-quickspi: Fix buffer overflow
In reply to Sasha LevinFrom: Even Xu <[email protected]>
[ Upstream commit a1cdd72371270640bd357bd3e3b2ec0be17c9536 ]
The input buffers are used to store complete HID-over-SPI packets, including their protocol headers. However, their sizes are currently calculated from the payload length only.
Allocate enough space for both the payload and the packet header to prevent a buffer overflow when the payload reaches its maximum size.
---
LLM Generated explanations, may be completely bogus:
This is a real heap overflow in Intel QuickSPI HID input, and the local 6.18.57 tree still has the undersized input_buf allocation, so it should be backported.
Local tree: **v6.18.57** (6.18.57, HEAD cdf239ca885b2). The buggy allocation is present at v6.18.57; HIDSPI_INPUT_BODY_SIZE already exists here. The patch applies cleanly.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [HID/intel-thc-hid/intel-quickspi] [fix] [prevent input_buf overflow by including HIDSPI packet header in allocation]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Signed-off-by: Even Xu <[email protected]> (author; INTEL THC maintainer)
- Signed-off-by: Jiri Kosina <[email protected]> (HID maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, Link:, or Cc: stable (absence is expected)
- Pipeline-only markers ignored: [Upstream commit a1cdd72371270640bd357bd3e3b2ec0be17c9536], Signed-off-by: Sasha Levin
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: input_buf is sized from HID payload length only, but stores a full HID-over-SPI packet (header + payload).
- Symptom: buffer overflow when the payload is at its maximum size.
- Root cause: size uses max_input_len / rep_desc_len and omits HIDSPI_INPUT_BODY_HEADER_SIZE (4 bytes).
- No stack traces, versions, or syzbot IDs.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. Subject and body state a buffer overflow. The one- line change matches that claim.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c (+2/-1)
- Function: quickspi_alloc_report_buf()
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Before (v6.18.57): qsdev->input_buf = devm_kzalloc(..., max_input_len, ...) where max_input_len = max(rep_desc_len, max_input_len).
- After: allocate HIDSPI_INPUT_BODY_SIZE(max_input_len) = payload + sizeof(struct input_report_body_header) (packed 4 bytes).
- Path: probe-time allocation; used later on every RX DMA completion.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: [BUFFER OVERFLOW / OUT-OF-BOUNDS]
Mechanism verified in this tree:
1. IRQ thread quickspi_irq_thread_handler() calls thc_rxdma_read(..., qsdev->input_buf, &input_len, ...).
2. read_dma_buffer() does sg_copy_to_buffer(sg, nent, read_buff, mes_len) with **no check against input_buf allocation size**.
3. The only bound is mes_len > read_config->max_packet_size, and max_packet_size is ALIGN(max_input_len, SZ_4K), so a packet of max_input_len + 4 is allowed for typical HID sizes.
4. quickspi_handle_input_data() treats input_buf as struct input_report_body (4-byte header + content).
5. Output path already accounts for the header via HIDSPI_OUTPUT_REPORT_SIZE (from 6fcefe71aeb52, already in v6.18.57). Input was left inconsistent.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct. Uses an existing macro. 4 extra devm_kzalloc bytes. No locking, API, or ABI change. Regression risk is very low (slightly larger probe allocation).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: Buggy alloc introduced in 4138f21115aec ("HID: intel-thc-hid:
intel-quickspi: Complete THC QuickSPI driver", Xinpeng Sun, 2025-01-06). Present since at least **v6.15**. Present in this 6.18.y tree.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Introducer is 4138f21115aec, which **is** an ancestor of v6.18.57.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record (on this tree, limited to the file):
- 6fcefe71aeb52 — already in v6.18.57; sized **output** report_buf with HIDSPI_OUTPUT_REPORT_SIZE and added a copy bound. That made the remaining input undersize obvious.
- b2301bdb4b3ed, c2854af5774b0, device-ID commits — unrelated.
- Sibling 4bda3254e7b4f (QuickI2C overflow) is a parallel independent fix, not a prerequisite.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Even Xu is listed in MAINTAINERS as INTEL TOUCH HOST CONTROLLER (THC) DRIVER co-maintainer. Related work in-tree includes DMA safety checks and device IDs. This is a maintainer-authored fix.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Standalone. Needs only HIDSPI_INPUT_BODY_SIZE in include/linux/hid-over-spi.h, present at v6.18.57:91. Series is [PATCH 2/2] with QuickI2C; the two files do not depend on each other.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c a1cdd72371270640bd357bd3e3b2ec0be17c9536 →
https://patch.msgid.link/[email protected]
- Cover: [PATCH 0/2] HID: Intel-thc-hid: Fix potential buffer overflow (20260922024638.932865-1)
- b4 dig -a: **v1 only** (no later revisions)
- Thread saved via b4 dig -m; lore.kernel.org HTTP fetch returned **403**
- Jiri Kosina: “Applied to hid.git#for-7.3/upstream-fixes, thanks.” No NAK, no requested changes on the SPI patch.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc [email protected] (Benjamin Tissoires), [email protected] (Jiri Kosina), [email protected], [email protected]. HID maintainers were on the original mail. Kosina applied it.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by / syzbot / bugzilla. Found by the subsystem maintainer as a size mismatch. Cover letter calls it a **potential** overflow; the DMA copy path confirms it is reachable, not theoretical.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Independent 2-patch set (QuickI2C + QuickSPI). Sashiko AI comment was about the **I2C** patch (report_len vs HIDI2C_PACKET_LEN), not this SPI change. SPI report_buf is already header-sized in this tree.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: curl to lore.kernel.org/stable also returned 403. UNVERIFIED whether stable@ discussed this specifically. No local evidence it was rejected.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: quickspi_alloc_report_buf()
**Step 5.2: TRACE CALLERS**
Record: Only quickspi_probe() at pci-quickspi.c:660, after reset_tic(), before quickspi_dma_init() / quickspi_get_report_descriptor() / quickspi_hid_probe(). Standard PCI probe. input_buf is then written from the IRQ thread on THC_RXDMA2_INT (touch input).
**Step 5.3: TRACE CALLEES**
Record: devm_kzalloc() only. Consumers: thc_rxdma_read() → sg_copy_to_buffer(); quickspi_handle_input_data().
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: quickspi_probe → IRQ THC_RXDMA2_INT → thc_rxdma_read(input_buf) → quickspi_handle_input_data. Reachable whenever an Intel THC HID-over-SPI touch device delivers a max-sized input or report-descriptor packet. Not a userspace-crafted syscall overflow; it is device-driven heap overflow on a common input path.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same class of bug in QuickI2C (HIDI2C_PACKET_LEN). Output SPI buffer already fixed by 6fcefe71aeb52. No other input_buf alloc in this driver.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes, at v6.18.57:
``` qsdev->input_buf = devm_kzalloc(qsdev->dev, max_input_len, GFP_KERNEL); ```
Driver exists from v6.15 through this 6.18.y tree. Bug introduced with the completed driver (4138f21115aec).
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply**. patch -p1 --dry-run against the v6.18.57 file succeeded. Surrounding function matches. Macro already present.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: Output-side header sizing (6fcefe71aeb52) is already in v6.18.57. Input-side overflow is **not** fixed at v6.18.57. No alternate input_buf fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: [HID / Intel THC QuickSPI] [IMPORTANT] — not core mm/net, but the HID-over-SPI path for Intel touch on MTL/LNL/PTL/ARL/WCL/NVL. Crash/overflow there takes down input on those machines.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained (device IDs, PM, DMA bounds). Still a small, contained driver, not a refactoring minefield.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific / config-specific (CONFIG_INTEL_QUICKSPI, X86_64 && PCI && ACPI). Users of Intel THC HID-over-SPI touch (Meteor Lake through Nova Lake PCI IDs in this tree).
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Device sends a HID-over-SPI body whose content length equals max_input_len or rep_desc_len. That is a normal max-size touch report / report-descriptor response, not an exotic error path. Unprivileged userspace cannot directly size the DMA packet; a malicious/buggy touch controller can. Trigger likelihood: **realistic on real hardware**.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Heap buffer overflow via sg_copy_to_buffer into devm_kzalloc memory. Typical overrun is 4 bytes; DMA max_packet_size is 4K-aligned, so a larger mes_len could copy more. Failure mode: heap corruption → oops/panic or memory corruption. Severity: **HIGH** (not a WARN-only issue).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record: Benefit **high** (stops heap overflow on touch RX). Risk **very low** (2 lines, +4 bytes, existing macro). Ratio strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real heap overflow: DMA copies header+payload into a payload-only buffer.
- Bug exists in this 6.18.57 tree; driver has been in-tree since v6.15.
- Important: kernel memory corruption / crash on a production Intel touch path.
- Tiny, obviously correct, uses HIDSPI_INPUT_BODY_SIZE already in this tree.
- Output buffer already got the analogous header sizing here; this completes the same invariant.
- Author is THC maintainer; HID maintainer applied v1 with no objections.
- Applies cleanly; no prerequisites missing.
AGAINST:
- No public crash report / syzbot (maintainer-found “potential” overflow).
- Affects only Intel THC QuickSPI, not all machines.
- Cover letter wording is “potential”; DMA copy confirms it is real.
UNRESOLVED:
- lore.kernel.org HTTP 403; discussion recovered via b4 dig -m.
- Stable list search unverified for the same 403 reason.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — 4-byte header included via existing macro; applied by HID maintainer.
2. Fixes a real bug that affects users? **PASS** — undersized input_buf vs DMA copy of full packets.
3. Important issue? **PASS** — heap overflow / memory corruption, HIGH.
4. Small and contained? **PASS** — +2/-1, one function, one file.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — clean apply to v6.18.57; macro present.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not an ID/quirk/DT/build/docs exception. It is a normal memory- safety fix.
**Step 9.4: MAKE YOUR DECISION**
Backport. The bug is in this tree, the fix is surgical, and the failure mode is heap overflow on the Intel QuickSPI input path.
---
## What the commit solves for this tree
On 6.18.57, quickspi_alloc_report_buf() sizes input_buf to the HID payload only. RX DMA later copies a full HIDSPI body (struct input_report_body_header + content) into that buffer. At max payload (or max report descriptor), that is at least a 4-byte heap overflow, and the DMA length check cannot catch it because hardware buffers are 4K-aligned. Touch IRQ handling is a normal path on Intel THC HID-over- SPI laptops.
The change allocates HIDSPI_INPUT_BODY_SIZE(max_input_len) instead. That matches how this tree already sizes the output buffer. No new API, no extra locking, no missing prerequisites.
Risk vs benefit: four extra bytes at probe vs heap corruption on input. Benefit dominates.
---
## Verification
- [Phase 1] Tags: Even Xu + Jiri Kosina SOBs; no Fixes/Reported-by/Cc:
stable (expected).
- [Phase 2] Diff: quickspi_alloc_report_buf() switches devm_kzalloc from max_input_len to HIDSPI_INPUT_BODY_SIZE(max_input_len) (+2/-1).
- [Phase 2] include/linux/hid-over-spi.h: HIDSPI_INPUT_BODY_SIZE = content + packed 4-byte header.
- [Phase 2] read_dma_buffer() copies mes_len into input_buf with only max_packet_size (ALIGN(..., SZ_4K)) as a cap.
- [Phase 3] git blame at v6.18.57: alloc from 4138f21115aec (v6.15+); still payload-only.
- [Phase 3] git merge-base --is-ancestor 4138f21115aec v6.18.57 → yes; 6fcefe71aeb52 already in v6.18.57 (output only).
- [Phase 3] Author Even Xu is MAINTAINERS THC driver maintainer.
- [Phase 4] b4 dig -c a1cdd72371270640bd357bd3e3b2ec0be17c9536: v1 series; Kosina applied to hid.git#for-7.3/upstream-fixes.
- [Phase 4] b4 dig -w: jikos, bentiss, linux-input CCd.
- [Phase 4] UNVERIFIED: live lore.kernel.org pages (HTTP 403); thread recovered from mbox.
- [Phase 5] Caller: quickspi_probe() → IRQ RXDMA2 → thc_rxdma_read(input_buf).
- [Phase 6] git describe HEAD / Makefile: **6.18.57**. Buggy line present at v6.18.57; HIDSPI_INPUT_BODY_SIZE present; patch --dry- run clean.
- [Phase 8] Failure mode: heap overflow on max-size HID-over-SPI input, severity HIGH.
- UNVERIFIED: whether this was already discussed on stable@ (lore 403).
**YES**
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +2 -1
@@ -549,7 +549,8 @@ static int quickspi_alloc_report_buf(struct quickspi_device *qsdev) max_input_len =max (le16_to_cpu (qsdev->dev_desc.rep_desc_len),le16_to_cpu (qsdev->dev_desc.max_input_len)); - qsdev->input_buf =devm_kzalloc (qsdev->dev, max_input_len,GFP_KERNEL ); + qsdev->input_buf =devm_kzalloc (qsdev->dev, +HIDSPI_INPUT_BODY_SIZE (max_input_len),GFP_KERNEL );if (!qsdev->input_buf)return -ENOMEM ;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] HID: Intel-thc-hid: Intel-quickspi: Fix buffer overflow
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] HID: quickspi: quickspi_alloc_report_buf() under-sizes input_buf for RXDMA - [Medium] HID…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] HID: quickspi: quickspi_alloc_report_buf() under-sizes input_buf for RXDMA
- [Medium] HID: intel-quickspi: quickspi_dma_init() omits header and rep_desc_len in DMA sizes --
commit 525db4dc56bd312030200280ce09472abe29a406
Author: Even Xu <[email protected]>
HID: Intel-thc-hid: Intel-quickspi: Fix buffer overflow
This commit expands the allocation of qsdev->input_buf in quickspi_alloc_report_buf() using HIDSPI_INPUT_BODY_SIZE() so that it accounts for the 4-byte HID-over-SPI input body header in addition to the maximum payload length.
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c static int quickspi_alloc_report_buf(struct quickspi_device *qsdev) · line 553
Quoted 11 lines
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +2
-1@@ -549,7 +549,8 @@ static int quickspi_alloc_report_buf(struct quickspi_device *qsdev) max_input_len =max (le16_to_cpu (qsdev->dev_desc.rep_desc_len),le16_to_cpu (qsdev->dev_desc.max_input_len)); - qsdev->input_buf =devm_kzalloc (qsdev->dev, max_input_len,GFP_KERNEL ); + qsdev->input_buf =devm_kzalloc (qsdev->dev, +HIDSPI_INPUT_BODY_SIZE (max_input_len),GFP_KERNEL );
[Severity: High]
Can qsdev->input_buf still be overflowed during RXDMA reads in thc_rxdma_read() -> read_dma_buffer()?
In quickspi_irq_thread_handler(), qsdev->input_buf is passed to thc_rxdma_read() before quickspi_handle_input_data() validates the packet:
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c:quickspi_irq_thread_handler() {
...
ret = thc_rxdma_read(qsdev->thc_hw, THC_RXDMA2, qsdev->input_buf,
&input_len, &read_finished);
if (ret) {
err_recover = 1;
goto end;
}
quickspi_handle_input_data(qsdev, input_len);
...
}However, dma_set_max_packet_size() rounds read_config->max_packet_size up to SZ_4K, and read_dma_buffer() only checks mes_len against read_config->max_packet_size before copying into read_buff (qsdev->input_buf):
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c:read_dma_buffer() {
...
prd_tbl = &read_config->prd_tbls[prd_table_index];
mes_len = calc_message_len(prd_tbl, &nent);
if (mes_len > read_config->max_packet_size) {
dev_err(dev->dev,
"Message length %zu is bigger than buffer length %lu\n",
mes_len, read_config->max_packet_size);
return -EMSGSIZE;
}
sg = read_config->sgls[prd_table_index];
ret = sg_copy_to_buffer(sg, nent, read_buff, mes_len);
...
}Because the HIDSPI input report header encodes input_report_len in 4-byte units (HIDSPI_INPUT_HEADER_REPORT_LEN with THC_UNIT_MICROFRAME_SIZE = 2), even a compliant device sending a report descriptor or maximum-sized input report whose length is not a multiple of 4 bytes produces a 4-byte-aligned DMA transfer that exceeds HIDSPI_INPUT_BODY_SIZE(max_input_len) by 1 to 3 bytes. Furthermore, any incoming SPI frame with mes_len between HIDSPI_INPUT_BODY_SIZE(max_input_len) and read_config->max_packet_size will be copied past the end of qsdev->input_buf before quickspi_handle_input_data() runs.
[Severity: Medium]
Also, should quickspi_dma_init() be updated to match the buffer sizes computed here in quickspi_alloc_report_buf()?
Right now, quickspi_dma_init() passes the raw max_input_len and max_output_len from dev_desc to thc_dma_set_max_packet_sizes():
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c:quickspi_dma_init() {
...
ret = thc_dma_set_max_packet_sizes(qsdev->thc_hw, 0,
le16_to_cpu(qsdev->dev_desc.max_input_len),
le16_to_cpu(qsdev->dev_desc.max_output_len),
0);
...
}Since QuickSPI receives both report descriptor responses and input reports over THC_RXDMA2, if HIDSPI_INPUT_BODY_SIZE(max(rep_desc_len, max_input_len)) exceeds ALIGN(max_input_len, SZ_4K) (for example, when max_input_len is at or within 3 bytes of a 4K boundary so adding the 4-byte header crosses into the next 4K page, or when rep_desc_len + 4 > ALIGN(max_input_len, SZ_4K)), won't the RXDMA2 scatterlist and max_packet_size be too small for the transfer? Similarly, THC_TXDMA omits HIDSPI_OUTPUT_REPORT_HEADER_SIZE and max_input_len (used for SET_FEATURE reports in qsdev->report_buf).
Quoted 3 lines
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +0
-0if (!qsdev->input_buf)return -ENOMEM ;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 wifi: cfg80211: include cf1 offset when sending chandef
In reply to Sasha LevinFrom: Lachlan Hodges <[email protected]>
[ Upstream commit 5a69b8dffd2a1b06e4cc4c9003c639eb78bac4cd ]
The cf1 offset is not included when sending the chandef leading to incorrect channel resolution in usermode. Include it.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject**
- Record: [wifi: cfg80211] [include] include cf1 offset when sending chandef
- Subsystem: cfg80211 / nl80211 (net/wireless/nl80211.c)
- Verb is “include”, not “fix”, but the body states a concrete userspace correctness bug.
**Step 1.2 — Tags**
- Record:
- Signed-off-by: Lachlan Hodges <[email protected]> (author)
- `Link: https://patch.msgid.link/20260721053958.227853-1-
[email protected]`
- Signed-off-by: Johannes Berg <[email protected]> (wireless maintainer apply)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence is expected and is not treated as a negative)
- Pattern: vendor S1G/HaLow developer (Morse Micro), applied same day by the subsystem maintainer. No syzbot/KASAN report.
**Step 1.3 — Body**
- Record:
- Bug: freq1_offset is omitted when nl80211 sends a chandef.
- Symptom: “incorrect channel resolution in usermode.”
- Failure mode: userspace reconstructs the operating-channel center from NL80211_ATTR_CENTER_FREQ1 (MHz) only, dropping the kHz remainder.
- Version info: none in the message.
- Root cause as stated: send path does not emit
`NL80211_ATTR_CENTER_FREQ1_OFFSET`.
**Step 1.4 — Hidden bug fix?**
- Record: Yes. “Include it” is a dump-path omission fix, not a cleanup. It restores the send side of an attribute the kernel has parsed since 2020.
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
- Record:
- File: net/wireless/nl80211.c (+4 / -0)
- Function: nl80211_send_chandef()
- Scope: single-file surgical fix
**Step 2.2 — Code flow**
- Record: After putting NL80211_ATTR_CENTER_FREQ1, the function now also puts NL80211_ATTR_CENTER_FREQ1_OFFSET when chandef->freq1_offset is non-zero. Same -ENOBUFS pattern as center_freq2 / punctured. Normal dump/event path, not an error- only path.
**Step 2.3 — Bug mechanism**
- Record: **Logic / ABI completeness.** Parse path already does:
chandef->freq1_offset = nla_get_u32_default(attrs[NL80211_ATTR_CENTER_FREQ1_OFFSET], 0) Send path already emits NL80211_ATTR_WIPHY_FREQ_OFFSET for the *control* channel, but never emitted the matching center-segment offset. Kernel identity comparison (cfg80211_chandef_identical) includes freq1_offset, so the kernel treats that field as part of the channel.
**Step 2.4 — Fix quality**
- Record: Obviously correct; 4 lines; mirrors existing nla_put style. Regression risk is very low: the attribute is already in uapi (since 2020), is optional, and is only sent when the offset is non-zero. Old userspace ignores unknown/unused attributes. No API or struct change.
## Phase 3: Git history
**Step 3.1 — Blame**
- Record: nl80211_send_chandef() dates to 2012 (683b6d3b31a519). Control-channel kHz offset send was added in 942ba88ba9c87 (2020-05-27, “nl80211: add KHz frequency offset for most wifi commands”). That commit added parse of NL80211_ATTR_CENTER_FREQ1_OFFSET into chandef->freq1_offset and send of WIPHY_FREQ_OFFSET, but not send of CENTER_FREQ1_OFFSET. The struct field itself was added in 934f4c7dd3a54 (2020-04-24, “cfg80211: express channels with a KHz component”). The omission has been present since the KHz ABI was introduced.
**Step 3.2 — Fixes: tag**
- Record: None. Closest introducer is 942ba88ba9c87 (verified present in this tree). No later conflicting rewrite of this hunk besides the candidate itself (5a69b8dffd2a1).
**Step 3.3 — File history**
- Record: Related completeness patch by the same author: 3fc830cd8c9d0 (“include s1g_primary_2mhz when sending chandef”). Standalone; not patch X/Y. No prerequisite refactor required for these four lines.
**Step 3.4 — Author**
- Record: Lachlan Hodges is a regular S1G/cfg80211 contributor (Morse Micro). Nearby work is S1G chandef validation and the in-tree mm81x HaLow driver (b1906cea00b02, 2026-07-08). Johannes Berg applied the patch.
**Step 3.5 — Dependencies**
- Record: Needs chandef->freq1_offset and NL80211_ATTR_CENTER_FREQ1_OFFSET. Both exist in this tree (2020). Applies standalone.
## Phase 4: Mailing list / external
**Step 4.1 — Original discussion**
- Record: b4 dig -c 5a69b8dffd2a1 → https://patch.msgid.link/202607210
[email protected]
- Series: v1 only (b4 dig -a). Subject: [PATCH wireless-next].
- Saved mbox (b4 dig -m): only the original submission; no replies, no NAK, no reviewer Cc: stable.
- UNVERIFIED: lore.kernel.org HTML/WebFetch returned 403 (Anubis). Discussion content is taken from the b4 mbox, not the HTML thread view.
**Step 4.2 — Recipients (b4 dig -w)**
- Record: Johannes Berg, linux-wireless, Arien Judge (Morse Micro). Maintainer was To: and applied the patch the same day.
**Step 4.3 — Bug report**
- Record: No syzbot/bugzilla link. Evidence of user impact is the Morse Micro author plus in-tree S1G hardware that uses 500 kHz offsets.
**Step 4.4 — Series**
- Record: Standalone v1. Not part of a multi-patch series.
**Step 4.5 — Stable list**
- Record: UNVERIFIED for lore.kernel.org/stable HTML (403). No stable discussion in the b4-matched wireless thread.
## Phase 5: Semantic / call-chain
**Step 5.1 — Functions**
- Record: nl80211_send_chandef() only.
**Step 5.2 — Callers (verified)**
- Record:
- nl80211_send_iface() — GET/NEW interface dump, including MLO links (iw / netlink dump)
- channel-switch notify (cfg80211_ch_switch_notify / started)
- cfg80211_incumbent_signal_notify
- DFS/radar notify
- cfg80211_nan_channel_evac
- mac80211_hwsim (exported symbol)
- Calling context: netlink dump and MLME multicast events. Userspace- reachable.
**Step 5.3 — Callees**
- Record: nla_put_u32() only for this hunk.
**Step 5.4 — Reachability**
- Record: Yes. Unprivileged dumps depend on nl80211 permissions, but any process that can GET_INTERFACE / receive MLME events sees the truncated center. S1G AP/STA userspace that round-trips a dumped chandef into SET_CHANNEL would restore freq1_offset = 0.
**Step 5.5 — Similar patterns**
- Record: Same send-path omission pattern as s1g_primary_2mhz. S1G frequencies are 902000 + chan * 500 kHz (ieee80211_channel_to_freq_khz). Morse mm81x channels are all freq_offset = 500 (902.5, 903.5, …). Non-zero freq1_offset is the common case for that hardware, not an edge case.
## Phase 6: This checkout
**Step 6.1 — Buggy code in this tree?**
- Record: Local tree is **7.3.0-rc4** (v7.3-rc4-27-gf0100363d8c37, Makefile VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4).
- nl80211_send_chandef, freq1_offset, and NL80211_ATTR_CENTER_FREQ1_OFFSET all exist here.
- Bug introduced with the 2020 KHz ABI (942ba88ba9c87 / 934f4c7dd3a54), long before this branch.
- Candidate 5a69b8dffd2a1 is an ancestor of HEAD (landed in 7.3-rc1). That is not used as a “already selected for stable” reason; it only confirms the code under review is this tree’s current nl80211_send_chandef.
**Step 6.2 — Backport difficulty**
- Record: Clean on this tree (the four-line hunk matches current code). Surrounding later fields (npca_*) are already present here; no rework needed *on this tree*.
**Step 6.3 — Other fixes already here?**
- Record: No alternate fix. This is the only send of CENTER_FREQ1_OFFSET in the tree (nla_put grep).
## Phase 7: Subsystem context
**Step 7.1**
- Record: net/wireless cfg80211/nl80211. Criticality: **IMPORTANT** (Wi-Fi uAPI; not mm/core, but the dump path is the userspace contract for every wireless interface).
**Step 7.2**
- Record: Actively developed (S1G, NPCA, MLO). The omission itself is old; S1G use of kHz offsets is what made it user-visible.
## Phase 8: Impact and risk
**Step 8.1 — Who is affected**
- Record: Config/driver-specific: S1G/HaLow and any chandef with non- zero freq1_offset. In this tree that includes mm81x and hwsim S1G. 2.4/5/6 GHz integer-MHz channels have freq1_offset == 0, so the new nla_put is skipped.
**Step 8.2 — Trigger**
- Record: Common for S1G: interface dump, channel switch, radar, NAN evac. Not a race. Userspace that reads nl80211 can trigger it; no exploit primitive verified.
**Step 8.3 — Failure mode**
- Record: Wrong operating-channel center in userspace (typically **500 kHz** on S1G, which is half of a 1 MHz channel). Kernel does not oops.
Severity: **MEDIUM** (connectivity / wrong-channel round-trip, not crash/corruption/UAF). Fits stable’s “oh, that’s not good” / real bug that bothers users of that hardware.
**Step 8.4 — Risk-benefit**
- Record: Benefit medium for S1G users (correct channel identity). Risk very low (4 lines, optional existing attribute, offset==0 is a no-op). Ratio favors taking it.
## Phase 9: Synthesis
**Step 9.1 — Evidence**
FOR:
- Real dump/event omission: parse has accepted CENTER_FREQ1_OFFSET since 2020; send never included it.
- S1G channel grid is 500 kHz; Morse mm81x channels all have freq_offset = 500.
- Kernel chandef identity includes freq1_offset; userspace cannot reconstruct it from CENTER_FREQ1 alone.
- Dump-then-set round-trip zeros the offset.
- 4-line, obviously correct, no new API.
- Maintainer (Johannes Berg) applied it; callers are standard nl80211 dump/event paths.
AGAINST:
- Not a crash, deadlock, UAF, or security issue.
- Submitted as wireless-next, not wireless fixes; no list review replies in the b4 mbox.
- Affects a narrower band (S1G/HaLow), not all Wi-Fi users.
UNRESOLVED:
- Full lore HTML (403). Stable-list search (403). Exact userspace (iw/hostapd) behavior not inspected in this repo.
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — 4 lines, same pattern as adjacent attributes; maintainer applied.
2. Real bug that affects users? **PASS** — S1G userspace gets the wrong operating center.
3. Important issue? **PASS** (medium) — wrong RF channel center on dump/events and on chandef round-trip; not a crash, but a user- visible correctness bug on in-tree HaLow hardware.
4. Small and contained? **PASS** — 4 lines, one function.
5. No new features/APIs? **PASS** — emits an existing uapi attribute.
6. Can apply to this tree? **PASS** — fields and function exist here.
**Step 9.3 — Exception category**
- Record: None of device-ID / quirk / DT / build / docs. Ordinary small correctness fix.
**Step 9.4 — Decision**
This tree is 7.3-rc4. The affected send path and freq1_offset exist here. The patch is a small, obviously correct fix for a real userspace channel-identity bug on S1G, with negligible regression risk. It meets the stable rules for this checkout.
### What the commit solvesnl80211_send_chandef() already reported the control frequency plus WIPHY_FREQ_OFFSET, but dropped chandef->freq1_offset for the operating center. Userspace then resolves center as an integer MHz value. On S1G that is systematically wrong by 500 kHz.
### Stable fit
Small, contained, no new API, real user-visible bug, low risk.
### Risk vs benefit
Benefit: correct channel dumps/events for S1G/HaLow. Risk: very low optional netlink attribute.
### Concerns
No crash report; vendor-driven; lore HTML unverified. None of those outweigh the verified omission and the 500 kHz S1G grid.
Verification:
- [Phase 1] Parsed tags: author Lachlan Hodges, Link msgid, SOB Johannes Berg; no Fixes/Reported-by/Cc-stable
- [Phase 2] Diff: +4 lines in nl80211_send_chandef() adding NL80211_ATTR_CENTER_FREQ1_OFFSET
- [Phase 3] git blame: send of WIPHY_FREQ_OFFSET from 942ba88ba9c87 (2020); this hunk from 5a69b8dffd2a1
- [Phase 3] git log -S 'u16 freq1_offset' -- include/net/cfg80211.h:
field added in 934f4c7dd3a54 (2020)
- [Phase 3] Parse path already reads CENTER_FREQ1_OFFSET at nl80211.c:4006–4007
- [Phase 3] git merge-base --is-ancestor 5a69b8dffd2a1 HEAD → yes (inspection only)
- [Phase 4] b4 dig -c/-a/-w/-m: v1 wireless-next, no replies in mbox;
To: Johannes
- [Phase 4] WebFetch/curl lore: 403 Anubis — UNVERIFIED HTML thread
- [Phase 5] Callers: iface dump, CSA, radar, NAN, hwsim
- [Phase 5] S1G freq: 902000 + chan * 500; mm81x channels all offset 500
- [Phase 5] cfg80211_chandef_identical compares freq1_offset
- [Phase 6] git describe HEAD / make kernelversion: 7.3.0-rc4; buggy pattern exists; attr/field present
- [Phase 8] Failure mode: wrong userspace channel center (typically 500 kHz), severity MEDIUM
- UNVERIFIED: stable@ lore discussion; iw/hostapd source handling of the attribute
**YES**
net/wireless/nl80211.c | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/nl80211.c +4 -0
@@ -4260,6 +4260,10 @@ int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chreturn -ENOBUFS ;if (nla_put_u32 (msg,NL80211_ATTR_CENTER_FREQ1 , chandef->center_freq1))return -ENOBUFS ; +if (chandef->freq1_offset && +nla_put_u32 (msg,NL80211_ATTR_CENTER_FREQ1_OFFSET , + chandef->freq1_offset)) +return -ENOBUFS ;if (chandef->center_freq2 &&nla_put_u32 (msg,NL80211_ATTR_CENTER_FREQ2 , chandef->center_freq2))return -ENOBUFS ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 gpio: sifive: add missing MODULE_DEVICE_TABLE()
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 8fe6fa0f223f44b8b869319d1b9c383749aa147b ]
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:
I have the local-tree identity, the one-line diff, and the mailing-list thread, including the GPIO maintainer asking for a Fixes:/Cc: stable resend. Compiling the nine-phase verdict next.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Record: [gpio] [add] add missing MODULE_DEVICE_TABLE() so OF module aliases are generated
**Step 1.2: Tags**
- Record:
- Fixes: — none (expected)
- Reported-by: — none
- Tested-by: — none
- Reviewed-by: — none on the applied commit
- Acked-by: — none
- `Link: https://patch.msgid.link/20260704122230.75964-1-
[email protected]`
- Cc: [email protected] — none (expected)
- Signed-off-by: Pengpeng Hou <[email protected]> (author)
- Signed-off-by: Bartosz Golaszewski <[email protected]> (GPIO maintainer, committer)
- Notable: no syzbot, no user crash report. Maintainer SOB is a quality signal.
**Step 1.3: Body**
- Record: **Bug:** sifive_gpio_match[] is wired to .of_match_table but not published via MODULE_DEVICE_TABLE(), so modpost does not emit OF aliases. **Symptom:** gpio-sifive.ko does not autoload from DT compatible strings (sifive,gpio0, sifive,fu540-c000-gpio). **Version info:** none in the message. **Root cause:** missing module- alias publication, not a runtime logic error in probe. The “source- level fix / no dynamic hardware reproduction” wording is extra justification, not a different bug.
**Step 1.4: Hidden bug fix?**
- Record: Not hidden. This is an explicit autoload fix. “Add missing MODULE_DEVICE_TABLE” is a standard class of real functional bugs for tristate OF drivers.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- Record: drivers/gpio/gpio-sifive.c — **+1 / -0**. One insertion after sifive_gpio_match[]. No functions changed. **Scope:** single- file surgical fix.
**Step 2.2: Code flow**
- Record: **Before:** OF match table exists and is used by platform_driver.driver.of_match_table, so a *already loaded* driver still binds. No __mod_device_table__* alias is emitted, so kmod/udev cannot load the module from DT. **After:** MODULE_DEVICE_TABLE(of, sifive_gpio_match) creates a used alias to that table; scripts/mod/file2alias.c (do_of_entry) emits of:N*T*Csifive,gpio0 / sifive,fu540-c000-gpio aliases. **Path affected:** build-time modpost / userspace autoload only. Probe and IRQ setup are unchanged.
**Step 2.3: Bug mechanism**
- Record: **Category:** hardware enablement / missing module alias (logic/correctness at the module-loading boundary). **Mechanism:** CONFIG_GPIO_SIFIVE=m never autoloads; GPIO controller stays unbound unless modprobe is done by hand. Same class as device-ID additions:
existing driver, existing hardware, missing match publication.
**Step 2.4: Fix quality**
- Record: Obviously correct one-liner; this is the documented way to export OF aliases. No locking, no API, no data-structure change. **Regression risk:** negligible. For =y it is a no-op at runtime. No new userspace ABI beyond standard modules.alias entries.
## Phase 3: Git history
**Step 3.1: Blame**
- Record: Match table introduced in 96868dce644d0 (“gpio/sifive: Add GPIO driver for SiFive SoCs”, 2019; in v5.5-rc4). Originally bool
+ builtin_platform_driver(), so MODULE_DEVICE_TABLE was not required. Bug became real in 6b4c76ded35826 (“gpio: sifive: Allow building the driver as a module”, 2023-07-25) which switched Kconfig to tristate and module_platform_driver() **without** adding MODULE_DEVICE_TABLE. That commit is in v6.6-rc1 and later. of_match_table = sifive_gpio_match confirmed via blame (6ae42529547a4f dropped of_match_ptr in 2023).
**Step 3.2: Fixes: tag**
- Record: No Fixes: on the candidate. The implicit Fixes target is 6b4c76ded35826, which **is** an ancestor of this tree (git merge- base --is-ancestor succeeded). GPIO maintainer Bartosz said the same on list (Phase 4).
**Step 3.3: File history**
- Record: Recent gpio-sifive.c work is generic-chip API (8e1c8ccc1df8b) and the modular conversion. No prerequisite series for this one line. Standalone.
**Step 3.4: Author**
- Record: Pengpeng Hou is not the GPIO maintainer; same-day sibling 975a1d61260cf (“gpio: vf610: add missing MODULE_DEVICE_TABLE()”). Samuel Holland (SiFive, author of the modular conversion) sent the identical one-line change earlier (Oct 2025) as “Support module autoloading”.
**Step 3.5: Dependencies**
- Record: Needs sifive_gpio_match[], module_platform_driver(), and MODULE_DEVICE_TABLE(of, ...). All exist in this checkout. Applies standalone.
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**
- Record: b4 dig -c 8fe6fa0f223f44 matched patch-id to:
- v1 (applied):
https://patch.msgid.link/[email protected] (2026-07-04, Pengpeng Hou) - Same diff, earlier: https://patch.msgid.link/20251016003631.3912523- [email protected] (2025-10-15, Samuel Holland)
- Single revision of Pengpeng’s patch. Bartosz: “Applied, thanks!” (2026-07-06). No NAK.
- On Samuel’s earlier post, Bartosz wrote it should have been part of 6b4c76ded358 and asked him to **resend with Fixes: and `Cc:
stable`**. That resend did not land; Pengpeng’s later patch (without those tags) was applied instead.
**Step 4.2: Recipients (b4 dig -w)**
- Record: Pengpeng Hou, Linus Walleij, Bartosz Golaszewski, Paul Walmsley, Samuel Holland, linux-gpio, linux-riscv, linux-kernel. GPIO maintainers were on To/Cc.
**Step 4.3: Bug report**
- Record: No syzbot/bugzilla. Evidence is source-level plus vendor (SiFive) sending the same patch. No count of field reports.
**Step 4.4: Series**
- Record: Standalone 1/1. Sibling vf610 fix is a separate driver, not a dependency.
**Step 4.5: Stable list**
- Record: lore.kernel.org via WebFetch returned 403. Stable-list search **UNVERIFIED** by HTTP. Maintainer request for Cc: stable is from linux-gpio mbox, not from stable@.
## Phase 5: Semantic analysis
**Step 5.1: Functions**
- Record: No functions modified. Added MODULE_DEVICE_TABLE(of, sifive_gpio_match) after sifive_gpio_match[]. Related symbols:
sifive_gpio_probe, sifive_gpio_driver.
**Step 5.2: Callers**
- Record: sifive_gpio_probe is the platform .probe. Driver core calls it when OF compatible matches **and the module is already loaded**. Autoload is userspace (kmod) using aliases from MODULE_DEVICE_TABLE. Not IRQ/hot-path.
**Step 5.3: Callees**
- Record: Unchanged. Probe still uses generic GPIO + irqchip registration.
**Step 5.4: Reachability**
- Record: Reachable on SiFive FU540/FU740 and Canaan K210 DT (compatible = "sifive,gpio0" / "sifive,fu540-c000-gpio").
Userspace-visible: without aliases, GPIO never appears unless the module is forced. Not a syscall crash path.
**Step 5.5: Similar patterns**
- Record: Same pattern in-tree: gpio: lpc32xx: fix module autoloading, gpio: modepin: Enable module autoloading, gpio: vf610: add missing MODULE_DEVICE_TABLE(), gpio: cadence: Add missing MODULE_DEVICE_TABLE. Established GPIO-subsystem practice.
## Phase 6: Local tree (this checkout only)
**Step 6.1: Buggy code in this tree?**
- Record: Checkout is **Linus origin/master**, git describe = v7.3-rc4-27-gf0100363d8c37, Makefile **7.3.0-rc4**. gpio-sifive.c, sifive_gpio_match[], tristate GPIO_SIFIVE, and module_platform_driver() are all present. Modular conversion 6b4c76ded35826 is an ancestor. The one-line alias export belongs on this code. In-tree DT: arch/riscv/boot/dts/sifive/fu540-c000.dtsi, fu740-c000.dtsi, arch/riscv/boot/dts/canaan/k210.dtsi. Defconfigs (arch/riscv/configs/defconfig, K210 defconfigs) set CONFIG_GPIO_SIFIVE=y, so *default* RISC-V configs do not hit autoload; =m (the reason the driver was made modular: multiplatform image size) does.
**Step 6.2: Backport difficulty**
- Record: Clean apply. Only needs the of_device_id table name sifive_gpio_match. No conflict with later generic-chip changes.
**Step 6.3: Related fixes already here**
- Record: No earlier alternate autoload fix. This is the first MODULE_DEVICE_TABLE on this file.
## Phase 7: Subsystem context
**Step 7.1**
- Record: **Subsystem:** GPIO (drivers/gpio/). **Criticality:** IMPORTANT for SiFive/K210 boards (GPIO is a board-level dependency), PERIPHERAL vs core mm/net. Not staging.
**Step 7.2**
- Record: GPIO is actively maintained (Bartosz). This driver is mature (since v5.5); the modular hole is from v6.6, not new experimental code.
## Phase 8: Impact and risk
**Step 8.1: Who is affected**
- Record: Driver-specific, config-specific: CONFIG_GPIO_SIFIVE=m on DT platforms with those compatibles. Not universal.
**Step 8.2: Trigger**
- Record: Boot / device enumeration with the module not preloaded. Common for multiplatform modular kernels (the stated goal of 6b4c76ded358). Unprivileged users do not trigger a crash; the controller simply never binds. Not a race.
**Step 8.3: Failure mode**
- Record: GPIO chip (and its irqchip) never registers if the module is not loaded. Dependent LEDs, resets, keys, hog lines fail. **Severity:
MEDIUM** functionally (hardware dead until modprobe), not panic/UAF. For those boards that is user-visible breakage, not cosmetic.
**Step 8.4: Risk-benefit**
- Record: **Benefit:** high for =m SiFive/K210 users; restores the modular conversion’s purpose. **Risk:** very low (1 line, build-time alias only). **Ratio:** strongly favorable. Matches the device-ID / hardware-enablement exception.
## Phase 9: Synthesis
**Step 9.1: Evidence**
- **For:** Real autoload bug; 1-line obviously correct; GPIO maintainer asked for Fixes: + Cc: stable on the identical diff; SiFive engineer sent that diff; driver is tristate since v6.6; DT hardware exists; zero runtime regression surface; same pattern already used across GPIO.
- **Against:** Not a crash/security/corruption issue; in-tree defconfigs use =y; no Reported-by; Pengpeng’s applied patch omitted the Fixes:/Cc: stable Bartosz asked for.
- **Unresolved:** Stable-list archive (lore HTTP 403). No field bugzilla count.
**Step 9.2: Stable rules**
1. Obviously correct and tested? **PASS** — canonical MODULE_DEVICE_TABLE(of, …); maintainer applied it.
2. Real bug affecting users? **PASS** — =m never autoloads; modular conversion is pointless without it.
3. Important (crash/security/corruption/deadlock)? **PASS** as hardware- enablement (GPIO controller never binds), same bar as new device IDs / missing aliases — not a panic, but the device does not work.
4. Small and contained? **PASS** — +1 line, one file.
5. No new features/APIs? **PASS** — aliases for existing compatibles.
6. Can apply to this tree? **PASS** — table, tristate Kconfig, and module_platform_driver() are here.
**Step 9.3: Exception category**
- Record: Closest to **device ID / hardware enablement**: publishing existing OF IDs so the existing driver autoloads. Not a new driver or API.
**Step 9.4: Decision**
This tree has the SiFive GPIO driver as a module-capable OF platform driver with a match table that was never exported. That is a real, contained autoload bug. The GPIO maintainer already treated the identical change as stable material. It should be backported here.
### What the commit solves for this tree
Without MODULE_DEVICE_TABLE(of, sifive_gpio_match), modpost never writes OF aliases, so gpio-sifive.ko will not load from "sifive,gpio0" / "sifive,fu540-c000-gpio". On CONFIG_GPIO_SIFIVE=m the GPIO (and irq) controller never appears unless someone modprobes it. That undercuts 6b4c76ded358 (“Allow building the driver as a module”) on multiplatform kernels. Built-in =y is unaffected; the one- liner is still correct and harmless.
### Risk vs benefit
Benefit is restoring autoload for real FU540/FU740/K210 hardware when the driver is modular. Risk is a single build-time alias with no probe/locking/API change.
### Concerns
No Fixes: on the applied commit (should be 6b4c76ded35826); that does not block backport. In-tree defconfigs use =y, so default images already work; the users who need this are modular/multiplatform configs, which is exactly who the tristate change was for.
Verification:
- [Phase 1] Parsed tags: Link to msgid [email protected]; SOB Pengpeng Hou and Bartosz Golaszewski; no Fixes/Reported-by/Cc: stable
- [Phase 2] Diff: +1 line MODULE_DEVICE_TABLE(of, sifive_gpio_match) in drivers/gpio/gpio-sifive.c; probe unchanged
- [Phase 2] Confirmed MODULE_DEVICE_TABLE in include/linux/module.h and OF alias emission via scripts/mod/file2alias.c do_of_entry
- [Phase 3] git blame: match table from 96868dce644d0 (v5.5-rc4); modular bug from 6b4c76ded35826 (in v6.6-rc1); git merge-base --is- ancestor 6b4c76ded35826 HEAD succeeded
- [Phase 3] git show 6b4c76ded35826: bool→tristate + builtin_platform_driver → module_platform_driver without MODULE_DEVICE_TABLE
- [Phase 3] Author log: sibling vf610 commit 975a1d61260cf
- [Phase 4] b4 dig -c 8fe6fa0f223f44: Pengpeng v1 applied; same patch- id as Samuel Holland Oct 2025
- [Phase 4] b4 dig -a: single Pengpeng revision; b4 dig -w: GPIO maintainers + linux-gpio/linux-riscv
- [Phase 4] mbox: Bartosz asked Samuel for Fixes: + Cc: stable; later “Applied, thanks!” on Pengpeng’s patch
- [Phase 4] WebFetch lore.kernel.org: 403 — UNVERIFIED via HTTP; thread recovered with b4 mbox
- [Phase 5] Callers: platform probe + OF match table; autoload is userspace/kmod, not a kernel hot path
- [Phase 5] Similar GPIO autoload fixes: 11baa36d31732, a5135526426df, e6382fcf98907
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4; detached origin/master
- [Phase 6] Kconfig GPIO_SIFIVE is tristate; DT nodes present; defconfigs use =y
- [Phase 8] Failure mode: module not autoloaded → GPIO controller absent; severity MEDIUM functional / hardware-enablement
- UNVERIFIED: whether this exact commit was discussed on [email protected] (lore HTTP 403)
- UNVERIFIED: how many distro configs set CONFIG_GPIO_SIFIVE=m
**YES**
drivers/gpio/gpio-sifive.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-sifive.c +1 -0
@@ -260,6 +260,7 @@ static const struct of_device_id sifive_gpio_match[] = { { .compatible = "sifive,fu540-c000-gpio" }, { }, }; +MODULE_DEVICE_TABLE (of, sifive_gpio_match);static struct platform_driver sifive_gpio_driver = { .probe = sifive_gpio_probe,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nvme: handle positive error codes in nuse_show()
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit dd516cd7624648c71d338d99368587f10ecc9f0b ]
Function __nvme_submit_sync_cmd() returns a positive error code for NVMe errors. Otherwise, we get 0 for success or a negative error code for a kernel error.
In nuse_show() -> ns_{head}_update_nuse() -> nvme_identify_ns() -> nvme_submit_sync_cmd() -> __nvme_submit_sync_cmd(), we then may get a positive error code returned.
Function nuse_show() - being a device attr handler - should return the number of bytes written to the buffer or a negative error code.
Convert any positive NVMe error code to -EIO.
---
LLM Generated explanations, may be completely bogus:
I have the mailing-list thread and the sysfs/NVMe return-code path. Next I’ll confirm how a positive NVMe status is treated as a byte count, then give the backport verdict for this tree.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [nvme] [handle] convert positive NVMe status codes from nuse_show() into a proper sysfs errno
- Subsystem: nvme (host sysfs)
- Verb: handle (bug-fix language: incorrect error handling)
- Intent: sysfs nuse show must not return a positive NVMe status as a “bytes written” count
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Fixes: — absent (expected for this review pipeline)
- Reported-by: — none
- Tested-by: — none
- Reviewed-by: Christoph Hellwig <[email protected]> (core NVMe reviewer)
- Acked-by: — none
- Link: — none in the commit; lore found separately
- Cc: [email protected] — absent (not a negative signal)
- Signed-off-by: John Garry <[email protected]> (author)
- Signed-off-by: Keith Busch <[email protected]> (NVMe maintainer; applied to nvme-7.3)
- Ignore pipeline Signed-off-by: Sasha Levin if present — not in this commit
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** __nvme_submit_sync_cmd() returns 0, a negative Linux errno, or a **positive NVMe status**. That value is propagated nuse_show() → ns_{head}_update_nuse() → nvme_identify_ns() → nvme_submit_sync_cmd().
- **Symptom:** nuse_show() is a device attribute handler; it must return a byte count or a negative errno. A positive NVMe status is neither.
- **Fix:** map ret > 0 to -EIO; keep ret < 0 as-is.
- **Version info in message:** none. Feature itself dates to v6.8 (a1a825ab6a603 “nvme: add csi, ms and nuse to sysfs”).
- **Root cause:** treating any non-zero ret as a sysfs error, which is wrong for positive NVMe codes (they are not negative, so they were returned as a success length).
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. Explicit error-handling fix. Same class as “add missing check” / “handle X properly.”
---
## PHASE 2: DIFF ANALYSIS - LINE BY LINE
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/nvme/host/sysfs.c — **+3 / −1**
- Function: nuse_show() only
- Scope: **single-file surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** if (ret) return ret; — negative errno returned correctly; **positive NVMe status returned as the sysfs byte count**, and sysfs_emit() is skipped so the buffer is never filled with the NUSE value.
- **After:** ret < 0 → pass through; ret > 0 → -EIO; ret == 0 → sysfs_emit() of head->nuse.
- Path affected: **error path** of a sysfs read that issues Identify Namespace (rate-limited).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** logic/correctness of sysfs error conversion; can also trip a kernel WARN.
- **Mechanism:** NVMe completion status is stored as le16_to_cpu(cqe->status) >> 1 (nvme_try_complete_req()). nvme_execute_rq() returns that value when non-zero. Status often includes NVME_STATUS_DNR (**0x4000 = 16384**).
- Sysfs (sysfs_kf_seq_show in fs/sysfs/file.c):
- count < 0 → error
- count >= PAGE_SIZE → **WARN(1, "OOB write or bad count ...")** then clamp
- otherwise seq_commit(sf, count) of a buffer that was memset to 0 but never written by nuse_show()
- On 4K pages (typical x86_64), DNR-tagged Identify failures (status | 0x4000 >= 16384 > 4096) **fire a kernel WARN**. Smaller statuses become a short successful read of zeros instead of -EIO.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: matches __nvme_submit_sync_cmd() contract and the existing nvme_hwmon pattern (if (ret > 0) return -EIO).
- Minimal; no unrelated edits; no API/struct changes.
- Regression risk **very low**: only the misclassified success path becomes -EIO, which is the intended ABI.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Buggy if (ret) return ret; introduced in **a1a825ab6a603** (Daniel Wagner, 2023-12-18), “nvme: add csi, ms and nuse to sysfs”.
- First appeared: **v6.8-rc1** (git describe --contains → v6.8-rc1~121^2~25^2~4).
- Present for a long time in this 7.3 lineage.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Buggy commit identified by blame:a1a825ab6a603. That commit **is** an ancestor of this tree.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- 8d0d2447394b1 — double-free of nvme_id_ns in ns_update_nuse() (already in tree; different bug).
- 88c918d1ee2c88 — nvme_disk_is_ns_head() use in nuse_show.
- Standalone v1 patch; not “patch X/Y”.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: John Garry is an active NVMe/block contributor (cdev lifetime, multipath, sysfs). Nearby commits are unrelated lifetime/locking work, not prerequisites of this hunk.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. Touches only nuse_show() control flow. nuse_show, ns_update_nuse, ns_head_update_nuse, and nvme_identify_ns all exist here. **Applies standalone.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c dd516cd762464 → https://patch.msgid.link/20260630102717.26
[email protected]
- **v1 only** (no v2/v3). Applied as submitted.
- Author note: could print nvme_get_error_status_str(); rejected as a bad idea (keeps the fix small).
- Christoph: “Looks good:” + Reviewed-by
- Keith Busch: “Thanks, applied to nvme-7.3.”
- No NAKs, no stable nomination, no risk flags.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc **[email protected], [email protected], [email protected], [email protected], [email protected]**. Right maintainers; Hellwig reviewed; Busch applied.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by, syzbot, or bugzilla. Found by code inspection of the Identify → sysfs return path. Still a real, reachable bug (sysfs read issues Identify NS).
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone single patch. Same conversion already used in drivers/nvme/host/hwmon.c.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: Direct lore stable search was blocked (bot/403). Thread mbox has **no** Cc: stable and no stable-list discussion. **UNVERIFIED** whether anyone later asked for it on stable@ — does not change the technical verdict.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: nuse_show (modified). Callers of the bad return:ns_head_update_nuse, ns_update_nuse → nvme_identify_ns → nvme_submit_sync_cmd → __nvme_submit_sync_cmd → nvme_execute_rq.
**Step 5.2: TRACE CALLERS**
Record: nuse_show is DEVICE_ATTR_RO(nuse) (0444) on the NVMe namespace disk. Reachable from userspace read() of /sys/block/nvmeXnY/nuse. Documented in Documentation/ABI/stable/sysfs-nvme; used so libnvme need not issue Identify itself. **Not** IRQ/hot-path; process context, admin command.
**Step 5.3: TRACE CALLEES**
Record: Identify Namespace (admin), SRCU in the multipath helper, rate limit 5s. On Identify failure, nvme_identify_ns() kfree’s the id buffer and returns the status — no leak there.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: userspace read → sysfs/kernfs → nuse_show → Identify NS. **Unprivileged users can trigger it** (world-readable). Failure of Identify is uncommon on a healthy live NS, but expected during reset, path loss, unmap, or device errors — exactly when libnvme/nvme-cli may still read nuse.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same if (ret > 0) return -EIO in nvme_get_temp_thresh / nvme_set_temp_thresh (hwmon.c). Other nuse_show-style sysfs readers in this file mostly format cached fields and do not submit commands.
---
## 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**
- nuse_show exists in drivers/nvme/host/sysfs.c
- Bug introduced **v6.8** (a1a825ab6a603); **is** ancestor of HEAD
- Candidate **dd516cd762464 is already an ancestor of HEAD** (evaluate on merit, not “already selected”)
- Current file already contains the ret < 0 / ret > 0 logic
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** on this tree (hunk matches current nuse_show). No conflicting refactor of this function beyond the fix itself.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: Double-free fix 8d0d2447394b1 is present and orthogonal. No alternate conversion of positive NVMe status in nuse_show besides this commit.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **NVMe host sysfs** (drivers/nvme/host/). Criticality:
**IMPORTANT** (common storage stack; not mm/VFS core). Affects NVMe users who read namespace sysfs (management tools).
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively developed (many recent sysfs/diag/timeout patches). nuse itself is mature (since 6.8), not brand-new 7.3-only code.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver-specific** — NVMe namespace sysfs. Anyone with CONFIG_BLK_DEV_NVME (default on most distros) and a namespace. Tools:
libnvme / nvme-cli discovery.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- Trigger: read of /sys/block/nvmeXnY/nuse while Identify NS returns a **non-zero NVMe status** (and the 5s ratelimit allows a command).
- Uncommon on a healthy device; realistic on reset, interconnect errors, or a controller that fails Identify.
- Unprivileged readable (DEVICE_ATTR_RO = 0444).
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- DNR (or any status ≥ PAGE_SIZE): **kernel WARN** in sysfs_kf_seq_show (“OOB write or bad count”) — **HIGH** (WARNING; panic if panic_on_warn).
- Smaller status: successful short read of zeros instead of an error — **MEDIUM** (wrong ABI; tools may treat NUSE as 0 or fail to parse).
- Not UAF, not filesystem corruption, not a hard deadlock.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** medium–high — stops a real WARN and a bogus sysfs success on a widely deployed driver.
- **Risk:** very low — 3 lines, error path only, established -EIO mapping.
- **Ratio:** favorable.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR backporting**
- Real bug: sysfs show returns a positive NVMe status as a byte count.
- Can WARN when status includes NVME_STATUS_DNR (0x4000) on 4K/16K pages.
- Userspace can get a successful empty/short read instead of an error.
- 3-line, obviously correct; Hellwig reviewed; Busch applied.
- Same pattern already used in NVMe hwmon.
- Code and bug exist in this 7.3 tree (since v6.8).
- No new API/feature; no series dependencies.
**AGAINST backporting**
- No user/syzbot report; found by inspection.
- Identify NS rarely fails on a live healthy namespace.
- Not a UAF/panic/data-corruption class bug in the common success path.
**UNRESOLVED**
- Stable@ archives could not be fetched (403/bot). No evidence of a prior rejection.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — reviewed by Hellwig, applied by Busch, matches documented return contract.
2. Fixes a real bug that affects users? **PASS** — wrong sysfs return; WARN on DNR Identify failures.
3. Important issue? **PASS** — WARN_ON-class (and wrong userspace ABI). Severity HIGH for the WARN path, MEDIUM otherwise.
4. Small and contained? **PASS** — +3/−1, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — nuse_show present; hunk matches.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. Ordinary small driver bugfix.
**Step 9.4: MAKE YOUR DECISION**
This tree is **7.3.0-rc4**. The nuse sysfs attribute exists here. A positive NVMe Identify status must not be returned as a sysfs byte count; that can WARN and confuse management tools. The patch is tiny, already the established NVMe conversion, and has maintainer review. Benefit outweighs risk.
### What the commit solves for this tree
nuse_show() refreshes Namespace Utilization via Identify NS. Command errors come back as **positive** NVMe status. Returning that from a DEVICE_ATTR_RO show handler makes kernfs treat it as a length: zeros to userspace, or a **sysfs “bad count” WARN** when the status is ≥ PAGE_SIZE (typical with DNR). Mapping ret > 0 to -EIO restores the sysfs contract.
### Risk vs benefit
Very low risk, clear correctness win on a user-visible NVMe sysfs file.
---
## Verification
- **[Phase 1]** Parsed message: no Fixes/Reported-by/stable Cc; Reviewed-by Hellwig; SOB Garry + Busch.
- **[Phase 2]** Diff: +3/−1 in nuse_show() only; if (ret) → ret < 0 / ret > 0 → -EIO.
- **[Phase 2]** __nvme_submit_sync_cmd() comment and nvme_execute_rq(): positive value is NVMe status (nvme_req(rq)->status).
- **[Phase 2]** nvme_try_complete_req(): rq->status = le16_to_cpu(status) >> 1; NVME_STATUS_DNR = 0x4000.
- **[Phase 2]** fs/sysfs/file.c sysfs_kf_seq_show: count >= PAGE_SIZE → WARN(1, "OOB write or bad count").
- **[Phase 2]** Same conversion in drivers/nvme/host/hwmon.c lines 31–32 and 54–55.
- **[Phase 3]** Blame: buggy if (ret) from a1a825ab6a603 (v6.8); fix is dd516cd762464.
- **[Phase 3]** git merge-base --is-ancestor a1a825ab6a603 HEAD — yes; dd516cd762464 also ancestor.
- **[Phase 3]** Related: 8d0d2447394b1 double-free in ns_update_nuse — different bug, already here.
- **[Phase 3]** Author log: standalone; not a multi-patch series.
- **[Phase 4]** b4 dig -c dd516cd762464: lore msgid [email protected].
- **[Phase 4]** b4 dig -a: v1 only.
- **[Phase 4]** b4 dig -w: linux-nvme + Hellwig, Busch, Grimberg, Axboe.
- **[Phase 4]** mbox: Hellwig “Looks good”; Busch “applied to nvme-7.3”; no NAK.
- **[Phase 4]** WebFetch lore/stable: 403/bot — UNVERIFIED stable@ traffic.
- **[Phase 5]** semcode MCP not available; used grep. Callers: sysfs RO attr nuse.
- **[Phase 5]** ABI: /sys/block/nvmeXnY/nuse since 6.8; Identify on read; DEVICE_ATTR_RO → 0444.
- **[Phase 6]** git describe HEAD: v7.3-rc4-27-gf0100363d8c37; kernelversion 7.3.0-rc4.
- **[Phase 6]** Current nuse_show already has the fix; buggy pattern exists in history of this file.
- **[Phase 8]** Failure: WARN (HIGH) or bogus short sysfs read (MEDIUM); trigger = Identify NS error on nuse read.
The fix is small, surgical, and meets the stable criteria for this tree.
**YES**
drivers/nvme/host/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/sysfs.c +3 -1
@@ -239,8 +239,10 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr, ret =ns_head_update_nuse (head); else ret =ns_update_nuse (disk->private_data); -if (ret) +if (ret <0 )return ret; +else if (ret >0 ) +return -EIO ;return sysfs_emit (buf,"%llu\n" , head->nuse); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 RDMA/efa: Add EFA 0xefa4 PCI ID
In reply to Sasha LevinFrom: Anas Mousa <[email protected]>
[ Upstream commit 6a57af838b1a56405a9bde9030de16df901ae2ca ]
Add support for 0xefa4 devices.
---
LLM Generated explanations, may be completely bogus:
This is a two-line PCI ID addition to the existing Amazon EFA RDMA driver. That matches the stable-tree device-ID exception, and the local 7.3-rc4 tree already has the driver and ID table.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Subsystem: RDMA/efa
- Action verb: **Add**
- Claimed intent: register PCI device ID 0xefa4 so the in-tree EFA driver binds new Amazon Elastic Fabric Adapter hardware.
Record: [RDMA/efa] [add] [PCI ID 0xefa4 for next-gen EFA VF]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Reviewed-by: Michael Margolin <[email protected]> (Amazon EFA contributor; 20 commits in this driver)
- Signed-off-by: Anas Mousa <[email protected]> (author)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Leon Romanovsky <[email protected]> (RDMA maintainer, committer)
- No Fixes: tag (expected)
- No Cc: [email protected] (expected)
- No Reported-by:, Tested-by:, Acked-by:
- Ignore any pipeline Signed-off-by: Sasha Levin / [Upstream commit ...] markers (none in the real commit)
Record: Maintainer-applied PCI ID patch; Amazon internal review; lore link present; no syzbot/bug report (not applicable).
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Body is one sentence: “Add support for 0xefa4 devices.” Cover letter (mbox): “Make a minor device interface change needed for new EFA devices and enable support for 0xefa4 PCI ID.” No crash, no reproducer — this is hardware enablement.
Record: [Bug description: none — new PCI ID] [Symptom: 0xefa4 adapters unbound / unused by in-tree efa] [Version info: none] [Root cause: ID missing from pci_device_id table]
**Step 1.4: DETECT HIDDEN BUG FIXES**
Not a disguised leak/race/UAF fix. It is exactly a device-ID addition.
Record: [Not a hidden bug fix. Explicit PCI ID enablement.]
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- File: drivers/infiniband/hw/efa/efa_main.c — **+2 / -0**
- #define PCI_DEV_ID_EFA4_VF 0xefa4
- { PCI_VDEVICE(AMAZON, PCI_DEV_ID_EFA4_VF) } in efa_pci_tbl[]
- Scope: single-file surgical ID addition
Record: [efa_main.c +2] [pci_device_id table] [surgical single-file]
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Before: PCI core matches Amazon vendor 0x1d0f with IDs 0xefa0–0xefa3 only. 0xefa4 is ignored (no probe).
After: 0xefa4 matches efa_pci_driver, efa_probe() runs the same path as older generations.
efa_probe(struct pci_dev *pdev, const struct pci_device_id *ent) does not use ent for generation-specific branching. vendor_part_id is taken from pdev->device. Capabilities come from admin query (page_size_cap, etc.).
Record: [PCI match table: 4 IDs -> 5 IDs; probe path unchanged]
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Category **(h) Hardware workarounds / device ID additions**. Without the ID, new EFA VFs never bind.
Record: [Device ID addition] [Missing 0xefa4 in efa_pci_tbl prevented driver bind]
**Step 2.4: ASSESS THE FIX QUALITY**
Obviously correct. Same pattern as 0xefa2 (b75927cff13e0) and 0xefa3 (346d2fc606a85). Does not change locking, APIs, or existing- ID behavior. Regression risk is confined to 1d0f:efa4 hardware.
Record: [Minimal, obviously correct] [Regression risk: only 0xefa4 devices]
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
``` efa0/efa1: d4f9cb5c5b224 (Gal Pressman, 2020) efa2: b75927cff13e0 (Michael Margolin, 2022) → v6.1-rc4 efa3: 346d2fc606a85 (Michael Margolin, 2024) → present in v6.11 / v7.2.7 efa4: 6a57af838b1a5 (Anas Mousa, 2026-07-12) Driver: b7f5e880f3774 (2019) → v5.2-rc1 ```
The table has been the enablement mechanism since the driver was added.
Record: [ID table since v5.2; this ID added 2026-07-12 / 7.3 merge window]
**Step 3.2: FOLLOW THE FIXES: TAG**
No Fixes: tag. Not a regression fix.
Record: [N/A — device ID, not a regression]
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Same msgid series 20260712134413:
1. 4266547bdce74 RDMA/efa: Extend page-shift field in MR registration (19226-2)
2. 6a57af838b1a5 RDMA/efa: Add EFA 0xefa4 PCI ID (19226-3) — this commit
Cover letter: 2-patch for-next series. Patch 1 widens EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK from GENMASK(4,0) to GENMASK(5,0) for **>4GB page sizes** on 0xefa4. That is extra capability, not required for PCI bind/probe. efa_probe does not depend on that mask.
Record: [Series of 2; this patch is standalone for bind] [page-shift is feature, not probe prerequisite]
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Anas Mousa: this is the only in-tree EFA commit. Reviewed by Michael Margolin (regular EFA author). Applied by Leon Romanovsky.
Record: [First-time author; reviewed by EFA regular; applied by RDMA maintainer]
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Local tree already has PCI_DEV_ID_EFA3_VF, PCI_VDEVICE(AMAZON, ...), and efa_pci_tbl. No new helpers. Companion page-shift commit is already in this tree (git merge-base --is-ancestor 4266547bdce74 HEAD).
Record: [Applies standalone] [No missing structs/APIs in this tree]
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**b4 dig -c 6a57af838b1a5 →
https://patch.msgid.link/[email protected]b4 dig -a: **v1 only** (no v2/v3).
Thread saved to mbox (6 messages).
Key review (on patch 1/2, not this ID patch): Leon asked how non-0xefa4 devices handle the extra page-shift bit. Michael: kernel uses device- reported page_size_cap with ib_umem_find_best_pgsz(), so the extra bit is not set on older devices; device also validates. Leon then **Applied, thanks!** both patches. No NAK on the PCI ID patch. No `Cc:
stable` request.
Record: [lore via patch.msgid.link/20260712134413.19226-3] [v1 only] [no NAK on ID patch] [no stable nomination]
**Step 4.2: CHECK WHO REVIEWED THE PATCH**b4 dig -w recipients: [email protected], [email protected], linux- [email protected], Amazon EFA engineers (sleybo, matua, gal.pressman). Right lists and maintainers.
Record: [RDMA maintainers + linux-rdma CC'd; Leon applied]
**Step 4.3: SEARCH FOR THE BUG REPORT**
No bugzilla/syzbot. External confirmation that 0xefa4 is real hardware:
- DeviceHunt: PCI 1D0F:EFA4 Amazon Elastic Fabric Adapter
- Amazon out-of-tree efa_linux_3.3.0: “Add 0xefa4 device support”
- rdma-core: efa: Add EFA 0xefa4 PCI ID
Record: [Real shipping device; userspace + out-of-tree driver already list the ID]
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
2/2 of “Add support for 0xefa4 devices”. Evaluating only the ID patch:
self-contained for enumeration. Full >4GB MR pages needs patch 1/2 (already in this tree).
Record: [Standalone for bind; series mate is optional extra capability]
**Step 4.5: CHECK STABLE MAILING LIST HISTORY** lore.kernel.org WebFetch returned 403. b4 dig mbox has no stable-list traffic. No evidence this ID was rejected for stable.
Record: [No stable-list discussion found (lore HTTP 403; mbox has none)]
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
No function body changed. Data: PCI_DEV_ID_EFA4_VF, efa_pci_tbl[].
Consumers: MODULE_DEVICE_TABLE(pci, efa_pci_tbl) and efa_pci_driver.id_table.
Record: [efa_pci_tbl / efa_pci_driver only]
**Step 5.2: TRACE CALLERS**
PCI core pci_device_probe → efa_probe → efa_probe_device / efa_ib_device_add. Userspace-visible once the VF is assigned (typical AWS EFA instance).
Record: [PCI enumeration; bind on matching VF]
**Step 5.3: TRACE CALLEES**
Unchanged. Probe still does BAR map, MSI-X, admin queues, IB register.
Record: [Probe callees unchanged]
**Step 5.4: FOLLOW THE CALL CHAIN**
Reachable when CONFIG_INFINIBAND_EFA is set (PCI_MSI && 64BIT && !CPU_BIG_ENDIAN && INFINIBAND_USER_ACCESS) and 1d0f:efa4 is present. Common on AWS HPC/ML instances, not a syscall fuzzer path.
Record: [Reachable from device hotplug/boot on EFA instances]
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Identical ID adds for efa2/efa3. No switch (pdev->device) / driver_data generation quirks in drivers/infiniband/hw/efa/.
Record: [Same pattern as prior EFA IDs; no per-ID code]
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Local tree: **v7.3-rc4-27-gf0100363d8c37**, make kernelversion = **7.3.0-rc4**.INFINIBAND_EFA and efa_pci_tbl exist. 0xefa0–0xefa3 exist. Without this change, 0xefa4 would not match.
git merge-base --is-ancestor 6a57af838b1a5 HEAD → yes (landed by **v7.3-rc1**). Not in **v7.2.7**. Introduced in the 7.3 window, not after this branch point.
Record: [Driver and ID table present in this 7.3-rc4 tree] [ID added in 7.3-rc1]
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Hunk is two lines next to PCI_DEV_ID_EFA3_VF. Would apply cleanly to this file’s table. No refactor of the ID table.
Record: [Expected apply: clean]
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
No alternate 0xefa4 enablement. This is the only 0xefa4 PCI table change.
Record: [No other 0xefa4 bind fix]
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY** drivers/infiniband/hw/efa/ — Amazon EFA RDMA NIC.
Criticality: **IMPORTANT** for AWS EFA users; **PERIPHERAL** globally. Not core mm/net.
Record: [RDMA/efa] [IMPORTANT for EFA hardware, otherwise peripheral]
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Actively maintained (completion counters, 128B admin SQ, IRQ lifetime fixes in 2026). ID adds are a long-standing pattern, not a new subsystem.
Record: [Active but mature ID-table pattern]
MAINTAINERS: “AMAZON RDMA EFA DRIVER”.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Users of Amazon EFA VF 1d0f:efa4 with CONFIG_INFINIBAND_EFA. Older EFA IDs unchanged.
Record: [driver-specific / config-specific (INFINIBAND_EFA)]
**Step 8.2: TRIGGER CONDITIONS**
Boot or VF assignment of 0xefa4. Not a race. Unprivileged users cannot trigger a crash; they just get a working RDMA device after bind.
Record: [Hotplug/boot of 0xefa4] [Likely on new EFA instances] [Not a UAF/syscall crash]
**Step 8.3: FAILURE MODE SEVERITY**
Without the ID: device unused by in-tree driver (lost HPC/RDMA). Not panic/corruption. For affected hardware this is functional breakage.
Record: [Device not bound] [Severity: HIGH for 0xefa4 users, LOW for everyone else]
**Step 8.4: RISK-BENEFIT RATIO**
Benefit: enables real hardware on an existing driver (stable-kernel- rules explicitly allow this).
Risk: two lines, ID-table only, no API/lock/hot-path change.
Record: [Benefit: high for EFA 0xefa4] [Risk: very low] [Favorable]
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Documentation/process/stable-kernel-rules.rst: “must either fix a real bug that bothers people **or just add a device ID**.”
- Canonical PCI ID exception: driver already in tree; only the ID is new.
- +2 lines, obviously correct, same as efa2/efa3.
- No per-ID branching; probe is generation-agnostic.
- Real device (1d0f:efa4); Amazon out-of-tree and rdma-core already list it.
- Reviewed and applied by RDMA maintainer Leon Romanovsky.
- Applies cleanly; no new APIs.
AGAINST:
- Not a crash/security/corruption fix (not required for device IDs).
- Submitted as for-next, no Cc: stable (absence is expected).
- Series mate extends page-shift for >4GB MRs; not needed for bind.
- Author is a first-time in-tree EFA contributor (offset by Margolin review + Leon apply).
UNRESOLVED:
- Direct lore.kernel.org HTTP fetches returned 403; thread recovered via b4 dig -m.
- Stable mailing list search via WebFetch also 403; no stable discussion in the rdma mbox.
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — 2-line ID table; maintainer applied after review.
2. Fixes a real bug that affects users? **PASS** — device ID exception; otherwise 0xefa4 never binds.
3. Important issue? **PASS** under the documented device-ID exception (not a panic).
4. Small and contained? **PASS** — +2 lines, one file.
5. No new features or APIs? **PASS** — existing driver, new ID only (page-shift is a different commit).
6. Can apply to the local tree? **PASS** — efa_main.c ID table present; hunk matches.
**Step 9.3: EXCEPTION CATEGORY**
**Device ID addition to existing driver** — automatic stable qualifier.
**Step 9.4: DECISION**
This tree is **7.3.0-rc4**. The EFA driver and PCI table are here. Adding 0xefa4 is the standard, low-risk hardware-enablement backport. The companion page-shift change is a separate feature and is not required for this ID patch to be correct.
### What it solves for users of this tree
Without 0xefa4 in efa_pci_tbl, new Amazon EFA adapters are invisible to the in-tree driver. With it, the existing probe path binds them. That is exactly what stable trees take PCI IDs for.
### Risk vs benefit
Benefit is hardware enablement for EFA 0xefa4. Risk is two lines that cannot affect other devices.
---
### Verification
- [Phase 1] Parsed commit 6a57af838b1a56405a9bde9030de16df901ae2ca:
Reviewed-by Margolin, SOB Anas Mousa + Leon Romanovsky, Link msgid 20260712134413.19226-3
- [Phase 2] Diff: +2 lines in efa_pci_tbl / PCI_DEV_ID_EFA4_VF only
- [Phase 2] efa_probe() does not branch on ent/pdev->device for quirks (verified in efa_main.c)
- [Phase 3] git blame -L 16,29 efa_main.c: efa0–efa3 older; efa4 is this commit
- [Phase 3] Prior IDs: efa2 b75927cff13e0, efa3 346d2fc606a85 — same 2-line pattern
- [Phase 3] Series mate 4266547bdce74 is page-shift GENMASK only, not a probe dependency
- [Phase 4] b4 dig -c 6a57af838b1a5: matched lore thread; v1 only
- [Phase 4] b4 dig -w: linux-rdma, jgg, leon CC’d
- [Phase 4] mbox: Leon question on patch 1/2 only; both patches applied 2026-07-14; no NAK on ID patch
- [Phase 4] WebFetch lore/stable: HTTP 403 — UNVERIFIED via HTTP; covered by b4 mbox
- [Phase 5] Call path: PCI id_table → efa_probe; page_size_cap used in efa_verbs.c for MR pages
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4
- [Phase 6] git merge-base --is-ancestor 6a57af838b1a5 HEAD = yes; not ancestor of v7.2.7
- [Phase 6] Driver added b7f5e880f3774 (v5.2-rc1); present in this tree
- [Phase 7] Documentation/process/stable-kernel-rules.rst line 15:
device ID explicitly allowed
- [Phase 8] Failure mode: device not bound on 0xefa4; no panic path
- UNVERIFIED: stable@vger archive contents (HTTP 403)
The change is a contained PCI ID addition to a driver this tree already ships, which stable policy explicitly accepts.
**YES**
drivers/infiniband/hw/efa/efa_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/efa/efa_main.c +2 -0
@@ -17,12 +17,14 @@#define PCI_DEV_ID_EFA1_VF 0xefa1#define PCI_DEV_ID_EFA2_VF 0xefa2#define PCI_DEV_ID_EFA3_VF 0xefa3 +#define PCI_DEV_ID_EFA4_VF 0xefa4static const struct pci_device_id efa_pci_tbl[] = { {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA0_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA1_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA2_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA3_VF ) }, + {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA4_VF ) }, { } };
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.12] RDMA/efa: Add EFA 0xefa4 PCI ID
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] RDMA/efa: broken >=4GB MR registration on 0xefa4 in efa_register_mr() - [High] RDMA/efa: missing…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] RDMA/efa: broken >=4GB MR registration on 0xefa4 in efa_register_mr()
- [High] RDMA/efa: missing AH cache in efa_com_create_ah() for 0xefa4 devices --
commit b286b983be1758d745ca136c6fbfaf1703d09edf
Author: Anas Mousa <[email protected]>
RDMA/efa: Add EFA 0xefa4 PCI ID
This commit adds the PCI device ID 0xefa4 (PCI_DEV_ID_EFA4_VF) to efa_pci_tbl so the EFA driver can bind to 0xefa4 devices.
Quoted 6 lines
drivers/infiniband/hw/efa/efa_main.c +0
-0@@ -17,12 +17,14 @@#define PCI_DEV_ID_EFA1_VF 0xefa1
drivers/infiniband/hw/efa/efa_main.c line 27
Quoted 10 lines
drivers/infiniband/hw/efa/efa_main.c +2
-0#define PCI_DEV_ID_EFA2_VF 0xefa2#define PCI_DEV_ID_EFA3_VF 0xefa3 +#define PCI_DEV_ID_EFA4_VF 0xefa4static const struct pci_device_id efa_pci_tbl[] = { {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA0_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA1_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA2_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA3_VF ) }, + {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA4_VF ) },
[Severity: High]
Does enabling PCI_DEV_ID_EFA4_VF in efa_pci_tbl break memory region registration when a page size of 4GB or larger (page_shift >= 32) is selected on 0xefa4 devices?
When 0xefa4 devices advertise >= 4GB page sizes in dev_attr.page_size_cap and a consumer registers a large memory region via efa_register_mr(), the 64-bit unsigned long return value of ib_umem_find_best_pgsz() is stored in a 32-bit unsigned int pg_sz:
drivers/infiniband/hw/efa/efa_verbs.c:efa_register_mr() {
unsigned int pg_sz;
...
pg_sz = ib_umem_find_best_pgsz(mr->umem,
dev->dev_attr.page_size_cap,
virt_addr);
if (!pg_sz) {
ibdev_dbg(&dev->ibdev, "Failed to find a suitable page size in page_size_cap %#llx\n",
dev->dev_attr.page_size_cap);
return -EOPNOTSUPP;
}
params.page_shift = order_base_2(pg_sz);
}When ib_umem_find_best_pgsz() selects a power-of-two page size >= 4GB, assigning it to unsigned int pg_sz truncates the value to 0 and causes efa_register_mr() to fail with -EOPNOTSUPP.
In addition, upstream commit 6a57af838b1a5 ("RDMA/efa: Add EFA 0xefa4 PCI ID") was submitted as patch 2/2 alongside commit 4266547bdce74 ("RDMA/efa:
Extend page-shift field in MR registration"), which widens EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK from GENMASK(4, 0) to GENMASK(5, 0) for >4GB page sizes. Without that companion commit, drivers/infiniband/hw/efa/efa_admin_cmds_defs.h still defines:
#define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK GENMASK(4, 0)
So in efa_com_register_mr() in drivers/infiniband/hw/efa/efa_com_cmd.c:
EFA_SET(&mr_cmd.flags, EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT, params->page_shift);
bit 5 of params->page_shift is masked off for any page_shift >= 32. Should pg_sz be an unsigned long and commit 4266547bdce74 be included as well?
[Severity: High]
Will creating multiple address handles to the same remote GID on the same PD fail on 0xefa4 hardware without the address handle cache commits?
Upstream commits 97ba15272e8e ("RDMA/efa: Add initialization of AH cache rhashtable") and 234895fa8be0 ("RDMA/efa: Add AH cache handling on create and destroy AH") were merged right before commit 6a57af838b1a5 because new EFA devices do not support creating multiple address handles to the same remote on the same PD.
Without those commits backported, calling efa_create_ah() -> efa_com_create_ah() for the same (pdn, dest_addr) pair unconditionally sends a new EFA_ADMIN_CREATE_AH command to the device instead of deduplicating and refcounting via efa_ah_cache_get():
drivers/infiniband/hw/efa/efa_com_cmd.c:efa_com_create_ah() {
...
ah_cmd.aq_common_desc.opcode = EFA_ADMIN_CREATE_AH;
memcpy(ah_cmd.dest_addr, params->dest_addr, sizeof(ah_cmd.dest_addr));
ah_cmd.pd = params->pdn;
err = efa_com_cmd_exec(aq,
(struct efa_admin_aq_entry *)&ah_cmd,
sizeof(ah_cmd),
(struct efa_admin_acq_entry *)&cmd_completion,
sizeof(cmd_completion));
}Should commits 97ba15272e8e and 234895fa8be0 also be backported before enabling PCI_DEV_ID_EFA4_VF?
Quoted 3 lines
drivers/infiniband/hw/efa/efa_main.c +0
-0{ } };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH AUTOSEL 6.18-6.12] RDMA/efa: Add EFA 0xefa4 PCI ID
In reply to Sasha LevinQuoted 11 lines · Sasha Levin
From: Anas Mousa <[email protected]>
[ Upstream commit
6a57af838b1a56405a9bde9030de16df901ae2ca]Add support for
0xefa4devices.Reviewed-by Michael Margolin <[email protected]>Signed-off-by Anas Mousa <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 8 lines
---
LLM Generated explanations, may be completely bogus:
This is a two-line PCI ID addition to the existing Amazon EFA RDMA driver. That matches the stable-tree device-ID exception, and the local 7.3-rc4 tree already has the driver and ID table.
The 0xefa4 device support requires previous changes introduced in 7.3. Please do not apply this patch on stable kernels.
Quoted 431 lines
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Subsystem:RDMA/efa
- Action verb: **Add**
- Claimed intent: register PCI device ID0xefa4so the in-tree EFA driver binds new Amazon Elastic Fabric Adapter hardware.Record:
[RDMA/efa] [add] [PCI ID 0xefa4 for next-gen EFA VF]**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
-Reviewed-by: Michael Margolin <[email protected]>(Amazon EFA contributor; 20 commits in this driver)
-Signed-off-by: Anas Mousa <[email protected]>(author)
- `Link:
https://patch.msgid.link/[email protected]`
-Signed-off-by: Leon Romanovsky <[email protected]>(RDMA maintainer, committer)
- NoFixes:tag (expected)
- NoCc: [email protected](expected)
- NoReported-by:,Tested-by:,Acked-by:
- Ignore any pipelineSigned-off-by: Sasha Levin/[Upstream commit ...]markers (none in the real commit)Record: Maintainer-applied PCI ID patch; Amazon internal review; lore link present; no syzbot/bug report (not applicable).
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Body is one sentence: “Add support for0xefa4devices.” Cover letter (mbox): “Make a minor device interface change needed for new EFA devices and enable support for0xefa4PCI ID.” No crash, no reproducer — this is hardware enablement.Record:
[Bug description: none — new PCI ID] [Symptom: 0xefa4 adapters unbound / unused by in-tree efa] [Version info: none] [Root cause: ID missing from pci_device_id table]**Step 1.4: DETECT HIDDEN BUG FIXES**
Not a disguised leak/race/UAF fix. It is exactly a device-ID addition.Record:
[Not a hidden bug fix. Explicit PCI ID enablement.]---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- File:drivers/infiniband/hw/efa/efa_main.c— **+2 / -0**
-#define PCI_DEV_ID_EFA4_VF 0xefa4
-{ PCI_VDEVICE(AMAZON, PCI_DEV_ID_EFA4_VF) }inefa_pci_tbl[]
- Scope: single-file surgical ID additionRecord:
[efa_main.c +2] [pci_device_id table] [surgical single-file]**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Before: PCI core matches Amazon vendor0x1d0fwith IDs0xefa0–0xefa3only.0xefa4is ignored (no probe).
After:0xefa4matchesefa_pci_driver,efa_probe()runs the same path as older generations.
efa_probe(struct pci_dev *pdev, const struct pci_device_id *ent)does not useentfor generation-specific branching.vendor_part_idis taken frompdev->device. Capabilities come from admin query (page_size_cap, etc.).Record:
[PCI match table: 4 IDs -> 5 IDs; probe path unchanged]**Step 2.3: IDENTIFY THE BUG MECHANISM**
Category **(h) Hardware workarounds / device ID additions**. Without the ID, new EFA VFs never bind.Record:
[Device ID addition] [Missing 0xefa4 in efa_pci_tbl prevented driver bind]**Step 2.4: ASSESS THE FIX QUALITY**
Obviously correct. Same pattern as0xefa2(b75927cff13e0) and0xefa3(346d2fc606a85). Does not change locking, APIs, or existing- ID behavior. Regression risk is confined to1d0f:efa4hardware.Record:
[Minimal, obviously correct] [Regression risk: only 0xefa4 devices]---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
``` efa0/efa1: d4f9cb5c5b224 (Gal Pressman, 2020) efa2: b75927cff13e0 (Michael Margolin, 2022) → v6.1-rc4 efa3: 346d2fc606a85 (Michael Margolin, 2024) → present in v6.11 / v7.2.7 efa4: 6a57af838b1a5 (Anas Mousa, 2026-07-12) Driver: b7f5e880f3774 (2019) → v5.2-rc1 ```The table has been the enablement mechanism since the driver was added.
Record:
[ID table since v5.2; this ID added 2026-07-12 / 7.3 merge window]**Step 3.2: FOLLOW THE FIXES: TAG**
NoFixes:tag. Not a regression fix.Record:
[N/A — device ID, not a regression]**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Same msgid series20260712134413:
1.4266547bdce74RDMA/efa: Extend page-shift field in MR registration (19226-2)
2.6a57af838b1a5RDMA/efa: Add EFA0xefa4PCI ID (19226-3) — this commitCover letter: 2-patch
for-nextseries. Patch 1 widensEFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASKfromGENMASK(4,0)toGENMASK(5,0)for **>4GB page sizes** on0xefa4. That is extra capability, not required for PCI bind/probe.efa_probedoes not depend on that mask.Record:
[Series of 2; this patch is standalone for bind] [page-shift is feature, not probe prerequisite]**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Anas Mousa: this is the only in-tree EFA commit. Reviewed by Michael Margolin (regular EFA author). Applied by Leon Romanovsky.Record:
[First-time author; reviewed by EFA regular; applied by RDMA maintainer]**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Local tree already hasPCI_DEV_ID_EFA3_VF,PCI_VDEVICE(AMAZON, ...), andefa_pci_tbl. No new helpers. Companion page-shift commit is already in this tree (git merge-base --is-ancestor 4266547bdce74 HEAD).Record:
[Applies standalone] [No missing structs/APIs in this tree]---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
b4 dig -c 6a57af838b1a5→
https://patch.msgid.link/[email protected]b4 dig -a: **v1 only** (no v2/v3).
Thread saved to mbox (6 messages).Key review (on patch 1/2, not this ID patch): Leon asked how non-0xefa4 devices handle the extra page-shift bit. Michael: kernel uses device- reported
page_size_capwithib_umem_find_best_pgsz(), so the extra bit is not set on older devices; device also validates. Leon then **Applied, thanks!** both patches. No NAK on the PCI ID patch. No `Cc:
stable` request.Record:
[lore via patch.msgid.link/20260712134413.19226-3] [v1 only] [no NAK on ID patch] [no stable nomination]**Step 4.2: CHECK WHO REVIEWED THE PATCH**
b4 dig -wrecipients:[email protected],[email protected],linux- [email protected], Amazon EFA engineers (sleybo,matua,gal.pressman). Right lists and maintainers.Record:
[RDMA maintainers + linux-rdma CC'd; Leon applied]**Step 4.3: SEARCH FOR THE BUG REPORT**
No bugzilla/syzbot. External confirmation that0xefa4is real hardware:
- DeviceHunt: PCI1D0F:EFA4Amazon Elastic Fabric Adapter
- Amazon out-of-treeefa_linux_3.3.0: “Add0xefa4device support”
- rdma-core:efa: Add EFA 0xefa4 PCI IDRecord:
[Real shipping device; userspace + out-of-tree driver already list the ID]**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
2/2 of “Add support for0xefa4devices”. Evaluating only the ID patch:
self-contained for enumeration. Full >4GB MR pages needs patch 1/2 (already in this tree).Record:
[Standalone for bind; series mate is optional extra capability]**Step 4.5: CHECK STABLE MAILING LIST HISTORY** lore.kernel.org WebFetch returned 403.
b4 digmbox has no stable-list traffic. No evidence this ID was rejected for stable.Record:
[No stable-list discussion found (lore HTTP 403; mbox has none)]---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
No function body changed. Data:PCI_DEV_ID_EFA4_VF,efa_pci_tbl[].
Consumers:MODULE_DEVICE_TABLE(pci, efa_pci_tbl)andefa_pci_driver.id_table.Record:
[efa_pci_tbl / efa_pci_driver only]**Step 5.2: TRACE CALLERS**
PCI corepci_device_probe→efa_probe→efa_probe_device/efa_ib_device_add. Userspace-visible once the VF is assigned (typical AWS EFA instance).Record:
[PCI enumeration; bind on matching VF]**Step 5.3: TRACE CALLEES**
Unchanged. Probe still does BAR map, MSI-X, admin queues, IB register.Record:
[Probe callees unchanged]**Step 5.4: FOLLOW THE CALL CHAIN**
Reachable whenCONFIG_INFINIBAND_EFAis set (PCI_MSI && 64BIT && !CPU_BIG_ENDIAN && INFINIBAND_USER_ACCESS) and1d0f:efa4is present. Common on AWS HPC/ML instances, not a syscall fuzzer path.Record:
[Reachable from device hotplug/boot on EFA instances]**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Identical ID adds for efa2/efa3. Noswitch (pdev->device)/driver_datageneration quirks indrivers/infiniband/hw/efa/.Record:
[Same pattern as prior EFA IDs; no per-ID code]---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Local tree: **v7.3-rc4-27-gf0100363d8c37**,
make kernelversion= **7.3.0-rc4**.INFINIBAND_EFAandefa_pci_tblexist.0xefa0–0xefa3exist. Without this change,0xefa4would not match.
git merge-base --is-ancestor 6a57af838b1a5 HEAD→ yes (landed by **v7.3-rc1**). Not in **v7.2.7**. Introduced in the 7.3 window, not after this branch point.Record:
[Driver and ID table present in this 7.3-rc4 tree] [ID added in 7.3-rc1]**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Hunk is two lines next toPCI_DEV_ID_EFA3_VF. Would apply cleanly to this file’s table. No refactor of the ID table.Record:
[Expected apply: clean]**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
No alternate0xefa4enablement. This is the only0xefa4PCI table change.Record:
[No other 0xefa4 bind fix]---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
drivers/infiniband/hw/efa/— Amazon EFA RDMA NIC.
Criticality: **IMPORTANT** for AWS EFA users; **PERIPHERAL** globally. Not core mm/net.Record:
[RDMA/efa] [IMPORTANT for EFA hardware, otherwise peripheral]**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Actively maintained (completion counters, 128B admin SQ, IRQ lifetime fixes in 2026). ID adds are a long-standing pattern, not a new subsystem.Record:
[Active but mature ID-table pattern]
MAINTAINERS: “AMAZON RDMA EFA DRIVER”.---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Users of Amazon EFA VF1d0f:efa4withCONFIG_INFINIBAND_EFA. Older EFA IDs unchanged.Record:
[driver-specific / config-specific (INFINIBAND_EFA)]**Step 8.2: TRIGGER CONDITIONS**
Boot or VF assignment of0xefa4. Not a race. Unprivileged users cannot trigger a crash; they just get a working RDMA device after bind.Record:
[Hotplug/boot of 0xefa4] [Likely on new EFA instances] [Not a UAF/syscall crash]**Step 8.3: FAILURE MODE SEVERITY**
Without the ID: device unused by in-tree driver (lost HPC/RDMA). Not panic/corruption. For affected hardware this is functional breakage.Record:
[Device not bound] [Severity: HIGH for 0xefa4 users, LOW for everyone else]**Step 8.4: RISK-BENEFIT RATIO**
Benefit: enables real hardware on an existing driver (stable-kernel- rules explicitly allow this).
Risk: two lines, ID-table only, no API/lock/hot-path change.Record:
[Benefit: high for EFA 0xefa4] [Risk: very low] [Favorable]---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
-Documentation/process/stable-kernel-rules.rst: “must either fix a real bug that bothers people **or just add a device ID**.”
- Canonical PCI ID exception: driver already in tree; only the ID is new.
- +2 lines, obviously correct, same as efa2/efa3.
- No per-ID branching; probe is generation-agnostic.
- Real device (1d0f:efa4); Amazon out-of-tree and rdma-core already list it.
- Reviewed and applied by RDMA maintainer Leon Romanovsky.
- Applies cleanly; no new APIs.AGAINST:
- Not a crash/security/corruption fix (not required for device IDs).
- Submitted asfor-next, noCc: stable(absence is expected).
- Series mate extends page-shift for >4GB MRs; not needed for bind.
- Author is a first-time in-tree EFA contributor (offset by Margolin review + Leon apply).UNRESOLVED:
- Direct lore.kernel.org HTTP fetches returned 403; thread recovered viab4 dig -m.
- Stable mailing list search via WebFetch also 403; no stable discussion in the rdma mbox.**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — 2-line ID table; maintainer applied after review.
2. Fixes a real bug that affects users? **PASS** — device ID exception; otherwise0xefa4never binds.
3. Important issue? **PASS** under the documented device-ID exception (not a panic).
4. Small and contained? **PASS** — +2 lines, one file.
5. No new features or APIs? **PASS** — existing driver, new ID only (page-shift is a different commit).
6. Can apply to the local tree? **PASS** —efa_main.cID table present; hunk matches.**Step 9.3: EXCEPTION CATEGORY**
**Device ID addition to existing driver** — automatic stable qualifier.**Step 9.4: DECISION**
This tree is **7.3.0-rc4**. The EFA driver and PCI table are here. Adding0xefa4is the standard, low-risk hardware-enablement backport. The companion page-shift change is a separate feature and is not required for this ID patch to be correct.### What it solves for users of this tree
Without0xefa4inefa_pci_tbl, new Amazon EFA adapters are invisible to the in-tree driver. With it, the existing probe path binds them. That is exactly what stable trees take PCI IDs for.### Risk vs benefit
Benefit is hardware enablement for EFA0xefa4. Risk is two lines that cannot affect other devices.---
### Verification
- [Phase 1] Parsed commit6a57af838b1a56405a9bde9030de16df901ae2ca:
Reviewed-by Margolin, SOB Anas Mousa + Leon Romanovsky, Link msgid20260712134413.19226-3
- [Phase 2] Diff: +2 lines inefa_pci_tbl/PCI_DEV_ID_EFA4_VFonly
- [Phase 2]efa_probe()does not branch onent/pdev->devicefor quirks (verified inefa_main.c)
- [Phase 3]git blame -L 16,29 efa_main.c: efa0–efa3 older; efa4 is this commit
- [Phase 3] Prior IDs: efa2b75927cff13e0, efa3346d2fc606a85— same 2-line pattern
- [Phase 3] Series mate4266547bdce74is page-shift GENMASK only, not a probe dependency
- [Phase 4]b4 dig -c 6a57af838b1a5: matched lore thread; v1 only
- [Phase 4]b4 dig -w: linux-rdma, jgg, leon CC’d
- [Phase 4] mbox: Leon question on patch 1/2 only; both patches applied 2026-07-14; no NAK on ID patch
- [Phase 4] WebFetch lore/stable: HTTP 403 — UNVERIFIED via HTTP; covered by b4 mbox
- [Phase 5] Call path: PCIid_table→efa_probe;page_size_capused inefa_verbs.cfor MR pages
- [Phase 6]git describe HEAD=v7.3-rc4-27-gf0100363d8c37;make kernelversion= 7.3.0-rc4
- [Phase 6]git merge-base --is-ancestor 6a57af838b1a5 HEAD= yes; not ancestor ofv7.2.7
- [Phase 6] Driver addedb7f5e880f3774(v5.2-rc1); present in this tree
- [Phase 7]Documentation/process/stable-kernel-rules.rstline 15:
device ID explicitly allowed
- [Phase 8] Failure mode: device not bound on0xefa4; no panic path
- UNVERIFIED: stable@vger archive contents (HTTP 403)The change is a contained PCI ID addition to a driver this tree already ships, which stable policy explicitly accepts.
**YES**
drivers/infiniband/hw/efa/efa_main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/infiniband/hw/efa/efa_main.c +2
-0@@ -17,12 +17,14 @@#define PCI_DEV_ID_EFA1_VF 0xefa1#define PCI_DEV_ID_EFA2_VF 0xefa2#define PCI_DEV_ID_EFA3_VF 0xefa3 +#define PCI_DEV_ID_EFA4_VF 0xefa4static const struct pci_device_id efa_pci_tbl[] = { {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA0_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA1_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA2_VF ) }, {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA3_VF ) }, + {PCI_VDEVICE (AMAZON ,PCI_DEV_ID_EFA4_VF ) }, { } };Signature · 1 line
2.53.0
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.18-6.12] RDMA/efa: Add EFA 0xefa4 PCI ID
Quoted 2 lines · Michael Margolin
The
0xefa4device support requires previous changes introduced in 7.3. Please do not apply this patch on stable kernels.
Dropped, thanks.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 1/1 drm/radeon: fix internal display on iMac11, 1 (RV770/DCE3.1)
In reply to Sasha LevinFrom: Gilles Risch <[email protected]>
[ Upstream commit 275c3332585bbabcefad109a6978cc0cbecf2008 ]
The Apple iMac11,1 (27-inch, Late 2009) uses a Mobility Radeon HD 4850 (RV770/DCE3.1) with a 2560x1440 internal panel on an internal DisplayPort path. Without this fix the display stays dark under KMS.
This machine suffers from the same issue as iMac10,1 and iMac11,2:
Apple routes the internal display through Link B of the DIG encoder instead of Link A. Add iMac11,1 to the existing DMI quirk and move the Apple-specific encoder assignment into its own block, independent of the DCE version check.
Additionally, the 2560x1440 panel requires RADEON_PLL_USE_FRAC_FB_DIV and ATOM_ENCODER_CMD_DP_VIDEO_ON, limited to iMac11,1 via dmi_match() to avoid affecting other boards.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.12.111** (pending-6.12). The iMac11,1 Link-B quirk is missing here; iMac10,1 and iMac11,2 already have it. This is a DMI-limited hardware quirk that lights the internal panel, and it matches the stable exception for device-specific workarounds.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [drm/radeon] [fix] internal display stays dark on iMac11,1 (RV770/DCE3.1)
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Reviewed-by: Lukas Wunner <[email protected]>
- Signed-off-by: Gilles Risch <[email protected]> (author)
- Signed-off-by: Alex Deucher <[email protected]> (radeon maintainer)
- No Fixes: tag (expected)
- No Reported-by: / Tested-by: / Link: / Cc: stable (expected for this review pipeline)
- No syzbot / sanitizer tags
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** Apple iMac11,1 (27-inch, Late 2009) Mobility Radeon HD 4850 (RV770/DCE3.1), 2560x1440 internal panel on an internal DisplayPort path.
- **Symptom:** Internal display stays dark under KMS.
- **Root cause:** Same Apple Link-B DIG routing as iMac10,1 and iMac11,2; plus this 2560x1440 panel also needs RADEON_PLL_USE_FRAC_FB_DIV and ATOM_ENCODER_CMD_DP_VIDEO_ON.
- **Fix approach:** Add iMac11,1 to the existing DMI quirk; move Apple encoder assignment out of the DCE-version check; DMI-limit the PLL and DP_VIDEO_ON extras to iMac11,1.
- **Version info:** None in the message. Hardware is 2009; related quirks date to 2017/2023.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. This is an explicit hardware-quirk bug fix (dark panel). Not cleanup, refactor, or a new API.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- drivers/gpu/drm/radeon/atombios_crtc.c: +#include <linux/dmi.h>; PLL flag condition widened for iMac11,1 (~3 lines net)
- drivers/gpu/drm/radeon/atombios_encoders.c: DP_VIDEO_ON DMI match; encoder picker restructure (~12 lines)
- Functions: atombios_adjust_pll(), radeon_atom_encoder_dpms_dig(), radeon_atom_pick_dig_encoder()
- Scope: small, two-file surgical driver quirk (~17 insertions / 11 deletions)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
1. **PLL (atombios_adjust_pll):** Before, RADEON_PLL_USE_FRAC_FB_DIV for clocks >165 MHz only if ASIC_IS_DCE32(). After, also if DMI product is iMac11,1. RV770 is not DCE3.2 (CHIP_RV770 precedes CHIP_RV730), so iMac11,1 never took this path.
2. **DPMS ON (radeon_atom_encoder_dpms_dig):** Before, ATOM_ENCODER_CMD_DP_VIDEO_ON only if ASIC_IS_DCE4(). After, also for iMac11,1. DCE3.1 iMac11,1 never issued VIDEO_ON.
3. **Encoder pick (radeon_atom_pick_dig_encoder):** Before, Apple Link-B assignment lived inside if (ASIC_IS_DCE32()) for iMac10,1 and iMac11,2 only. iMac11,1 (DCE3.1) fell through to DCE3 LVTMA logic, which does not use dig->linkb. After, Apple DMI check runs first (now including iMac11,1), then DCE32 still uses crtc_id. iMac10,1/11,2 behavior is preserved.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[h] Hardware workaround / DMI quirk.** Wrong DIG encoder (Link A vs Link B), missing fractional FB divider for a high-clock 2560x1440 panel, missing DP video-on ATOM command. Combined result: dark internal panel.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Quality: high. PLL and VIDEO_ON are DMI-limited. Encoder change for other Apple iMacs is behavior-preserving. Non-Apple DCE3.1 still uses the old LVTMA path.
- Maintainer (Alex Deucher) rejected v4’s ASIC_IS_DCE31() because it would change encoder routing for all DCE3.1 boards; v5 follows that request.
- Residual: DPMS OFF still does not send DP_VIDEO_OFF for iMac11,1 (only DCE4+ does). That can only affect this one DMI product, and v5 dropped the broader resume/OFF series on purpose.
- Regression risk: low. No public API, no lock, no refcount, no new module param.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- PLL DCE32 check: a02dc74b317d78 (Alex Deucher, 2012) “dce32+: use fractional fb dividers for high clocks”
- DP_VIDEO_ON DCE4 check: 3f03ced8808792 (Alex Deucher, 2011)
- Apple DMI quirk: 564d8a2cf3abf1 (Mario Kleiner, 2017, iMac10,1) then 05eacc198c68cb (Mark Hawrylak, 2023, iMac11,2)
- DCE32 encoder pick: 3f03ced8808792 (2011)
- Bug is long-standing (pre-3.13 for the sibling iMac10,1 issue). Present in this 6.12 tree.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Closest ancestors in this tree:
- 564d8a2cf3abf “Fix eDP for single-display iMac10,1 (v2)” — `Cc:
stable, git merge-base --is-ancestor` = yes
- 05eacc198c68c “Fix eDP for single-display iMac11,2” — Cc: stable, ancestor = yes
Those two patches could not cover iMac11,1 because they are inside ASIC_IS_DCE32(), and RV770 is not DCE3.2.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent radeon encoder/crtc history is backlight, helper conversions, iMac12,x backlight — not a conflicting refactor of this picker. Standalone v5 (earlier v3 was 2/2; resume patch was dropped). No missing prerequisite in this tree.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Gilles Risch has no radeon commits in this tree (first-time hardware reporter/tester). Alex Deucher is the radeon maintainer and signed off. Lukas Wunner (Apple/x86) reviewed.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Uses existing dmi_match(), RADEON_PLL_USE_FRAC_FB_DIV, ATOM_ENCODER_CMD_DP_VIDEO_ON, radeon_atom_pick_dig_encoder(). Adds #include <linux/dmi.h> to atombios_crtc.c (not currently included; atombios_encoders.c already has it). Applies standalone. Companion eDP resume patch is not required for the boot-time dark-panel fix.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- Candidate SHA is not in this tree, so b4 dig -c <this-commit> cannot be used. Located via subject search.
- v5: https://lore.gitlab.freedesktop.org/drm-ai-
reviews/[email protected]/ (Message-ID [email protected])
- v4 review (Alex): https://lists.freedesktop.org/archives/amd-
gfx/2026-May/145586.html
- Revisions: v1 (2026-05-10) → v2 → v3 0/2 (plus resume patch) → v4 (ASIC_IS_DCE31) → **v5** (DMI-only encoder block; this commit)
- Alex NAK’d v4’s if (ASIC_IS_DCE31()) as changing DCE3.1 routing generally; asked for an iMac11,1 DMI block with goto assigned. v5 does that (and includes the other two Apple DMI IDs).
- No NAK on v5. No reviewer Cc: stable found.
- b4 mbox of the v5 msgid started (30 messages) then failed on a local save path; thread content was retrieved via lore/gitlab and lists.freedesktop.org instead.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To: Alex Deucher. Cc: amd-gfx, dri-devel. Reviewed-by Lukas Wunner (on v2; tag kept). Applied/signed-off by Alex Deucher.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: Author tested on a real iMac11,1. Symptom is dark KMS display. Same class as documented iMac10,1 (Mario Kleiner, 2017: black display when radeon KMS loads) and iMac11,2 (2023). A 2023 amd-gfx attempt (“Fix eDP for single-display iMac11,1”) used ASIC_IS_DCE31 and did not land; this 2026 series is the one that did.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: v3 2/2 “fix eDP resume from suspend” (VIDEO_OFF + atombios_set_edp_panel_power for iMac11,1) was not part of v5. v5 is self-contained for initial bring-up. Not a hard dependency.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: UNVERIFIED — lore.kernel.org returned 403. Sibling iMac10,1 and iMac11,2 quirks both carried Cc: [email protected] and are in this tree.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: atombios_adjust_pll, radeon_atom_encoder_dpms_dig, radeon_atom_pick_dig_encoder
**Step 5.2: TRACE CALLERS**
Record:
- atombios_adjust_pll() ← atombios_crtc.c mode-set (radeon_crtc->adjusted_clock = atombios_adjust_pll(...))
- radeon_atom_pick_dig_encoder() ← radeon_atom_encoder_prepare() (modeset prepare) ← radeon_atom_dig_helper_funcs.prepare
- radeon_atom_encoder_dpms_dig() ← radeon_atom_encoder_dpms() for UNIPHY/LVTMA ← helper .dpms, .commit (DPMS_ON), .disable (DPMS_OFF)
**Step 5.3: TRACE CALLEES**
Record: atombios_dig_encoder_setup() / atom_execute_table() (ATOM BIOS), radeon_dp_link_train(), dmi_match(). No alloc/lock changes.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Userspace DRM modeset / KMS bring-up on this iMac. Reachable on every graphical boot for that machine. Not a syscall fuzzer path; it is the normal display path.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same DMI Link-B pattern already used for iMac10,1 and iMac11,2 in this file. This commit extends that list and lifts it out of ASIC_IS_DCE32().
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. git describe HEAD = p-6.12-3-gc504cf0baa3d8; make kernelversion = **6.12.111**.
- atombios_encoders.c:2130-2135 still matches only iMac10,1 / iMac11,2 inside ASIC_IS_DCE32().
- No iMac11,1 in drivers/gpu/drm/radeon/.
- ASIC_IS_DCE32 = family >= CHIP_RV730; radeon_family.h has CHIP_RV770 then CHIP_RV730, so RV770 is DCE3 but not DCE3.2.
- Candidate commit is not an ancestor of HEAD.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Pre-image in this tree matches the provided diff (PLL line 597, DPMS line 1710, picker 2125-2138). Need the new linux/dmi.h include in atombios_crtc.c.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: iMac10,1 and iMac11,2 quirks are present. They do not cover iMac11,1. No alternate iMac11,1 radeon fix in this tree.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: [drm/radeon] [IMPORTANT] — legacy AMD GPU KMS driver, still CONFIG_DRM_RADEON in this tree. Affects one Apple DMI product, not core mm/fs.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature/legacy. Occasional hardware quirks and small fixes. Encoder picker logic has been stable since ~2011 with Apple DMI additions in 2017 and 2023.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific + DMI-specific: Apple iMac11,1 (Late 2009 27-inch, HD 4850). Encoder restructure also runs on iMac10,1 and iMac11,2 with the same Link-B assignment they already had.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Loading radeon KMS / modesetting the internal panel. Common for anyone using this machine as a Linux desktop. Not a race. Unprivileged user does not need a special trigger beyond using the GUI.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: **[Dark internal display / unusable KMS console and desktop] [HIGH]** — not a panic, but the primary display does not work. Same severity as the iMac10,1/iMac11,2 quirks that went to stable.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: high for iMac11,1 6.12 LTS users (working internal panel).
- Risk: very low (~20 lines, DMI-gated extras, behavior-preserving picker for existing Apple IDs).
- Ratio: favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real, user-visible bug: internal panel stays dark under KMS.
- Hardware quirk exception (DMI table), same pattern as iMac10,1/iMac11,2 which had Cc: stable and are already in this tree.
- Small, obviously correct after maintainer feedback (v5 vs rejected v4 ASIC_IS_DCE31).
- DMI-limited PLL and VIDEO_ON so other RV770 boards are unchanged.
- Buggy code exists in 6.12.111; patch applies cleanly.
- Reviewed by Lukas Wunner; signed off by Alex Deucher; tested on the machine.
AGAINST:
- Not a crash, UAF, or CVE.
- Affects one 2009 iMac model.
- No matching DP_VIDEO_OFF (iMac11,1-only residual on DPMS off).
- Resume/eDP power follow-up is a separate patch, not included.
UNRESOLVED:
- lore.kernel.org/stable search (HTTP 403).
- b4 dig on the candidate SHA (commit not in this tree).
- Whether a later VIDEO_OFF/resume patch exists upstream after v5.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — v5 matches maintainer request; tested on iMac11,1; Reviewed-by + maintainer SOB.
2. Fixes a real bug that affects users? **PASS** — dark KMS display on that iMac.
3. Important issue? **PASS** — unusable internal display; hardware-quirk class already accepted for the sibling iMacs.
4. Small and contained? **PASS** — two files, ~20 lines.
5. No new features or APIs? **PASS** — DMI quirk on existing driver paths.
6. Can apply to the local tree? **PASS** — context matches 6.12.111.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **Hardware quirk/workaround** (Apple DMI encoder/PLL/DP command). Explicitly allowed for stable.
**Step 9.4: DECISION**
This should be backported to this 6.12 tree. It is the same class of Apple radeon eDP quirk as iMac10,1 and iMac11,2, which this tree already carries. iMac11,1 is RV770/DCE3.1, so it never matched ASIC_IS_DCE32() and still boots with a dark panel. The fix is small, DMI-limited, applies cleanly, and was narrowed specifically so it does not retune other DCE3.1 boards.
Verification:
- [Phase 1] Parsed subject/tags/body from the provided commit; no Fixes/Cc-stable (expected).
- [Phase 2] Diff: atombios_adjust_pll FRAC_FB_DIV, radeon_atom_encoder_dpms_dig DP_VIDEO_ON, radeon_atom_pick_dig_encoder DMI block moved out of DCE32.
- [Phase 2] Confirmed local code at atombios_encoders.c:1710 and :2130-2135 and atombios_crtc.c:597 matches the pre-image.
- [Phase 3] git blame: PLL a02dc74b317d78 (2012), VIDEO_ON 3f03ced8808792 (2011), Apple DMI 564d8a2cf3abf (2017) / 05eacc198c68c (2023).
- [Phase 3] git merge-base --is-ancestor 564d8a2cf3abf and 05eacc198c68c vs HEAD: both present.
- [Phase 3] radeon_family.h: CHIP_RV770 immediately before CHIP_RV730; ASIC_IS_DCE32 is >= CHIP_RV730.
- [Phase 3] No Gilles Risch radeon commits in this tree; Alex Deucher is the maintainer.
- [Phase 4] v5 lore: Message-ID [email protected].
- [Phase 4] Alex v4 comment (lists.freedesktop.org/amd- gfx/2026-May/145586.html): do not use ASIC_IS_DCE31() for routing; use iMac11,1 dmi_match + goto assigned.
- [Phase 4] Lukas Wunner Reviewed-by on v2 (ratatoskr.run/amd- gfx/2026/05/9273941).
- [Phase 4] lore.kernel.org fetches: 403. UNVERIFIED: stable@ discussion.
- [Phase 4] b4 mbox v5 msgid: 30 messages found, local save failed.
UNVERIFIED: full mbox dump.
- [Phase 5] Callers: radeon_atom_encoder_prepare → pick encoder; radeon_atom_encoder_dpms → UNIPHY dpms_dig; atombios_adjust_pll from CRTC mode set.
- [Phase 6] git describe HEAD = p-6.12-3-gc504cf0baa3d8; make kernelversion = 6.12.111; iMac11,1 absent from radeon/.
- [Phase 8] Failure mode: dark internal panel on KMS load, severity HIGH for that DMI product.
- UNVERIFIED: whether a post-v5 DP_VIDEO_OFF/resume patch later landed upstream.
**YES**
drivers/gpu/drm/radeon/atombios_crtc.c | 5 ++++- drivers/gpu/drm/radeon/atombios_encoders.c | 23 ++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +4 -1
@@ -24,6 +24,8 @@* Alex Deucher */ +#include <linux/dmi.h> +#include <drm/drm_fixed.h> #include <drm/drm_fourcc.h> #include <drm/drm_framebuffer.h>
@@ -594,7 +596,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,if (((rdev->family ==CHIP_RS780 ) || (rdev->family ==CHIP_RS880 )) && !radeon_crtc->ss_enabled) radeon_crtc->pll_flags |=RADEON_PLL_USE_FRAC_FB_DIV ; -if (ASIC_IS_DCE32 (rdev) && mode->clock >165000 ) +if ((ASIC_IS_DCE32 (rdev) ||dmi_match (DMI_PRODUCT_NAME ,"iMac11,1" )) + && mode->clock >165000 ) radeon_crtc->pll_flags |=RADEON_PLL_USE_FRAC_FB_DIV ; }else { radeon_crtc->pll_flags |=RADEON_PLL_LEGACY ;
drivers/gpu/drm/radeon/atombios_encoders.c +13 -10
@@ -1707,7 +1707,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (encoder)) && connector) {/* DP_SET_POWER_D0 is set in radeon_dp_link_train */ radeon_dp_link_train (encoder, connector); -if (ASIC_IS_DCE4 (rdev)) +if (ASIC_IS_DCE4 (rdev) ||dmi_match (DMI_PRODUCT_NAME ,"iMac11,1" ))atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_DP_VIDEO_ON ,0 ); }if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT )) {
@@ -2123,17 +2123,20 @@ int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder, int fe_idx) }/* -* On DCE32 any encoder can drive any block so usually just use crtc id, -* but Apple thinks different at least on iMac10,1 and iMac11,2, so there use linkb, -* otherwise the internal eDP panel will stay dark. +* Apple routes the internal eDP panel through Link B of the DIG encoder +* instead of Link A on the iMac10,1, iMac11,1 and iMac11,2. +* Use linkb to avoid a dark display. */ -if (ASIC_IS_DCE32 (rdev)) { -if (dmi_match (DMI_PRODUCT_NAME ,"iMac10,1" ) || -dmi_match (DMI_PRODUCT_NAME ,"iMac11,2" )) - enc_idx = (dig->linkb) ?1 :0 ; -else - enc_idx = radeon_crtc->crtc_id; +if (dmi_match (DMI_PRODUCT_NAME ,"iMac10,1" ) || +dmi_match (DMI_PRODUCT_NAME ,"iMac11,1" ) || +dmi_match (DMI_PRODUCT_NAME ,"iMac11,2" )) { + enc_idx = (dig->linkb) ?1 :0 ; + goto assigned; + } +/* on DCE32 and encoder can driver any block so just crtc id */ +if (ASIC_IS_DCE32 (rdev)) { + enc_idx = radeon_crtc->crtc_id; goto assigned; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/etnaviv: check MMUv2 status after reset
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit 4720915ab48282429f9e22ad5984b7870e4e962c ]
A full GPU reset is the only way to disable the MMUv2 and the driver depends on the MMU being disabled after a reset to be able to properly restart the GPU. Validate this assumption by checking that the reset actually did disable the MMU.
---
LLM Generated explanations, may be completely bogus:
The local tree is **v7.3-rc4**. The etnaviv reset path is present here; this patch closes a hole in how reset success is detected so hang recovery can reprogram MMUv2.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [drm/etnaviv] [check] [verify MMUv2 is actually disabled after GPU reset]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Reviewed-by: Christian Gmeiner \<[email protected]\> (etnaviv reviewer in MAINTAINERS)
- Link: https://patch.msgid.link/20260511085148.652256-2-
[email protected] (series 2/2)
- Signed-off-by: Lucas Stach \<[email protected]\> (etnaviv maintainer)
- No Fixes:, Reported-by:, Tested-by:, or Cc: stable (absence of Fixes/Cc:stable is expected for this review)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record: [Bug] After a full GPU reset the driver assumes MMUv2 is off so it can restart the GPU. [Symptom] If that is false, restart proceeds with MMU still enabled. [Versions] None stated. [Root cause] Reset success was inferred from idle bits only; MMU ENABLE was never checked.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Yes. Wording is “validate this assumption,” but it is a missing success check on a load-bearing invariant: restore skips reprogramming if ENABLE is still set.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record: drivers/gpu/drm/etnaviv/etnaviv_gpu.c +17/−0. Function:etnaviv_hw_reset(). Single-file surgical fix.
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record: Before: after idle/2D/3D checks, reset is treated as success.
After: on MMUv2 cores, if VIVS_MMUv2_CONTROL_ENABLE / VIVS_MMUv2_SEC_CONTROL_ENABLE is still set, retry until timeout then -EBUSY. Affects probe reset and hang-recovery reset.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: [Logic / correctness] Reset retry loop did not confirm MMU disable. etnaviv_iommuv2_restore_{nonsec,sec}() returns immediately if ENABLE is set (“state is still there”). After reset the driver drops gpu->mmu_context. If ENABLE is still set, restore skips page-table reload and the FE is started against stale MMU state.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct; matches existing idle retry. Regression risk:
stricter success could yield more -EBUSY if ENABLE is sticky. That is better than proceeding with MMU still on. Maintainer-authored; low risk.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record: Reset retry exists since a8c21a5451d83 (etnaviv initial driver, v4.5). MMUv2 restore early-return is afb7b3b1deb47 (v4.8-rc1). Hole is long-standing.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. N/A.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Patch 1/2 is 1006d1f7c03d9 (“check all modules for idle after reset”) — sibling robustness, not required for this hunk. Related stable-bound history: 725cbc7884c37 (MMU state lost on reset), f978a5302f556 (MMU context leak on reset), 8f3eea9d01d7b (keep MMU across runtime PM because that path avoids full reset). Standalone vs
series: series 2/2, self-contained.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Lucas Stach is listed maintainer of “DRM DRIVERS FOR VIVANTE GPU IP”. Christian Gmeiner is a listed reviewer. Same author wrote the 2021 MMU-reset invariant patches.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Uses existing gpu_read, chipMinorFeatures1_MMU_VERSION, ETNA_SEC_KERNEL, and MMUv2 registers. No new helpers. Can apply standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record: [Lore]
https://patch.msgid.link/[email protected]
[Revisions] v1 only (b4 dig -a).
[Review] Christian Gmeiner Reviewed-by; no NAK, no stable nomination, no risk discussion. Direct lore.kernel.org fetch returned 403 (Anubis); thread recovered via b4 dig -m.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To: [email protected]; Cc: dri-devel, Christian Gmeiner. Right lists and reviewer.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by, bugzilla, or syzbot. No user incident in the message or thread.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: [PATCH 1/2] drm/etnaviv: check all modules for idle after reset is the other half. This MMU check does not depend on the idle_mask change.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search blocked (403/Anubis). UNVERIFIED:
no confirmed stable-list discussion.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: etnaviv_hw_reset()
**Step 5.2: TRACE CALLERS**
Record:
- etnaviv_gpu_init() (~line 891): probe; failure fails bind.
- etnaviv_gpu_recover_hang() (~line 1530): GPU hang recovery; return value ignored (pre-existing).
**Step 5.3: TRACE CALLEES**
Record: gpu_read/gpu_write of idle, clock, and MMUv2 control. On
success: etnaviv_gpu_update_clock(), drop mmu_context.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Userspace GPU submit → scheduler timeout (etnaviv_sched.c) → etnaviv_gpu_recover_hang() → reset → etnaviv_gpu_hw_init() → etnaviv_gpu_start_fe_idleloop() → etnaviv_iommu_restore(). Reachable from normal DRM clients on hang. Also probe.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same ENABLE test in restore is the complementary invariant. Idle-bit retry in the same loop is the same pattern.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. git describe HEAD = v7.3-rc4-27-gf0100363d8c37; make kernelversion = 7.3.0-rc4. etnaviv_hw_reset() and restore early- return are here. Bug dates to MMUv2 restore (v4.8). git merge-base --is-ancestor afb7b3b1deb471 HEAD succeeded.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Clean apply. Insertion is after the 2D/3D idle check, which has been there since the original driver.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: 2021 MMU-reset state patches are here. No earlier equivalent of this ENABLE check. No follow-up reverting or amending this commit.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: [drm/etnaviv] [IMPORTANT] Vivante GPU on i.MX and similar embedded SoCs; not core mm/vfs, but common in Android/embedded.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained (reset, hangcheck, IOMMU work through 2026). Mature driver, not staging.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific: CONFIG_DRM_ETNAVIV, MMUv2 cores (chipMinorFeatures1_MMU_VERSION).
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Successful-looking reset that leaves ENABLE set. Hit on probe and on hang recovery. Hang recovery is a normal DRM scheduler path (not privileged). How often ENABLE stays set is unverified; the retry loop exists because Vivante reset is already unreliable.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: [Failure] After reset, software drops MMU context while hardware may still have ENABLE. Restore then skips pagetable reload. FE starts with stale translations → GPU re-hang, faults, or DMA to reused pages. [Severity] HIGH (broken recovery; possible GPU DMA to wrong memory). Not a host oops by itself.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record: [Benefit] HIGH for etnaviv hang recovery / probe restart correctness. [Risk] LOW (17 lines, same retry style as existing idle checks). Sticky ENABLE could fail reset more often; that failure was previously silent and wrong.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Load-bearing invariant: full reset is the only way to disable MMUv2; restore skips work if ENABLE is still set (intentional for runtime PM, fatal after reset).
- Same class of bug as 2021 stable-tagged 725cbc7884c37 (keep HW/SW MMU state from diverging).
- 17-line surgical check in an existing retry loop.
- Maintainer + listed reviewer; no NAKs.
- Path is userspace-reachable via GPU hang recovery.
- Applies cleanly here; no missing helpers.
AGAINST:
- Framed as assumption validation, not a reported crash.
- No Fixes:/Reported-by/Tested-by/syzbot.
- Series 2/2 of reset hardening; sibling is also robustness.
- Stricter success could increase -EBUSY (probe fail / ignored in recover_hang).
- GPU-only, not core kernel.
UNRESOLVED:
- No evidence ENABLE-stuck-after-reset was observed on hardware.
- Stable list search could not be completed (lore 403).
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — reviewed by etnaviv reviewer; logic matches existing idle retry.
2. Fixes a real bug that affects users? **PASS** — missing check allows HW/SW MMU divergence after reset; restore then skips reprogramming.
3. Important issue? **PASS** — hang recovery can leave GPU wedged or DMA with stale translations (HIGH, not host panic).
4. Small and contained? **PASS** — +17 lines, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — same file/function/registers exist.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID, quirk table, DT, build, or docs fix). Qualifies as a normal contained bugfix.
**Step 9.4: MAKE YOUR DECISION**
This tree has the buggy reset/restore pair. The patch is a small, correct completion of reset-success detection so MMUv2 restart actually reloads pagetables. That is stable-worthy here.
What it solves for users of this tree: GPU reset (probe and hang recovery) can look successful while MMUv2 ENABLE is still set. The driver then drops its MMU context and restore bails out, so the FE can run on stale translations. Checking ENABLE and retrying closes that hole.
Risk vs benefit: benefit is correct recovery; risk is a slightly stricter reset with a 1s retry budget, authored by the maintainer.
Concerns: no field report of ENABLE stuck after reset; lore.kernel.org web was blocked. Neither outweighs the code-level invariant.
Verification:
- [Phase 1] Parsed tags: Reviewed-by Christian Gmeiner; Link patch.msgid.link 2/2; author Lucas Stach; no Fixes/Reported-by
- [Phase 2] Diff: +17 lines in etnaviv_hw_reset() adding MMUv2 ENABLE retry
- [Phase 3] git blame: restore ENABLE early-return afb7b3b1deb47 (v4.8); reset loop a8c21a5451d83 (v4.5)
- [Phase 3] Related: 725cbc7884c37 / 8f3eea9d01d7b document reset vs PM MMU invariants; both were Cc:stable
- [Phase 3] Series: parent 1006d1f7c03d9 is 1/2 idle_mask check; this hunk does not need it
- [Phase 4] b4 dig -c 4720915ab4828: original at patch.msgid.link/[email protected]
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] b4 dig -w: etnaviv@, dri-devel@, Christian Gmeiner
- [Phase 4] b4 dig -m: Gmeiner Reviewed-by both patches; no NAK; no Cc:stable in thread
- [Phase 4] lore.kernel.org WebFetch/curl: 403 Anubis — stable-list search UNVERIFIED
- [Phase 5] Callers: etnaviv_gpu_init (probe), etnaviv_gpu_recover_hang from etnaviv_sched.c timeout
- [Phase 5] Restore: etnaviv_iommuv2_restore_nonsec/sec return if ENABLE set
- [Phase 6] git describe HEAD: v7.3-rc4-27-gf0100363d8c37; kernelversion 7.3.0-rc4
- [Phase 6] git merge-base --is-ancestor afb7b3b1deb471 HEAD: yes, buggy restore in this tree
- [Phase 6] Registers VIVS_MMUv2_CONTROL_ENABLE / SEC_CONTROL_ENABLE in state_hi.xml.h
- [Phase 8] Failure mode: hang recovery with stale MMU → GPU re-hang / wrong DMA; severity HIGH
- UNVERIFIED: whether ENABLE-stuck-after-reset was seen on hardware; whether stable@ discussed it
**YES**
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +17 -0
@@ -598,6 +598,23 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)continue ; } +/* try resetting again if MMUv2 is not disabled */ +if (gpu->identity.minor_features1 & chipMinorFeatures1_MMU_VERSION) { +if (gpu->sec_mode ==ETNA_SEC_KERNEL ) { +if (gpu_read (gpu, VIVS_MMUv2_SEC_CONTROL) & + VIVS_MMUv2_SEC_CONTROL_ENABLE) { +dev_dbg (gpu->dev,"MMU is not disabled\n" ); +continue ; + } + }else { +if (gpu_read (gpu, VIVS_MMUv2_CONTROL) & + VIVS_MMUv2_CONTROL_ENABLE) { +dev_dbg (gpu->dev,"MMU is not disabled\n" ); +continue ; + } + } + } +/* enable debug register access */ control &= ~VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS ;gpu_write (gpu,VIVS_HI_CLOCK_CONTROL , control);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 clk: tegra: support 48MHz clock for pll_p_out1
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 46e31d69a547530fbef499bde888b6bb45a1deac ]
UEFI on Surface2 sets pll_p_out1 to 48MHz which is not supported by kernel and causes BUG() early on. Add 48MHz clock support for pll_p_out1.
---
LLM Generated explanations, may be completely bogus:
The local tree is **v7.3-rc4** (mainline). The change is a one-line parent-rate case that stops a deterministic early-boot BUG() when UEFI leaves pll_p_out1 at 48 MHz. Surrounding _calc_rate logic has been in-tree since 2013, so this is a self-contained crash fix, not a new API.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[clk: tegra:] [support] [allow pll_p_out1 parent rate 48 MHz in _calc_rate so firmware-programmed 48 MHz does not hit BUG()]**
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- **Acked-by:** Thierry Reding <[email protected]> (Tegra maintainer)
- **Signed-off-by:** Dmitry Osipenko (author; long-time Tegra clk contributor)
- **Signed-off-by:** Jonas Schwöbel
- **Signed-off-by:** Svyatoslav Ryhel (submitter)
- **Signed-off-by:** Brian Masney (clk maintainer who applied it)
- **No Fixes:** tag (expected)
- **No Cc: stable** (expected)
- **No Reported-by / Tested-by / Link:**
- Ignore any Sasha Levin SOB if present in a candidate wrapper; none on the real commit 46e31d69a5475
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- **Bug:** UEFI on Microsoft Surface 2 programs pll_p_out1 to 48 MHz. _calc_rate() only accepted 9.6 MHz and 28.8 MHz in that switch arm; 48 MHz fell into default: which prints an error and calls BUG().
- **Symptom:** kernel BUG() during early clock init (boot crash).
- **Root cause:** missing parent-rate case in the out-of-table PLL calculator used when PLLA’s freq table has no matching input rate.
- **Version info:** none in the message. Cover letter (v2 0/1) says the case is aligned with NVIDIA downstream 3.4 tegra114 logic.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: **Not a hidden fix.** Subject says “support” but the body is
explicit: this prevents BUG(). It is a firmware/hardware compatibility quirk, not a new clock API.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- **File:** drivers/clk/tegra/clk-pll.c (+1 / −0)
- **Function:** _calc_rate()
- **Scope:** single-file, one case 48000000: added next to existing 9.6/28.8 MHz cases
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- **Before:** parent_rate == 48000000 → default → pr_err + BUG().
- **After:** same arm as 9.6/28.8 MHz: cfreq = parent_rate / (parent_rate / 1000000) (1 MHz for 48 MHz), then existing M/N/P calculation and range checks.
- **Path:** clock-init clk_set_rate() on PLLA (and any other PLL using default _calc_rate). Error path only in the sense that the old path was a fatal default; this is the out-of-table rate calculator, not a new userspace API.
Verified boot path in this tree:
- Tegra114 init_table sets TEGRA114_CLK_PLL_A to 564480000 (clk- tegra114.c).
- tegra_init_from_table() calls clk_set_rate().
- PLLA parent is "pll_p_out1" (tegra114_audio_plls[]).
- pll_a_freq_table[] only lists 9600000 and 28800000 input rates, so _get_table_rate() fails and _calc_rate() runs.
- That is the BUG() the commit describes.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- **Category:** (h) hardware/firmware workaround + (g) logic: missing switch case that caused (kernel BUG()).
- **Mechanism:** firmware leaves a valid PLLP divider output of 48 MHz; the calculator treated it as an impossible reference and crashed.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- **Quality:** obviously correct. Same formula already used for the other PLLP_OUT1 rates. Tegra maintainer acked it.
- **Minimal:** one line, no API/data-structure change.
- **Regression risk:** very low. Extra parent rate only changes the 48 MHz path; other rates unchanged.
- **Nuance (verified):** tegra114 PLLA uses pllp_nmp.divm_width = 5, so divm_max is 31. For 48 MHz, cfg->m = 48, which can fail the existing cfg->m > divm_max check and return -EINVAL instead of programming PLLA. That is still far better than BUG():
clk_pll_set_rate() then WARN_ONs and returns. Completeness of PLLA programming is a separate issue; the crash is fixed.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Switch and BUG() introduced in **8f8f484bf355e5** (“clk: tegra:
add Tegra specific clocks”, Prashant Gaikwad, 2013-01-11; in v3.9 era).
- 9.6/28.8 MHz formula adjusted in **e52d7c04bb3911** (2015).
- 48 MHz case added by **46e31d69a5475** (this commit).
- Buggy missing-rate behavior has been present for ~13 years.
Step 3.2: FOLLOW THE FIXES: TAG
Record: **No Fixes: tag.** Not applicable. Introduced by the original 2013 Tegra clk driver, not a recent regression.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent clk-pll.c commits are unrelated (GFP helpers, determine_rate, RPM). This commit is **standalone**, not patch X/Y of a clk series. Author/submitter Tegra DT work around the same time (TF600T, grouper, tegra114 EMC) does not need to land with this 1-line clk case.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Dmitry Osipenko is a regular Tegra clk contributor (Don't allow zero clock rate, PLLU config, gate refcounting, etc.). Submitter Ryhel resubmitted with maintainer Ack. Applied by Brian Masney.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: **None.** Diff only adds a case label. _calc_rate, the 9.6/28.8 arm, and BUG() default all exist in this file independently of later refactors. Can apply standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- **b4 dig:**
https://patch.msgid.link/[email protected]
- **v1:** 2026-04-17 [email protected]
- **v2 / resend:** 2026-04-27 (cover + patch); Thierry Ack 2026-05-28
- Cover letter: “Fix this by adding 48MHz clock support… aligned with downstream 3.4 kernel for tegra114 logic”
- **No NAK.** Only reviewer reply was Thierry’s **Acked-by**.
- **No Cc: stable** in review (absence is not a negative).
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: Recipients included Stephen Boyd, Michael Turquette, Thierry Reding, Jonathan Hunter, linux-clk, linux-tegra. **Thierry Reding acked.** Right maintainers were on the thread.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No bugzilla/syzbot link. Description is a concrete firmware+hardware trigger (Surface 2 UEFI), not theoretical. Surface 2 has **no in-tree DT** (tegra114 boards present: dalmore, roth, tn7, asus-tf701t only). Users still hit this with UEFI + out-of-tree/work-in- progress DT; the clk driver is in-tree for all Tegra114.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Series is **v2 0/1 + 1/1**. Self-contained. No sibling patch required for the BUG() fix.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: **UNVERIFIED** — lore.kernel.org returned 403 (Anubis). Original linux-tegra/linux-clk thread was retrieved via b4 dig -m; no stable- list discussion in that mbox.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS
Record: **_calc_rate()** only.
Step 5.2: TRACE CALLERS
Record:
- Default pll->params->calc_rate in _tegra_clk_register_pll() for non-PLLM PLLs.
- Called from **clk_pll_set_rate()** and **clk_pll_determine_rate()** when _get_table_rate() misses.
- Tegra210 PLLs use tegra210_pll_fixed_mdiv_cfg instead; this path is **tegra20/30/114/124**.
- Context: boot clock init and later audio PLL rate changes. Not a syscall-hot path, but **every boot** on affected firmware.
Step 5.3: TRACE CALLEES
Record: Integer divider math only (cfreq, m/n/p). No allocation, no locks inside _calc_rate. clk_pll_set_rate takes pll->lock after calc.
Step 5.4: FOLLOW THE CALL CHAIN
Record:tegra114_clock_init → tegra_clk_apply_init_table → tegra_init_from_table → clk_set_rate(pll_a, 564480000) → clk_pll_set_rate → _calc_rate.
**Reachable from boot on Tegra114 when parent is 48 MHz.** Unprivileged userspace is not required; firmware state is enough.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Same _calc_rate switch is the single shared calculator. No duplicate 48 MHz holes in sibling functions. Freq tables still lack 48 MHz PLLA rows (out-of-table path is intentional, per comment).
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record:
- Tree: **git describe HEAD = v7.3-rc4-27-gf0100363d8c37**, VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4.
- git merge-base --is-ancestor 46e31d69a5475 HEAD → **already in this checkout** (landed in v7.3-rc1).
- The **vulnerable pattern** (_calc_rate switch + BUG() on unknown parent rate) is here and dates to 2013. The 48 MHz hole is what this commit fills. This is not post-7.3 code; older stables that still lack the case have the bug.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply** on any tree that still has the 9.6/28.8 arm without case 48000000:. Context in this file is stable. No backport rewrite needed.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: This **is** the fix (46e31d69a5475). No earlier alternate 48 MHz handling in clk-pll.c.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: **drivers/clk/tegra** — SoC clock driver. **IMPORTANT** for NVIDIA Tegra 20/30/114/124, not core-mm/VFS. Boot-blocking on those SoCs.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Mature driver (2013), still receiving fixes. This is a long- standing hole, not churn from a new subsystem.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Platform/firmware-specific:** Tegra boards whose firmware sets pll_p_out1 to 48 MHz. Documented trigger is **Surface 2 UEFI**. Any tegra20/30/114/124 PLL using default _calc_rate with that parent rate.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: **Every boot** with that firmware, during CAR init table application. Not a race. Not unprivileged-syscall; **unusable machine** if you boot Linux on that hardware.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: **BUG() on boot → CRITICAL** for affected devices (oops/panic, system does not come up). After the fix, worst case on tegra114 is -EINVAL + WARN_ON if M overflows, not a hard BUG().
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- **Benefit:** high for those devices (boot vs die); moderate overall (narrow hardware).
- **Risk:** very low (one case label, existing formula).
- **Ratio:** strongly favors taking it. Matches the **hardware quirk** stable exception (USB/PCI quirk analogue: one-line table addition so existing driver survives real firmware).
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
**FOR:**
- Deterministic early-boot BUG(), verified via init_table → clk_set_rate(pll_a) → _calc_rate.
- One-line, obviously correct, same math as 9.6/28.8 MHz.
- Acked by Tegra maintainer Thierry Reding; applied by clk maintainer.
- Code path present since 2013; no prerequisites.
- Hardware/firmware quirk, not a new UAPI.
**AGAINST:**
- Subject looks like a feature (“support 48MHz”).
- Surface 2 DT is not in mainline; user population is small.
- PLLA 5-bit M may still reject the computed m=48 (WARN instead of BUG). Incomplete programming, but the crash is gone.
- No syzbot/CVE/Fixes tag (expected for this review queue).
**UNRESOLVED:**
- Stable-list discussion (lore 403).
- Whether every tegra114 board with 48 MHz pll_p_out1 can actually lock PLLA after this; downstream 3.4 used this same case.
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — one case, maintainer Ack, in mainline since v7.3-rc1.
2. Fixes a real bug that affects users? **PASS** — UEFI Surface 2 (and same firmware pattern) BUG() at boot.
3. Important issue? **PASS** — boot BUG(), severity CRITICAL for that hardware.
4. Small and contained? **PASS** — +1 line, one function.
5. No new features or APIs? **PASS** — quirk: accept a parent rate the hardware/firmware already programs. No new sysfs/uapi/driver.
6. Can apply to the local tree? **PASS** — surrounding _calc_rate exists; patch is a single case add (already present on this 7.3-rc4 HEAD because the candidate came from this lineage).
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Hardware quirk/workaround** (firmware-programmed clock the driver must not BUG() on). Analogous to USB/PCI quirk table entries.
Step 9.4: MAKE YOUR DECISION
This is a surgical boot-crash fix for a real firmware configuration. It meets stable rules and the quirk exception. Limited hardware does not disqualify it: obscure-device quirks are routinely taken. Incomplete PLLA table entries do not restore the BUG(), so they are not a reason to reject.
What problem it solves: Tegra _calc_rate() treated 48 MHz pll_p_out1 as illegal and called BUG() while setting PLLA during clock init. Surface 2 UEFI programs that rate.
Risk vs benefit: one case vs a boot panic. Benefit dominates.
Concerns: no in-tree Surface 2 DT; possible later -EINVAL if M overflows. Neither makes the BUG() acceptable to leave in stable.
Verification:
- [Phase 1] Tags: Acked-by Thierry Reding; SOBs Osipenko, Schwöbel, Ryhel, Masney; no Fixes/Cc-stable/Reported-by
- [Phase 2] Diff: +1 line case 48000000: in _calc_rate() in drivers/clk/tegra/clk-pll.c
- [Phase 2] tegra114 init_table sets PLLA 564480000; parent pll_p_out1; freq table has no 48 MHz input → _calc_rate on boot
- [Phase 2] divm_width=5 → m=48 may -EINVAL after the fix; BUG() still avoided
- [Phase 3] git blame: switch/BUG() from 8f8f484bf355e5 (2013); this commit 46e31d69a547530fbef499bde888b6bb45a1deac
- [Phase 3] git merge-base --is-ancestor 46e31d69a5475 HEAD → already in this 7.3-rc4 tree
- [Phase 3] No Fixes tag; standalone; no prerequisite commits
- [Phase 4] b4 dig -c 46e31d69a5475 → lore patch-id match; v1 2026-04-17, v2 2026-04-27
- [Phase 4] b4 dig -a: v1 then v2 (“aligned with downstream 3.4”)
- [Phase 4] b4 dig -w: linux-clk, linux-tegra, Thierry, Boyd, Hunter
- [Phase 4] mbox: Thierry Acked-by; no NAK
- [Phase 4] lore WebFetch 403; stable list UNVERIFIED
- [Phase 5] callers: clk_pll_set_rate, clk_pll_determine_rate; default calc_rate for non-PLLM
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; Makefile 7.3.0-rc4; file and BUG() default present
- [Phase 6] No other 48 MHz pll_p_out1 fix in this file
- [Phase 7] clk/tegra, important for Tegra SoCs
- [Phase 8] Failure mode: BUG() at boot, CRITICAL for affected firmware
- UNVERIFIED: stable@ discussion; whether PLLA actually locks at 564.48 MHz with 48 MHz parent on Surface 2 hardware
**YES**
drivers/clk/tegra/clk-pll.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-pll.c +1 -0
@@ -575,6 +575,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,break ;case 9600000 :case 28800000 : +case 48000000 :/* * PLL_P_OUT1 rate is not listed in PLLA table */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] clk: tegra: support 48MHz clock for pll_p_out1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] clk: tegra: _calc_rate() always fails with -EINVAL for 48MHz parent_rate --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: tegra: _calc_rate() always fails with -EINVAL for 48MHz parent_rate --
commit 5b85244997fd59cc85d760a4c82ed76c458e3f43
Author: Dmitry Osipenko <[email protected]>
clk: tegra: support 48MHz clock for pll_p_out1
This patch adds 48 MHz parent rate handling in _calc_rate() to avoid hitting a BUG() when UEFI configures pll_p_out1 to 48 MHz on Surface 2.
drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 581
Quoted 12 lines
drivers/clk/tegra/clk-pll.c +1
-0@@ -575,6 +575,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,break ;case 9600000 :case 28800000 : +case 48000000 :/* * PLL_P_OUT1 rate is not listed in PLLA table */
[Severity: Medium]
When parent_rate is 48000000, this switch arm in _calc_rate() in drivers/clk/tegra/clk-pll.c computes:
cfreq = parent_rate / (parent_rate / 1000000);
which evaluates to 1000000 (1 MHz). Later in _calc_rate(), cfg->m is calculated and validated against divm_max(pll):
cfg->m = parent_rate / cfreq;
cfg->n = cfg->output_rate / cfreq;
cfg->cpcon = OUT_OF_TABLE_CPCON;
if (cfg->m == 0 || cfg->m > divm_max(pll) ||
cfg->n > divn_max(pll) || (1 << p_div) > divp_max(pll) ||
cfg->output_rate > pll->params->vco_max) {
return -EINVAL;
}For parent_rate == 48000000 and cfreq == 1000000, cfg->m is 48. However, pll_a uses a 5-bit input divider across Tegra114/124 (via pllp_nmp in drivers/clk/tegra/clk-tegra114.c) and Tegra20/30 (via default_nmp in drivers/clk/tegra/clk-pll.c):
static struct div_nmp pllp_nmp = {
.divm_shift = 0,
.divm_width = 5,
...
};Because divm_max(pll) is 31, cfg->m > divm_max(pll) is always true when cfg->m is 48.
When UEFI sets pll_p_out1 to 48 MHz, won't _calc_rate() unconditionally return -EINVAL whenever clk_pll_set_rate() or clk_pll_determine_rate() is called on pll_a, causing tegra114_clock_init() -> tegra_clk_apply_init_table() -> tegra_init_from_table() in drivers/clk/tegra/clk.c to fail to configure TEGRA114_CLK_PLL_A and hit WARN_ON(1)?
if (tbl->rate)
if (clk_set_rate(clk, tbl->rate)) {
pr_err("%s: Failed to set rate %lu of %s\n",
__func__, tbl->rate,
__clk_get_name(clk));
WARN_ON(1);
}Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 Bluetooth: hci_sync: Disable legacy instance's ext adv before setup snapshot
In reply to Sasha LevinFrom: Muhammad Saheed <[email protected]>
[ Upstream commit 75722cde87ee24029e93e4e32d85309989f55991 ]
hci_setup_ext_adv_instance_sync(...) only disabled HCI_OP_LE_SET_EXT_ADV_ENABLE before setup snapshot in case of non-legacy instances (instance > 0) and never disabled the same for legacy instance (instance == 0). This would lead to failure in setting ext adv params with HCI_ERROR_COMMAND_DISALLOWED (0x0c) error like below, when toggling the discoverable/connectable property of a controller with advertising enabled.
``` $ btmgmt advertising off hci0 Set Advertising complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable on hci0 Set Connectable complete, settings: powered connectable ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable off hci0 Set Connectable complete, settings: powered ssp br/edr le secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt advertising on hci0 Set Advertising complete, settings: powered connectable ssp br/edr le advertising secure-conn wide-band-speech cis-central cis-peripheral $ btmgmt connectable on Set Connectable for hci0 failed with status 0x0a (Busy) $ btmgmt connectable off Set Connectable for hci0 failed with status 0x0a (Busy) $ dmesg ... [ 21.970527] hci0: Opcode 0x2036 [ 21.970529] hci0: opcode 0x2036 plen 25 [ 21.970537] hci0: skb len 28 [ 21.970539] hci0: length 1 [ 21.976099] hci0: result 0x0c [ 21.976105] hci0: end: err -16 [ 21.976114] Bluetooth: hci0: Opcode 0x2036 failed: -16 ```
---
LLM Generated explanations, may be completely bogus:
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
I have the local-tree picture: 6.12.111 still has the instance > 0 hole, the prerequisites are already present, and the patch applies. The rest of this is the full nine-phase write-up.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Record: [Bluetooth / hci_sync] [Disable] legacy instance 0 extended advertising must be turned off before setup snapshot, matching the existing non-legacy path
**Step 1.2: Tags**
- Record: No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Link:, or Cc: stable. Signed-off-by: Muhammad Saheed (author), Luiz Augusto von Dentz (Bluetooth maintainer). Absence of Fixes/Cc: stable is expected for this review pipeline and is not a negative signal.
**Step 1.3: Body**
- Record: [Bug] hci_setup_ext_adv_instance_sync() only calls HCI_OP_LE_SET_EXT_ADV_ENABLE disable for instance > 0. Legacy instance 0 stays enabled, so HCI_OP_LE_SET_EXT_ADV_PARAMS (opcode 0x2036) is rejected with HCI_ERROR_COMMAND_DISALLOWED (0x0c).
- [Symptom] btmgmt connectable on/off while advertising is enabled fails with MGMT Busy (0x0a). dmesg: Opcode 0x2036 failed: -16.
- [Version] none stated.
- [Root cause] the disable-before-snapshot comment already describes the HCI rule; instance 0 was left out because hci_disable_ext_adv_instance_sync(hdev, 0) means “disable all sets” (num_of_sets = !!instance).
**Step 1.4: Hidden bug fix?**
- Record: Not disguised. This is an explicit correctness fix for a documented HCI restriction.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- Record: One file, net/bluetooth/hci_sync.c, +30/−0. New helper hci_disable_ext_adv_legacy_instance_sync(). Call added in hci_setup_ext_adv_instance_sync() instance == 0 branch.
Classification: single-file surgical fix.
**Step 2.2: Code flow**
- Before: instance > 0 disables that set, then snapshots under lock. instance == 0 only sets adv = NULL and proceeds to hci_set_ext_adv_params_sync().
- After: instance 0 first sends LE_SET_EXT_ADV_ENABLE disable for handle 0x00 if HCI_LE_ADV_0 is set; otherwise no-op. Then the existing param-update path runs.
- Path: normal MGMT connectable/discoverable/advertising reconfiguration, not an error-only path.
**Step 2.3: Bug mechanism**
- Record: [Logic / HCI command-order] Spec forbids updating parameters of an active extended advertising set. Non-legacy sets were already disabled. Legacy set 0 was not. Cannot reuse hci_disable_ext_adv_instance_sync(hdev, 0) because that function treats 0 as “all sets” (cp->num_of_sets = !!instance). New helper sends num_of_sets=1, enable=0, handle=0x00, gated on HCI_LE_ADV_0.
**Step 2.4: Fix quality**
- Record: Obviously correct: mirrors the instance>0 path and the existing enable command layout. Minimal. Regression risk is low:
disable is skipped unless instance 0 is actually enabled; hci_start_ext_adv_sync() re-enables after setup. Same “if disable/setup fails, advertising may stay off” behavior as the non- legacy path. No public API change.
## Phase 3: Git history
**Step 3.1: Blame**
- Record: Disable-before-snapshot intent is from cba6b758711c (“Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2”, 2021-10). Current if (instance > 0) / else { adv = NULL; } shape is from 95cdcd8c82a50 (“Bluetooth: hci_sync: Fix advertising data UAFs”, Chengfeng Ye, already in this tree). HCI_LE_ADV_0 is from 3a9dfe641913b (stable backport of 0d92808024b4e, 2025-10-01), also in this tree.
**Step 3.2: Fixes tag**
- Record: None. Bug is the incomplete original disable logic from cba6b758711c, which is in this tree. The correct instance-0 disable needs HCI_LE_ADV_0, which is also here.
**Step 3.3: File history**
- Record: Recent hci_sync.c work is UAF/locking (95cdcd8c82a50), advertising instance free on failure, accept-list UAF. No conflicting rewrite of this setup snapshot. Standalone patch, not X/Y.
**Step 3.4: Author**
- Record: Muhammad Saheed has this one Bluetooth commit on origin/master. Applied by subsystem maintainer Luiz Augusto von Dentz.
**Step 3.5: Prerequisites**
- Record: Needs HCI_LE_ADV_0 (present: 3a9dfe641913b) and the post- UAF if (instance > 0) ... else { adv = NULL; } shape (present:
95cdcd8c82a50). git apply --check of 75722cde87ee2 succeeded (hunks at +21 lines). No later origin/master commit touches hci_disable_ext_adv_legacy_instance_sync. Standalone.
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**
- Record: b4 dig -c 75722cde87ee2 → https://patch.msgid.link/202608042
[email protected]. Single v1, no later revision. Thread (gnuweeb lore, lore.kernel.org 403): submission, BlueZ CI bot, patchwork “applied to bluetooth-next by Luiz”. No NAK, no reviewer-requested changes.
**Step 4.2: Recipients (b4 dig -w)**
- Record: [email protected], Luiz von Dentz, Marcel Holtmann. Right maintainers/list.
**Step 4.3: Bug report**
- Record: No external bugzilla/syzbot. Author included a concrete btmgmt repro and dmesg. Opcode 0x2036 is HCI_OP_LE_SET_EXT_ADV_PARAMS in this tree. HCI 0x0c maps to EBUSY in bt_to_errno(); mgmt maps -EBUSY to MGMT_STATUS_BUSY (0x0a). Matches the reported userspace error.
**Step 4.4: Series**
- Record: Standalone v1. Not part of a multi-patch series.
**Step 4.5: Stable list**
- Record: gnuweeb /stable/ search for this subject returned no dedicated discussion (only unrelated release noise). No recorded reason to exclude it.
**CI note:** BlueZ bot: CheckPatch/build PASS. mgmt-tester 494/501 (LL Privacy unpair timeouts, Read Exp Feature); mesh send-cancel timeouts. Failures are not advertising/connectable cases. Maintainer still applied the patch (2d4711f5ad1b in bluetooth-next; 75722cde87ee2 on origin/master).
## Phase 5: Semantic / impact surface
**Step 5.1: Functions**
- Record: Added hci_disable_ext_adv_legacy_instance_sync(). Modified hci_setup_ext_adv_instance_sync().
**Step 5.2: Callers of setup**
- Record (verified in this tree):
- hci_start_ext_adv_sync() → connectable update, set advertising, discoverable+limited privacy, re-enable adv, periodic adv start
- hci_powered_update_adv_sync() with instance 0x00
- set_le_sync() in mgmt.c with 0x00
- add_ext_adv_params_sync() uses cp->instance (MGMT rejects instance < 1, so not the legacy path)
**Step 5.3: Callees**
- Record: __hci_cmd_sync_status(HCI_OP_LE_SET_EXT_ADV_ENABLE, ...). Same command the existing disable helper uses.
**Step 5.4: Reachability**
- Record: Userspace MGMT (btmgmt/bluetoothctl Set Connectable / Set Discoverable / Set Advertising). hci_update_connectable_sync() calls hci_start_ext_adv_sync(hdev, hdev->cur_adv_instance) when HCI_ADVERTISING is set; set_adv_sync() sets cur_adv_instance = 0x00. Repro path is real and unprivileged for a local Bluetooth admin (typically root/netdev).
**Step 5.5: Similar patterns**
- Record: Instance > 0 already disabled before snapshot. hci_disable_ext_adv_instance_sync() cannot target only handle 0. HCI_LE_ADV_0 was added specifically because instance 0 is not in adv_instances. This commit fills that remaining hole.
## Phase 6: Local tree (6.12.111, branch pending-6.12)
**Step 6.1: Buggy code present?**
- Record: Yes. net/bluetooth/hci_sync.c hci_setup_ext_adv_instance_sync() lines 1387–1400 still skip disable for instance 0. Helper name is absent (grep found no hci_disable_ext_adv_legacy_instance_sync). git merge-base --is- ancestor 75722cde87ee2 HEAD is false. Introduced conceptually in 2021 (cba6b758711c); instance-0 tracking needed for a correct fix landed in this tree as 3a9dfe641913b.
**Step 6.2: Backport difficulty**
- Record: Clean apply (git apply --check succeeded). Context matches after Chengfeng UAF backport.
**Step 6.3: Related fixes already here?**
- Record: HCI_LE_ADV_0 tracking is here. Chengfeng UAF restructure is here. No substitute that disables legacy instance 0 before param snapshot.
## Phase 7: Subsystem context
**Step 7.1:** Record: net/bluetooth HCI command-sync / LE extended advertising. Criticality: IMPORTANT (common controllers, BlueZ MGMT), not core mm/fs.
**Step 7.2:** Record: Actively maintained; Luiz is the Bluetooth HCI maintainer and applied this. Advertising instance 0 is the legacy “Set Advertising” path used by typical desktop/embedded BlueZ setups.
## Phase 8: Impact and risk
**Step 8.1:** Record: Users of Bluetooth 5+ controllers (ext_adv_capable) who enable LE advertising and then change connectable/discoverable. Very common on modern hardware.
**Step 8.2:** Record: Trigger is ordinary btmgmt connectable on/off (or equivalent bluetoothctl/DBus) while advertising is on. Not a rare race. Local mgmt socket; not a remote unprivileged network attack.
**Step 8.3:** Record: Failure mode is HCI Command Disallowed → kernel -EBUSY → MGMT Busy. Advertising parameters are not updated; connectable/discoverable toggle fails. Not a panic/UAF. Severity: HIGH for Bluetooth management (core LE advertising reconfiguration is broken), MEDIUM overall versus crash/corruption.
**Step 8.4:** Record: Benefit high for 6.12 users with BT5 controllers. Risk low: 30 lines, flag-gated, same command as existing helper, applies cleanly, no API/data-structure change.
## Phase 9: Synthesis
**Step 9.1: Evidence**
FOR:
- Real, reproduced user-visible bug with matching opcode/status mapping in this tree
- Completes an already-documented disable-before-update rule that already exists for instance > 0
- Small, surgical, obviously correct
- Prerequisites (HCI_LE_ADV_0, setup-function shape) already in 6.12.111
- Applies cleanly
- Maintainer-applied; v1 only; no NAK
- Common mgmt path, not staging/experimental
AGAINST:
- Not a crash, UAF, leak, or CVE
- Workaround: turn advertising off, change connectable, turn it back on
- First-time author (mitigated by maintainer SOB)
- BlueZ CI had unrelated tester timeouts
UNRESOLVED:
- lore.kernel.org HTTP 403; thread read via b4 + gnuweeb instead
- No dedicated stable-list thread
**Step 9.2: Stable rules**
1. Obviously correct and tested? **PASS** — mirrors existing disable path; author repro; kernel + mgmt-tester build; maintainer applied
2. Real bug affecting users? **PASS** — connectable toggle fails while advertising
3. Important? **PASS** — breaks LE advertising reconfiguration on ext- adv hardware (Busy, not oops, but a serious functional failure of a common mgmt operation)
4. Small and contained? **PASS** — +30 lines, one file
5. No new features/APIs? **PASS** — HCI command already used; no new userspace API
6. Applies to this tree? **PASS** — verified git apply --check
**Step 9.3: Exceptions**
- Record: Not a device-ID/quirk/DT/build/docs exception. Qualifies as a contained functional HCI bug fix.
**Step 9.4: Decision**
This 6.12 tree still has the instance-0 hole. The helper it needs can use HCI_LE_ADV_0, which is already backported. The patch is small, applies, and restores a management operation that fails on typical Bluetooth 5 controllers. That is enough for this tree.
---
### What the commit solves, and why it matters here
On 6.12.111, enabling LE advertising (legacy instance 0) and then changing connectable/discoverable issues LE Set Extended Advertising Parameters while that set is still enabled. Controllers reject it (0x0c → -EBUSY → MGMT Busy). Non-legacy instances were already disabled first; instance 0 was not, because the generic disable helper treats 0 as “all sets.” This commit disables only handle 0x00 when HCI_LE_ADV_0 is set, then continues the existing snapshot/update/re- enable flow.
### Risk vs benefit
Benefit: restores a common BlueZ management operation on ext-adv hardware. Risk: low; disable is conditional, command layout matches the existing helper, and hci_start_ext_adv_sync() re-enables afterward. No follow-up fix exists on origin/master.
### Concerns
None that block backport on this tree. Prerequisites are present. Apply is clean. Not a crash, but the failure is user-visible and easy to hit.
### Verification
- [Phase 1] Parsed subject/body/tags from git log -1 --format=fuller 75722cde87ee2; no Fixes/Cc/Reported-by
- [Phase 2] Diff: +30 in hci_sync.c; helper + 4-line call in instance==0 branch
- [Phase 2] Confirmed hci_disable_ext_adv_instance_sync() uses cp->num_of_sets = !!instance so instance 0 disables all sets
- [Phase 2] Confirmed opcode 0x2036 is HCI_OP_LE_SET_EXT_ADV_PARAMS; bt_to_errno(0x0c)=EBUSY; mgmt -EBUSY → Busy 0x0a
- [Phase 3] git describe HEAD / make kernelversion: pending-6.12, 6.12.111
- [Phase 3] git merge-base --is-ancestor 75722cde87ee2 HEAD: not in tree
- [Phase 3] blame: disable comment from cba6b758711c; if (instance > 0) from 95cdcd8c82a50; HCI_LE_ADV_0 from 3a9dfe641913b
- [Phase 3] git merge-base --is-ancestor 3a9dfe641913b HEAD: yes; 95cdcd8c82a50 in HEAD: yes
- [Phase 3] git apply --check of 75722cde87ee2: success
- [Phase 3] git log origin/master -S hci_disable_ext_adv_legacy_instance_sync -- net/bluetooth/hci_sync.c:
only this commit
- [Phase 4] b4 dig -c 75722cde87ee2 / -a / -w: v1 only; Luiz + linux-bluetooth; lore msgid as above
- [Phase 4] gnuweeb thread: CI bot + patchwork applied; no NAK
- [Phase 4] lore.kernel.org WebFetch: 403 (used b4/gnuweeb)
- [Phase 5] Callers traced in hci_sync.c / mgmt.c; connectable path uses cur_adv_instance (0 after Set Advertising)
- [Phase 6] Local setup function still skips disable for instance 0
- [Phase 8] Failure: MGMT Busy, not oops; severity HIGH for BT mgmt, MEDIUM vs crash class
- UNVERIFIED: Could not fetch lore.kernel.org HTML directly (403)
**YES**
net/bluetooth/hci_sync.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
net/bluetooth/hci_sync.c +30 -0
@@ -1184,6 +1184,32 @@ int hci_update_random_address_sync(struct hci_dev *hdev, bool require_privacy,return 0 ; } +static int hci_disable_ext_adv_legacy_instance_sync (struct hci_dev *hdev) +{ +struct hci_cp_le_set_ext_adv_enable *cp; +struct hci_cp_ext_adv_set *set; +u8 data[sizeof (*cp) +sizeof (*set) *1 ]; +u8 size; + +if (!hci_dev_test_flag (hdev,HCI_LE_ADV_0 )) +return 0 ; + +memset (data,0 ,sizeof (data)); + + cp = (void *)data; + set = (void *)cp->data; + + cp->num_of_sets =0x01 ; + cp->enable =0x00 ; + + set->handle =0x00 ; + + size =sizeof (*cp) +sizeof (*set) * cp->num_of_sets; + +return __hci_cmd_sync_status (hdev,HCI_OP_LE_SET_EXT_ADV_ENABLE , + size, data,HCI_CMD_TIMEOUT ); +} +static int hci_disable_ext_adv_instance_sync (struct hci_dev *hdev,u8 instance) {struct hci_cp_le_set_ext_adv_enable *cp;
@@ -1409,6 +1435,10 @@ int hci_setup_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)return -EINVAL ; } }else { + err =hci_disable_ext_adv_legacy_instance_sync (hdev); +if (err) +return err; + adv =NULL ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/panel-edp: Add BOE NE160QDM-NY1 panel
In reply to Sasha LevinFrom: Damon Ding <[email protected]>
[ Upstream commit be4f10d44757211fd656fa57f37034657f26c883 ]
Add an entry for the BOE NE160QDM-NY1 eDP panel. The panel's AUX backlight functionality is verified and working on the RK3576 EVB1 board.
edid-decode (hex):
00 ff ff ff ff ff ff 00 09 e5 85 09 00 00 00 00
1c 1e 01 04 b5 22 15 78 03 7c e5 a4 55 4c 9f 26
0f 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 6b 6e 00 a0 a0 40 84 60 30 20
36 00 58 d7 10 00 00 1a 00 00 00 fd 0c 3c a5 1f
1f 4e 01 0a 20 20 20 20 20 20 00 00 00 fe 00 42
4f 45 20 43 51 0a 20 20 20 20 20 20 00 00 00 fe
00 4e 45 31 36 30 51 44 4d 2d 4e 59 31 0a 01 ed
02 03 1d 00 e3 05 80 00 e6 06 05 01 6a 6a 24 6d
1a 00 00 02 03 3c a5 00 04 6a 24 6a 24 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff
---
LLM Generated explanations, may be completely bogus:
This is a one-line eDP panel ID for a driver that already exists in 6.18.y. That matches the stable device-ID exception, and unknown panels already WARN_ON on probe.
Local tree: **6.18.53** (v6.18.53-5049-g0f0bdc2b0dffb, Makefile VERSION=6 PATCHLEVEL=18 SUBLEVEL=53). Upstream commit be4f10d44757 is **not** in v6.18.53; panel-edp.c and delay_200_500_e50 are.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Record: [drm/panel-edp] [Add] [BOE NE160QDM-NY1 panel table entry]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Record: No Fixes: (expected). No Reported-by / Tested-by / `Cc:
stable`.
- Reviewed-by: Douglas Anderson <[email protected]> (panel-edp reviewer in MAINTAINERS)
- Signed-off-by: Damon Ding <[email protected]> (author)
- Signed-off-by: Douglas Anderson <[email protected]> (drm-misc maintainer path)
- `Link:
https://patch.msgid.link/20260625071916.744686-1-damon.ding@rock-
chips.com`
- Ignored: [Upstream commit be4f10d44757…], Signed-off-by: Sasha Levin (candidate pipeline)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
- Record: [Bug] Generic edp-panel probe looks up EDID vendor/product in edp_panels[]. BOE 0x0985 is missing, so this panel is treated as unknown.
- [Symptom] Kernel WARN_ON on probe plus conservative delays (unprepare=2000, enable=200) instead of the panel’s 500/50 ms sequence. AUX backlight was verified on RK3576 EVB1.
- [Version] None stated.
- [Root cause] Missing table entry; timings otherwise come from EDID.
**Step 1.4: DETECT HIDDEN BUG FIXES**
- Record: Not a disguised cleanup. It is a device-ID addition. The unknown-panel path also fires a deliberate WARN_ON, so the ID stops a real boot warning.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- Record: drivers/gpu/drm/panel/panel-edp.c +1 / −0. One function/data
object: edp_panels[]. Single-file surgical change.
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
- Record: Before: BOE IDs jump 0x0979 → 0x098d. After: 0x0985 maps to &delay_200_500_e50 named "NE160QDM-NY1". Only the generic EDID lookup path in generic_edp_panel_probe() is affected.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
- Record: [Category] Hardware ID / quirk table. [Mechanism] Missing EDID product ID; find_edp_panel() returns NULL → WARN_ON + conservative delays. The new row uses an existing delay struct.
**Step 2.4: ASSESS THE FIX QUALITY**
- Record: Obviously correct: one EDP_PANEL_ENTRY in vendor/product sort order. EDID bytes 09 e5 85 09 decode to BOE + 0x0985. Regression risk is very low (only this ID). No API, lock, or lifetime changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
- Record: Surrounding BOE rows date from 2021–2026. Table machinery:
5f04e7ce392db (2021-09-20, split from panel-simple) and 5540cf8f3e8da (generic EDID-probed panels). Both are ancestors of v6.18.53.
**Step 3.2: FOLLOW THE FIXES: TAG**
- Record: No Fixes: tag. Not applicable. The “bug” is an absent ID, not a later regression.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
- Record: v6.18.53 already has many drm/panel-edp: Add … ID patches (72 log hits). Standalone; not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
- Record: Damon Ding has another panel-edp ID add (LP079QX1-SP0V). Reviewer Douglas Anderson is listed under “DRM DRIVER FOR GENERIC EDP PANELS”.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
- Record: Needs EDP_PANEL_ENTRY, delay_200_500_e50, and edp_panels[] — all present in v6.18.53. Applies standalone.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
- Record: b4 dig -c be4f10d44757 →
https://patch.msgid.link/20260625071916.744686-1-damon.ding@rock-
chips.com
- b4 dig -a: single **v1**, no later revisions.
- Doug Anderson: Reviewed-by and pushed to drm-misc-next as be4f10d44757. No NAKs, no stable discussion in-thread.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
- Record: b4 dig -w To/Cc: Douglas Anderson, Neil Armstrong, drm-misc maintainers, dri-devel, linux-kernel. Right audience.
**Step 4.3: SEARCH FOR THE BUG REPORT**
- Record: No syzbot/bugzilla. Author tested AUX backlight on RK3576 EVB1. Panelook lists this as a 16" eDP laptop panel (Lenovo FRUs); that is third-party catalog data, not a kernel bug report.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
- Record: Standalone 1/1 series. No prerequisite panel patches.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
- Record: lore.kernel.org/stable returned HTTP 403. Unverified whether stable@ already discussed this ID. Same class of adds is already in 6.18.y.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS**
- Record: Data only: edp_panels[]. Consumers: find_edp_panel(), generic_edp_panel_probe().
**Step 5.2: TRACE CALLERS**
- Record: find_edp_panel() ← generic_edp_panel_probe() ← panel_edp_probe() when DT compatible is "edp-panel". Also panel_edp_platform_probe / DP-AUX probe. Probe-time, not interrupt.
**Step 5.3: TRACE CALLEES**
- Record: Lookup is a table walk (drm_edid_match / panel_id compare). Match copies delay_200_500_e50. Miss calls panel_edp_set_conservative_timings() after WARN_ON.
**Step 5.4: FOLLOW THE CALL CHAIN**
- Record: Userspace cannot call this directly. Any machine with compatible = "edp-panel" and this EDID hits it at boot (Chromebooks, Qualcomm laptops, Rockchip EVBs, etc.).
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
- Record: Same one-line EDP_PANEL_ENTRY pattern used throughout the table. No duplicate BOE 0x0985.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
- Record: Yes. v6.18.53 panel-edp.c has 0x0979 then 0x098d; 0x0985 is absent. git merge-base --is-ancestor be4f10d44757 v6.18.53 is false. delay_200_500_e50 and the unknown-panel WARN_ON are present.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
- Record: Clean apply. Insertion point and neighbors match the upstream diff. Expected difficulty: clean apply.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
- Record: No other 0x0985 / NE160QDM-NY1 entry in v6.18.53. (HEAD on autosel already has the candidate; that is pipeline state, not a reason to skip the technical YES.)
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
- Record: [drm/panel-edp] [IMPORTANT] — common generic eDP path for ARM/laptop panels, not core mm/VFS. DRM_PANEL_EDP depends on OF.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
- Record: Active; 6.18.y already backports many panel IDs. Mature table plus ongoing ID adds.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
- Record: Driver/config-specific: CONFIG_DRM_PANEL_EDP + this BOE panel + generic edp-panel. RK3576 EVB1 DTS is in 6.18.53 (main DTS has HDMI, not eDP; matching is EDID-based so any edp-panel board with this module benefits).
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
- Record: Every probe of this panel. Not a race. Unprivileged users do not trigger it; boot/display init does. Common for that hardware.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
- Record: [WARN_ON + conservative 2s unprepare] [MEDIUM]. Display usually still works; boot warning and slow power sequencing are the user-visible issues. Without the ID, AUX backlight can still work (author’s point is that it was tested once identified).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
- Record: [Benefit: high for those panels — stops WARN_ON, correct delays] [Risk: very low, +1 table line] [Ratio: strongly favors backport]
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Stable rule: “fix a real bug **or just add a device ID**” (Documentation/process/stable-kernel-rules.rst).
- Explicit exception: new IDs in an existing driver.
- One line; uses existing delay_200_500_e50.
- Stops WARN_ON(!panel->detected_panel) in generic_edp_panel_probe().
- Reviewed and merged by the panel-edp reviewer.
- Driver and helpers exist in this 6.18.y tree; apply is clean.
- Same class of commits is already routine in this series.
AGAINST:
- Not a crash/UAF/CVE.
- Affects only this panel.
- No Cc: stable (not a negative under these rules).
UNRESOLVED:
- lore.kernel.org/stable search was 403.
- Upstream RK3576 EVB1 DTS does not describe the eDP panel; hardware enablement still depends on DT/edp-panel on the board.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — v1 accepted; tested on RK3576 EVB1; maintainer R-b.
2. Fixes a real bug that affects users? **PASS** — missing ID is the documented device-ID case; also avoids WARN_ON.
3. Important issue? **PASS** as device-ID exception (WARN_ON is MEDIUM, not panic).
4. Small and contained? **PASS** — +1 line, one file.
5. No new features or APIs? **PASS** — ID only, existing driver.
6. Can apply to the local tree? **PASS** — context identical in v6.18.53.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
- Record: **Device ID addition to existing driver** (EDP_PANEL_ENTRY = EDID vendor/product ID).
**Step 9.4: DECISION**
Backport. This is the standard panel-edp ID add: hardware support plus removal of a probe WARN_ON, with negligible risk on 6.18.y.
---
### What problem it solves for stable users
Boards using generic edp-panel with a BOE NE160QDM-NY1 (EDID BOE 0x0985) currently miss the table, hit WARN_ON every boot, and use 2000/200 ms conservative delays instead of 500/50 ms. Adding the ID matches how this driver is meant to be extended.
### Risk vs benefit
Benefit: correct sequencing and no warning on that panel. Risk: one sorted table row, no behavior change for other IDs.
### Concerns
None for this tree. No extra commits required. Ignore pipeline markers ([Upstream commit], Sasha SOB, presence on autosel).
---
Verification:
- [Phase 1] Parsed subject/tags: Add panel ID; R-b dianders; Link msgid 20260625071916.744686-1; no Fixes/syzbot
- [Phase 1] Body: AUX backlight tested on RK3576 EVB1; full EDID dump
- [Phase 2] Diff: +1 EDP_PANEL_ENTRY('B','O','E',0x0985,&delay_200_500_e50,"NE160QDM- NY1") in edp_panels[]
- [Phase 2] EDID 09 e5 85 09 → BOE + product 0x0985 (verified against commit hex)
- [Phase 2] generic_edp_panel_probe():
WARN_ON(!panel->detected_panel) then panel_edp_set_conservative_timings() (unprepare 2000, enable 200)
- [Phase 3] git describe HEAD / make kernelversion: 6.18.53
- [Phase 3] git merge-base --is-ancestor be4f10d44757 v6.18.53: **no** (not in the release)
- [Phase 3] git grep NE160QDM-NY1 v6.18.53 -- panel-edp.c: missing
- [Phase 3] delay_200_500_e50 at v6.18.53:panel-edp.c:1746; neighbors 0x0979 then 0x098d — clean insert
- [Phase 3] Driver added 5f04e7ce392db (2021); generic table 5540cf8f3e8da; both in 6.18.53
- [Phase 3] git log v6.18.53 --grep='drm/panel-edp: Add': 72 similar ID commits already in this series
- [Phase 4] b4 dig -c be4f10d44757: v1 only; lore msgid as in Link
- [Phase 4] b4 dig -a: no v2+
- [Phase 4] b4 dig -w: dianders, dri-devel, drm-misc maintainers
- [Phase 4] Anderson reply: Reviewed-by + pushed drm-misc-next be4f10d44757; no NAK
- [Phase 4] lore.kernel.org/stable: **UNVERIFIED** (HTTP 403)
- [Phase 5] Callers: panel_edp_probe → generic_edp_panel_probe if compatible = "edp-panel"
- [Phase 5] No duplicate 0x0985 in panel-edp.c
- [Phase 6] rk3576-evb1-v10.dts exists in v6.18.53; no eDP panel node in that DTS (EDID match still applies wherever edp-panel is used)
- [Phase 7] MAINTAINERS: “DRM DRIVER FOR GENERIC EDP PANELS”, R: Douglas Anderson
- [Phase 8] Failure: WARN_ON + slow unprepare; not oops; device-ID exception still applies
- UNVERIFIED: stable@ archive discussion; how many shipping laptops use this exact module
**YES**
drivers/gpu/drm/panel/panel-edp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-edp.c +1 -0
@@ -1975,6 +1975,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0964 , &delay_200_500_e50,"NV133WUM-N61" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x096e , &delay_200_500_e50_po2e200,"NV116WHM-T07 V8.0" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0979 , &delay_200_500_e50,"NV116WHM-N49 V8.0" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0985 , &delay_200_500_e50,"NE160QDM-NY1" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x098d , &boe_nv110wtm_n61.delay,"NV110WTM-N61" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0993 , &delay_200_500_e80,"NV116WHM-T14 V8.0" ), EDP_PANEL_ENTRY('B', 'O', 'E', 0x09ad, &delay_200_500_e80, "NV116WHM-N47"),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 crypto: keembay - use crypto_memneq() to compare GCM AEAD tags
In reply to Sasha LevinFrom: "David C.C.M. Gall" <[email protected]>
[ Upstream commit 353b3a85136f2a0cf3e872acf8ad6c1dec0b7a8e ]
Use crypto_memneq() for constant-time comparison.
The GCM path in keembay-ocs-aes-core.c verifes the received authentication tag with memcmp(), which returns early on the first mismatched byte. This leaks valid-prefix length and allows for valid tag forgery which violates the INT-CTXT guarantee of AEAD.
---
LLM Generated explanations, may be completely bogus:
This is a 3-line constant-time tag compare for Keem Bay GCM decrypt. The local tree is **6.12.111** (pending-6.12, p-6.12-3-gc504cf0baa3d8). The buggy memcmp() is present; the candidate is not.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [crypto: keembay] [use] [replace memcmp with crypto_memneq for GCM AEAD tag compare]
- Subsystem: crypto: keembay (Intel Keem Bay OCS AES driver)
- Action verb: **use** (the body is a security fix: constant-time compare)
- Intent: stop early-exit memcmp() from leaking valid-tag prefix length
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Fixes:** none (expected)
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by:** none
- **Acked-by:** none
- **Link:** none
- **Cc: stable:** none (expected)
- **Assisted-by:** gregkh_clanker_t1000
- **Signed-off-by:** David C.C.M. Gall <[email protected]> (author)
- **Signed-off-by:** Herbert Xu <[email protected]> (crypto maintainer, applied it)
SHA: 353b3a85136f2a0cf3e872acf8ad6c1dec0b7a8e
AuthorDate: 2026-08-07. No syzbot, no multi-reporter pattern.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** GCM decrypt checks the received auth tag with memcmp(), which returns on the first mismatch.
- **Symptom/failure mode:** timing leak of matching-prefix length; that leak can be used to forge a valid tag and break AEAD **INT-CTXT** (integrity of ciphertext).
- **Version info:** none in the message.
- **Root cause (author):** non-constant-time compare of in_tag vs out_tag.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. It is an explicit crypto security fix (timing side channel / AEAD integrity), even without the word “fix” in the subject.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/crypto/intel/keembay/keembay-ocs-aes-core.c (+2 / −1)
- Functions: #include plus kmb_ocs_aead_run()
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Include hunk:** adds #include <crypto/utils.h> (declares crypto_memneq()).
- **Compare hunk (GCM decrypt only):** after ocs_aes_gcm_op(), if rctx->instruction == OCS_DECRYPT:
- Before: `rc = memcmp(rctx->in_tag, rctx->out_tag, tag_size) ?
-EBADMSG : 0;`
- After: `rc = crypto_memneq(rctx->in_tag, rctx->out_tag, tag_size) ?
-EBADMSG : 0;`- Encrypt path, CCM path, and DMA cleanup are unchanged.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** cryptographic timing / logic correctness (not UAF, leak, race).
- **Mechanism:** memcmp() is not constant-time. crypto_memneq() is (lib/crypto/memneq.c, noinline). Both treat 0 as equal, so -EBADMSG vs 0 is unchanged; only timing changes.
CCM still uses memcmp() in ocs-aes.c:ccm_compare_tag_to_yr(); that is a sibling patch (ff2ac77a034e0), not a dependency of this one.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: one-for-one substitution with the API crypto drivers already use for MAC/tag compares (talitos, nx, atmel- aes, stm32-cryp, etc. in this tree).
- Minimal; no API/data-structure change.
- Regression risk: very low. Return mapping matches. crypto_memneq is slightly slower by design (no early exit); that is the fix.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Introduced in 88574332451380f4b51f6ca88ab9810e714bfb9b (“crypto:
keembay - Add support for Keem Bay OCS AES/SM4”), 2020-12-11, Mike Healy.
- Original hunk: rc = memcmp(rctx->in_tag, rctx->out_tag, tag_size) ?
- Present since **v5.11** (git merge-base --is-ancestor vs v5.10 fails, vs v5.11 succeeds). Long-standing, not recent.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Functionally this fixes the original driver commit 8857433245138, which **is** an ancestor of this 6.12 HEAD.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record (this tree, that file): OF alias, IRQ completion init, AEAD unregister count, platform-remove conversion, crypto_engine_op, prepare/unprepare removal, path move. None of those change the GCM memcmp. Standalone vs the CCM sibling (patch 2/2, different file).
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: David C.C.M. Gall is not the keembay maintainer. On crypto- next the same author has a batch of crypto_memneq conversions:
keembay GCM, keembay CCM, sa2ul, octeontx, octeontx2, ccree. Crypto maintainer Herbert Xu applied this one.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record:
- Needs crypto_memneq / crypto/utils.h — both exist here (include/crypto/utils.h, lib/crypto/memneq.c).
- crypto/internal/aead.h already includes crypto/algapi.h → crypto/utils.h, so the extra include is redundant but matches mainline and is harmless.
- No prerequisite series beyond this one hunk. git apply --check of 353b3a85136f2 succeeded on this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 353b3a85136f2:
https://patch.msgid.link/[email protected]
- b4 dig -a: single revision, **v1** [PATCH 1/2]. No v2/v3.
- Saved thread /tmp/keembay-gcm-memneq.mbox (2 messages).
- Herbert Xu (2026-08-15): “All applied. Thanks.” No NAK, no review nits, **no Cc: stable**.
- Direct lore WebFetch returned 403; discussion taken from the b4 mbox.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc Herbert Xu, David S. Miller, linux-crypto, linux-kernel, [email protected]. Subsystem maintainer was included and applied the patch. No Reviewed-by tags.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by, no syzbot, no bugzilla. Issue is from code review / known memcmp-vs-MAC pattern, not a user crash report.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Series is 2/2. Patch 2 is CCM memcmp in ocs-aes.c. Independent of this GCM change. Same pattern as historical stable-bound fixes:
- 79960943fdc11 crypto: talitos - Fix timing leak in ESP ICV verification (Cc: stable)
- cb8affb55c7e6 crypto: nx - Fix timing leak in GCM and CCM decryption (Cc: stable)
Both are already ancestors of this 6.12 HEAD.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable WebFetch returned 403. **UNVERIFIED** whether anyone already asked for this on stable@. Original crypto thread has no stable nomination.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
No semcode MCP tools. Used grep + file reads.
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Record: kmb_ocs_aead_run() (only runtime change).
**Step 5.2: TRACE CALLERS**
Record:
- kmb_ocs_aes_aead_do_one_request() → kmb_ocs_aead_run()
- Engine op .do_one_request for gcm(aes), ccm(aes), gcm(sm4), ccm(sm4)
- Encrypt/decrypt entry: kmb_ocs_aes_gcm_decrypt / kmb_ocs_sm4_gcm_decrypt → kmb_ocs_aead_common() → crypto_transfer_aead_request_to_engine()
- CCM returns before the changed lines; only GCM decrypt hits memcmp/crypto_memneq.
**Step 5.3: TRACE CALLEES**
Record: After ocs_aes_gcm_op(), compare tags, then kmb_ocs_aead_dma_cleanup(). No extra alloc/lock from this hunk.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record:
- Registered as gcm(aes) / gcm(sm4) with priority 350.
- CRYPTO_ALG_KERN_DRIVER_ONLY means HW accel not via a userspace ISA; it is **not** CRYPTO_ALG_INTERNAL. af_alg.c allows that flag, so AF_ALG can still select the driver.
- Also used by in-kernel AEAD (IPsec, TLS, etc.) when this HW is chosen.
- Path is reachable whenever Keem Bay OCS AES is enabled and GCM decrypt runs.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Remaining memcmp in this driver is CCM (ocs-aes.c:1285), sibling commit. Other HW AEAD drivers in this tree already use crypto_memneq.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** drivers/crypto/intel/keembay/keembay-ocs-aes- core.c:922 still has memcmp(rctx->in_tag, rctx->out_tag, tag_size). Introduced v5.11; present in 6.12. Candidate is **not** an ancestor of HEAD (git merge-base --is-ancestor 353b3a85136f2 HEAD failed).Kconfig: CRYPTO_DEV_KEEMBAY_OCS_AES_SM4 depends on ARCH_KEEMBAY || COMPILE_TEST. ARCH_KEEMBAY exists (arch/arm64/Kconfig.platforms).
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Surrounding GCM decrypt block matches the patch. crypto/utils.h exists.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No keembay crypto_memneq commit in this tree. GCM memcmp still there.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record:
- Subsystem: drivers/crypto/intel/keembay (platform crypto accelerator)
- Criticality: **PERIPHERAL** for most 6.12 users (Keem Bay / Movidius SoC only), but the bug is a real AEAD integrity issue for those users.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature driver (2020). Recent 6.12 commits are small correctness/build items, not a rewrite of GCM tag handling.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver/platform-specific:CONFIG_CRYPTO_DEV_KEEMBAY_OCS_AES_SM4 on Keem Bay, GCM(AES/SM4) decrypt on that HW.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Every successful GCM decrypt on this engine compares tags. Trigger is ordinary decrypt, not a rare error path. Unprivileged users can hit it via AF_ALG or via kernel users of gcm(aes). Practical exploitation needs timing measurement (local is realistic; remote is harder). The integrity guarantee is still broken even if remote exploit is hard.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Failure: timing leak of valid-tag prefix → tag forgery → **INT-CTXT** failure (forged ciphertext accepted).
- Severity: **HIGH** (crypto/security). Not a panic/deadlock. Same class historically sent to stable (talitos/nx).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** restores AEAD integrity for Keem Bay GCM users on 6.12 LTS.
- **Risk:** very low (3 lines, equivalent control flow, well-used helper).
- **Ratio:** benefit > risk. Niche HW lowers population, not the correctness of backporting a tiny security fix.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR backporting:**
- Real AEAD security bug (non-constant-time tag compare / INT-CTXT).
- Buggy memcmp is in this 6.12 tree since the v5.11 driver.
- 3-line, obviously correct, applies cleanly.
- crypto_memneq already in tree; same pattern used by other drivers here.
- Crypto maintainer applied it; historical sibling timing-leak fixes were stable-bound.
- No new API/feature.
**AGAINST:**
- Peripheral SoC (ARCH_KEEMBAY), small user base.
- No user/syzbot report, no CVE, no Cc: stable.
- AI-assisted; no Tested-by/Reviewed-by besides maintainer apply.
- CCM memcmp remains until the sibling patch (this GCM fix is still complete on its own).
**UNRESOLVED:**
- Stable@ search 403 (whether anyone already nominated this).
- No public measurement of exploitability on this SoC (generic memcmp-MAC analysis still holds).
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — one helper swap; maintainer applied; helper is the standard MAC compare. No extra runtime test tags.
2. Fixes a real bug that affects users? **PASS** — GCM decrypt on this HW uses memcmp today.
3. Important issue? **PASS** — AEAD integrity / timing side channel (HIGH), not a crash.
4. Small and contained? **PASS** — 3 lines, one file, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — git apply --check succeeded.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not a device-ID/quirk/DT/build/docs exception. Qualifies as a small security correctness fix.
**Step 9.4: MAKE YOUR DECISION**
The patch closes a real INT-CTXT hole with a 3-line, clean apply on this 6.12 tree. Niche hardware is not a reason to leave a known AEAD tag- timing bug in LTS.
### What it solves for this tree
Keem Bay OCS GCM decrypt still uses early-exit memcmp on the auth tag. That leaks how much of the tag matched and can be used to forge tags. Replacing it with crypto_memneq() makes the compare constant-time without changing success/failure semantics.
### Risk vs benefit
Benefit is restoring AEAD integrity for that decrypt path. Risk is
negligible: same branch structure, established helper, no locking or API change.
---
Verification:
- [Phase 1] Parsed tags: Assisted-by gregkh_clanker_t1000; SOBs Gall + Herbert Xu; no Fixes/Reported-by/Cc:stable
- [Phase 1] SHA 353b3a85136f2a0cf3e872acf8ad6c1dec0b7a8e on crypto- next; not ancestor of HEAD
- [Phase 2] Diff: +crypto/utils.h, memcmp → crypto_memneq in kmb_ocs_aead_run() GCM decrypt
- [Phase 2] Confirmed remaining CCM memcmp in ocs-aes.c:1285 is sibling ff2ac77a034e0, not required here
- [Phase 2] crypto_memneq returns 0 equal / 1 unequal — same ternary as memcmp
- [Phase 3] git blame: memcmp from 8857433245138 (2020-12-11); in tree since v5.11
- [Phase 3] git merge-base --is-ancestor 8857433245138 HEAD succeeded
- [Phase 3] git apply --check of the candidate on this tree: success
- [Phase 3] Author’s related commits on crypto-next: keembay CCM, sa2ul, octeontx, ccree memneq conversions
- [Phase 4] b4 dig -c:
https://patch.msgid.link/[email protected]
- [Phase 4] b4 dig -a: v1 only, [PATCH 1/2]
- [Phase 4] b4 dig -w: Herbert Xu, davem, linux-crypto, gregkh CC’d
- [Phase 4] mbox: Herbert “All applied. Thanks.”; no NAK, no stable nomination
- [Phase 4] Direct lore/stable WebFetch: 403 — UNVERIFIED for stable@ archive
- [Phase 4] Historical same-class fixes 79960943fdc11 (talitos) and cb8affb55c7e6 (nx) have Cc: stable and are in this tree
- [Phase 5] Call chain: kmb_ocs_aes_gcm_decrypt → kmb_ocs_aead_common → engine → kmb_ocs_aes_aead_do_one_request → kmb_ocs_aead_run
- [Phase 5] Algs: gcm(aes)/gcm(sm4) priority 350; KERN_DRIVER_ONLY is not INTERNAL; AF_ALG allows that flag
- [Phase 6] git describe HEAD: p-6.12-3-gc504cf0baa3d8; make kernelversion: 6.12.111
- [Phase 6] Line 922 still memcmp(...) in this checkout
- [Phase 6] include/crypto/utils.h and lib/crypto/memneq.c present
- [Phase 7] Kconfig depends on ARCH_KEEMBAY || COMPILE_TEST; ARCH_KEEMBAY in arm64 Kconfig.platforms
- [Phase 8] Failure mode: AEAD tag timing leak / possible tag forgery, severity HIGH
- UNVERIFIED: exploit practicality on Keem Bay specifically; whether stable@ already discussed this commit
**YES**
drivers/crypto/intel/keembay/keembay-ocs-aes-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/intel/keembay/keembay-ocs-aes-core.c +2 -1
@@ -11,6 +11,7 @@#include <crypto/internal/aead.h> #include <crypto/internal/skcipher.h> #include <crypto/scatterwalk.h> +#include <crypto/utils.h> #include <linux/clk.h> #include <linux/completion.h> #include <linux/dma-mapping.h>
@@ -919,7 +920,7 @@ static int kmb_ocs_aead_run(struct aead_request *req)/* For GCM decrypt, we have to compare in_tag with out_tag. */ if (rctx->instruction ==OCS_DECRYPT ) { - rc =memcmp (rctx->in_tag, rctx->out_tag, tag_size) ? + rc =crypto_memneq (rctx->in_tag, rctx->out_tag, tag_size) ? -EBADMSG :0 ; goto exit; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 crypto: keembay - use crypto_memneq() to compare CCM AEAD tags
In reply to Sasha LevinFrom: "David C.C.M. Gall" <[email protected]>
[ Upstream commit ff2ac77a034e03b64e2ba34f775097427dfa5547 ]
Use crypto_memneq() for constant-time comparison.
The CCM path in ocs-aes.c verifes the received authentication tag with memcmp(), which returns early on the first mismatched byte. This leaks valid-prefix length and allows for valid tag forgery which violates the INT-CTXT guarantee of AEAD.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject line**
Record: **[crypto/keembay] [use] replace memcmp() with crypto_memneq() when comparing CCM AEAD tags.** Subsystem prefix crypto: keembay. Verb is “use”, but the body is an explicit security fix (constant-time compare).
**Step 1.2 — Tags**
Record:
- **Assisted-by:** gregkh_clanker_t1000
- **Signed-off-by:** David C.C.M. Gall <[email protected]> (author)
- **Signed-off-by:** Herbert Xu <[email protected]> (crypto maintainer; applied the patch)
- **No Fixes:** tag (expected for this review)
- **No Cc: stable** (expected; not a negative)
- **No Reported-by / Tested-by / Reviewed-by / Acked-by / Link**
SHA on origin/master (Linus):ff2ac77a034e03b64e2ba34f775097427dfa5547. Contained in v7.3-rc1. Parent is the sibling GCM patch 353b3a85136f2.
**Step 1.3 — Body**
Record:
- **Bug:** CCM decrypt in ocs-aes.c compares the authentication tag with memcmp(), which returns on the first mismatched byte.
- **Symptom / failure mode:** timing leak of the matching-prefix length; that can be used to forge a valid tag and **violates AEAD INT-CTXT**.
- **Root cause:** variable-time compare on a secret authentication tag.
- **Version info in message:** none. Bug is in the original driver (2020).
**Step 1.4 — Hidden bug fix?**
Record: **No disguise.** This is an explicit crypto-security fix, same class as software crypto/ccm.c and other HW drivers that already use crypto_memneq().
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record:
- File: drivers/crypto/intel/keembay/ocs-aes.c (**+2 / −1**)
- Functions: ccm_compare_tag_to_yr(); plus #include <crypto/utils.h>
- Scope: **single-file surgical fix**
**Step 2.2 — Code flow**
Record:
- **Before:** after CCM decrypt, hardware tag (AES_T_MAC_*) and Yr (AES_MULTIPURPOSE2_*) are compared with memcmp(); mismatch → -EBADMSG.
- **After:** same compare, same return values, but crypto_memneq() runs in constant time.
- Path: **normal CCM decrypt completion**, not an error/init-only path.
Verified in this tree at ccm_compare_tag_to_yr():
```1285:1285:drivers/crypto/intel/keembay/ocs-aes.c
return memcmp(tag, yr, tag_size_bytes) ? -EBADMSG : 0;
```Called at the end of ocs_aes_ccm_op() on decrypt only.
crypto_memneq() in this tree returns 0 if equal, 1 otherwise (include/crypto/utils.h), so the ternary is equivalent to memcmp’s zero/non-zero sense.
**Step 2.3 — Bug mechanism**
Record: **[Memory safety / crypto side-channel]** — variable-time tag compare. Fix is the standard constant-time helper. Not a leak/UAF/race/NULL-deref.
**Step 2.4 — Fix quality**
Record: **Obviously correct and minimal.** Same pattern as crypto/ccm.c (crypto_memneq(authtag, odata, authsize)) and HW drivers (talitos, nx, atmel-aes, stm32-cryp, …). Regression risk: **very low**. Semantics of success/fail are unchanged. CRYPTO already select CRYPTO_LIB_UTILS, which builds lib/crypto/memneq.c.
---
## Phase 3: Git history
**Step 3.1 — Blame**
Record: buggy memcmp introduced in **88574332451380f4b51f6ca88ab9810e714bfb9b** (“crypto: keembay - Add support for Keem Bay OCS AES/SM4”, Mike Healy, 2020-11-26). Present since **v5.11**. git merge-base --is-ancestor 8857433245138 HEAD → **yes**. Unchanged until this candidate.
**Step 3.2 — Fixes: tag**
Record: **N/A** (no Fixes: tag). Introducing commit is the original driver add, and it **is** in this tree.
**Step 3.3 — File history in this tree**
Record: recent keembay work is DMA/probe/unregister fixes, not tag compare. No prior memneq fix here.
Series: **patch 2/2**. Sibling **1/2** (353b3a85136f2) changes GCM memcmp in keembay-ocs-aes-core.c only. **Not a prerequisite** for this CCM hunk.
**Step 3.4 — Author**
Record: David C.C.M. Gall — two keembay memneq commits on origin/master (GCM + CCM). Not the subsystem maintainer. **Herbert Xu applied both.**
**Step 3.5 — Dependencies**
Record: needs crypto_memneq / include/crypto/utils.h. Header added in c616fb0cbae8a (2023); **in this 6.12 tree**. include/crypto/algapi.h already includes crypto/utils.h. **Applies standalone.** git apply --check succeeded (hunks at offset −1).
Precedent already in this tree (explicitly Cc: stable):
- 79960943fdc11 crypto: talitos — timing leak in ESP ICV
- cb8affb55c7e6 crypto: nx — timing leak in GCM/CCM decrypt
---
## Phase 4: Mailing list / external research
**Step 4.1 — Original discussion**
Record:
- b4 dig -c ff2ac77a034e03b64e2ba34f775097427dfa5547 →
https://patch.msgid.link/[email protected]
- Direct lore.kernel.org fetch returned **403** (Anubis). Thread also at
https://lkml.iu.edu/hypermail/linux/kernel/2608.0/14033.html and
https://lists.openwall.net/linux-kernel/2026/08/07/1640
- b4 dig -a: **v1 only** (no v2/v3). Committed diff matches v1.
**Step 4.2 — Recipients (b4 dig -w)**
Record: Herbert Xu, David S. Miller, linux-crypto, linux-kernel, gregkh. **Crypto maintainer was To:’d.**
**Step 4.3 — Bug report**
Record: **no user/syzbot/bugzilla report.** Issue is from code review of memcmp on AEAD tags.
**Step 4.4 — Series**
Record: **[PATCH 1/2]** GCM in keembay-ocs-aes-core.c; **[PATCH 2/2]** this CCM change. Independent files. Herbert (2026-08-14): **“All applied. Thanks.”** No NAK.
**Step 4.5 — Stable list**
Record: no evidence this patch was discussed on stable@. WebSearch on lore.kernel.org/stable did not find a keembay/crypto_memneq thread. **Unverified beyond that** because lore.kernel.org returned 403.
---
## Phase 5: Code semantic analysis
**Step 5.1 — Functions**
Record: ccm_compare_tag_to_yr() (modified). Callers/callees below from this checkout.
**Step 5.2 — Callers**
Record:
- ccm_compare_tag_to_yr() ← ocs_aes_ccm_op() (decrypt only, line 1398)
- ocs_aes_ccm_op() ← kmb_ocs_aead_run() when rctx->mode == OCS_MODE_CCM
- kmb_ocs_aead_run() ← kmb_ocs_aes_aead_do_one_request() (crypto- engine do_one_request)
- Engine request queued from kmb_ocs_aead_common() ← CCM encrypt/decrypt for AES and SM4 (ccm(aes), ccm(sm4))
**Step 5.3 — Callees**
Record: ioread32() of tag/Yr registers, then compare. No alloc/lock change.
**Step 5.4 — Reachability**
Record: reachable on **Keem Bay OCS CCM decrypt** (CONFIG_CRYPTO_DEV_KEEMBAY_OCS_AES_SM4, ARCH_KEEMBAY || COMPILE_TEST). Algs are CRYPTO_ALG_KERN_DRIVER_ONLY (HW, not a CPU ISA). Still used by in-kernel CCM consumers on that SoC (e.g. 802.11 CCMP-style CCM). Trigger is **every CCM decrypt**, not a rare error path.
**Step 5.5 — Similar patterns**
Record: same driver still has GCM memcmp at keembay-ocs-aes- core.c:922 (sibling 1/2, not in this tree). Software CCM/GCM and many HW drivers already use crypto_memneq().
---
## Phase 6: This checkout (6.12.y)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree: **pending-6.12 / 6.12.111** (p-6.12-3-gc504cf0baa3d8).git merge-base --is-ancestor ff2ac77a034e0 HEAD → **not in this tree**.memcmp still at ocs-aes.c:1285. Bug since v5.11.
**Step 6.2 — Backport difficulty**
Record: **clean apply** (git apply --check: both hunks succeed, offset −1). #include <crypto/utils.h> exists here.
**Step 6.3 — Related fixes already here?**
Record: **No** keembay memneq fix. GCM sibling also absent. talitos/nx timing-leak fixes **are** already here (same class, different drivers).
---
## Phase 7: Subsystem / maintainer
**Step 7.1**
Record: **crypto HW driver** (drivers/crypto/intel/keembay/).
Criticality: **PERIPHERAL** for population (Intel Movidius Keem Bay only), but the bug is a **real AEAD security property break**.
**Step 7.2**
Record: modest activity (DMA/probe/unregister). Tag-compare code has been **stable since 2020**.
---
## Phase 8: Impact and risk
**Step 8.1 — Who is affected**
Record: **platform-specific** — Keem Bay OCS AES/SM4 CCM decrypt (ccm(aes) / ccm(sm4)).
**Step 8.2 — Trigger**
Record: every HW CCM decrypt. Timing-dependent. Unprivileged remote trigger depends on what uses CCM on that SoC (e.g. wireless); not a generic syscall UAF. **Security-relevant where CCM is used.**
**Step 8.3 — Failure mode**
Record: **timing leak → possible tag forgery / INT-CTXT break.**
Severity: **HIGH** (crypto integrity), not a panic. Incorrect accept/reject is not the bug; **secret-dependent runtime** is.
**Step 8.4 — Risk vs benefit**
Record: **Benefit: HIGH for Keem Bay CCM users** (closes a well-known AEAD side channel). **Risk: very low** (2 lines, equivalent control flow, helper already in 6.12). Ratio favors backport.
---
## Phase 9: Synthesis
**Evidence FOR**
- Real AEAD security bug (INT-CTXT / tag-forgery via timing), not cleanup.
- Buggy memcmp is in **this** 6.12 tree since v5.11.
- 2-line, obviously correct swap to crypto_memneq(); same as in-tree crypto/ccm.c and Cc:stable talitos/nx fixes.
- crypto_memneq / crypto/utils.h already present; patch applies cleanly.
- Applied by crypto maintainer Herbert Xu; no NAK.
- Independent of series patch 1/2 (GCM file).
**Evidence AGAINST**
- Niche SoC (ARCH_KEEMBAY).
- No field/syzbot report.
- LLM-assisted tag in the message (does not change the correctness of the 2-line swap).
- Remaining GCM memcmp is a **separate** candidate, not a reason to skip CCM.
**Unresolved**
- Full lore.kernel.org thread body (403). Confirmed via b4 dig, lkml.iu.edu, openwall, and Herbert’s “All applied.”
- Practical exploitability over MMIO+DMA noise: **unverified**; kernel policy still requires constant-time tag compare.
**Stable rules**
1. Obviously correct and tested? **PASS** — semantic equivalent; maintainer applied; helper is the documented API.
2. Real user-facing bug? **PASS** — AEAD decrypt tag check.
3. Important (security)? **PASS** — INT-CTXT / timing side channel.
4. Small/contained? **PASS** — +2/−1, one function.
5. No new features/APIs? **PASS**.
6. Applies to this tree? **PASS** — git apply --check succeeded.
**Exception category:** none required; this is a small security fix.
This should be backported to **this** 6.12 tree: the bug is present, the fix is the standard one-line compare change plus the existing header, and it does not need the GCM sibling.
### What it solves for stable users
On Keem Bay, CCM decrypt used memcmp() on the authentication tag. That can leak how many tag bytes matched and weakens AEAD integrity. crypto_memneq() makes the compare constant-time. Same class of fix already shipped in this tree for talitos and nx.
### Risk vs benefit
Benefit is closing a crypto integrity side channel on a path that runs on every CCM decrypt. Risk is a two-line, behavior-preserving change using an API already built via CRYPTO → CRYPTO_LIB_UTILS.
---
## Verification
- **[Phase 1]** Parsed tags from git show ff2ac77a034e0 on origin/master: Assisted-by clanker; SOB Gall + Herbert Xu; no Fixes/Cc:stable/Reported-by.
- **[Phase 1]** git describe HEAD / Makefile: **6.12.111**, branch pending-6.12.
- **[Phase 2]** Diff: +#include <crypto/utils.h>, memcmp → crypto_memneq in ccm_compare_tag_to_yr(). crypto_memneq contract verified in include/crypto/utils.h.
- **[Phase 2]** Local ocs-aes.c:1285 still uses memcmp.
- **[Phase 3]** git blame -L 1269,1286: 8857433245138 (v5.11 driver add). Ancestor of HEAD: yes. Candidate SHA ancestor of HEAD: **no**.
- **[Phase 3]** c616fb0cbae8a (crypto/utils.h) is ancestor of HEAD.
- **[Phase 3]** Sibling GCM 353b3a85136f2 not in HEAD; touches a different file.
- **[Phase 3]** In-tree timing-leak precedent: 79960943fdc11 (talitos), cb8affb55c7e6 (nx), both Cc: stable.
- **[Phase 4]** b4 dig -c/-a/-w: v1 only; lore msgid [email protected]; To/Cc Herbert, davem, linux-crypto, gregkh.
- **[Phase 4]** Herbert “All applied. Thanks.” on the 1/2 GCM post (lkml.iu.edu 2608.1/13636).
- **[Phase 4]** lore.kernel.org WebFetch: **403**. Stable-list search:
no keembay hit found.
- **[Phase 5]** Call chain read in keembay-ocs-aes-core.c: CCM kmb_ocs_aead_common → engine → kmb_ocs_aead_run → ocs_aes_ccm_op → ccm_compare_tag_to_yr.
- **[Phase 5]** Remaining GCM memcmp at keembay-ocs-aes-core.c:922.
- **[Phase 6]** git apply --check of ff2ac77a034e0: hunks succeed at offset −1.
- **[Phase 6]** CRYPTO selects CRYPTO_LIB_UTILS; lib/crypto/memneq.c present.
- **[Phase 7]** ARCH_KEEMBAY = Intel Movidius Keem Bay; driver depends on ARCH_KEEMBAY || COMPILE_TEST.
- **[Phase 8]** Algs ccm(aes) / ccm(sm4) with CRYPTO_ALG_KERN_DRIVER_ONLY verified in keembay-ocs-aes-core.c / include/linux/crypto.h.
- **UNVERIFIED:** practical remote exploitability of this MMIO-backed memcmp; full lore HTML (403).
**YES**
drivers/crypto/intel/keembay/ocs-aes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/intel/keembay/ocs-aes.c +2 -1
@@ -17,6 +17,7 @@#include <crypto/aes.h> #include <crypto/gcm.h> +#include <crypto/utils.h> #include "ocs-aes.h"
@@ -1283,7 +1284,7 @@ static inline int ccm_compare_tag_to_yr(struct ocs_aes_dev *aes_dev, (i * sizeof(u32))); } -return memcmp (tag, yr, tag_size_bytes) ? -EBADMSG :0 ; +return crypto_memneq (tag, yr, tag_size_bytes) ? -EBADMSG :0 ; }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 spi: bcm63xx-hsspi: return error from failed controller suspend
In reply to Sasha LevinFrom: Jiawen Liu <[email protected]>
[ Upstream commit 3b5414d76a0381db77b9694537254af7acfa187a ]
spi_controller_suspend() can fail if the SPI core cannot stop the controller. bcm63xx_hsspi_suspend() ignored that error, disabled the PLL and core clocks, and returned success.
Return the suspend error before disabling the clocks.
---
LLM Generated explanations, may be completely bogus:
# Stable backport analysis: spi: bcm63xx-hsspi: return error from failed controller suspend
Local tree is **6.18.53** (v6.18.53-5049-g0f0bdc2b0dffb, Makefile VERSION=6 / PATCHLEVEL=18 / SUBLEVEL=53). The verdict is only for this tree.
Upstream commit: 3b5414d76a0381db77b9694537254af7acfa187a (Mark Brown, 2026-06-30). It is not an ancestor of v6.18 or v6.18.53. The buggy suspend path **is** present at v6.18.53.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject**
Record: [spi] [return/propagate] return error from failed controller suspend — subsystem spi: bcm63xx-hsspi:; verb “return” meaning “stop ignoring a failure.”
**Step 1.2 — Tags**
Record:
- Signed-off-by: Jiawen Liu <[email protected]> (author)
- Acked-by: William Zhang <[email protected]> (listed maintainer of this driver)
- `Link: https://patch.msgid.link/tencent_B5A06807924A77C8690730EBF7A052
[email protected]`
- Signed-off-by: Mark Brown <[email protected]> (SPI maintainer)
- No Fixes:, no Reported-by:, no Cc: stable (expected for this review)
- Ignore pipeline Signed-off-by: Sasha Levin / [Upstream commit ...]
**Step 1.3 — Body**
Record:
- **Bug:** bcm63xx_hsspi_suspend() ignores spi_controller_suspend() failure, then disables PLL and core clocks and returns 0.
- **Symptom:** system suspend is reported successful while the SPI queue may still be running and clocks are gated.
- **Root cause:** missing return-value check on spi_controller_suspend().
- **Version info:** none in the message. Bug is in the original 2013 driver (142168eba9dc5).
**Step 1.4 — Hidden bug fix?**
Record: Not hidden. It is an explicit error-path correctness fix (ignored failure → clocks torn down anyway).
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record: one file, drivers/spi/spi-bcm63xx-hsspi.c, **+5 / −1**.
Function: bcm63xx_hsspi_suspend(). Surgical, single-file.
**Step 2.2 — Flow**
Record: **Before:** call spi_controller_suspend(host) and ignore the result; always clk_disable_unprepare() on PLL and core clocks; return
0. **After:** if spi_controller_suspend() fails, return that error and leave clocks enabled.
**Step 2.3 — Bug mechanism**
Record: **Logic / PM error-path.** spi_controller_suspend() for a queued controller calls spi_stop_queue(), which polls up to 500 × ~10 ms and returns -EBUSY if the queue is still busy. The core still __spi_mark_suspended() and returns that error. The driver then gated clocks and lied to PM with success.
This driver sets host->transfer_one_message and does **not** set host->transfer, so spi_register_controller() runs spi_controller_initialize_queue() and sets ctlr->queued = true. The failure path is reachable.
**Step 2.4 — Fix quality**
Record: Obviously correct; matches the established SPI driver pattern (spi-bcm63xx.c, spi-rockchip.c, spi-atmel.c, etc.). Minimal. Regression risk is low: on failure, suspend is aborted instead of proceeding with clocks off. Pre-existing SPI-core behavior (__spi_mark_suspended() even on queue-stop failure) is unchanged; this patch does not make that worse, and it is the same contract every other checked driver uses.
---
## PHASE 3: GIT HISTORY
**Step 3.1 — Blame (at v6.18.53)**
Record: ignored spi_controller_suspend(host) line from 2c40be6bc95bd (rename master→host, 2023). Original ignore-and-return-0 suspend is 142168eba9dc5 (2013-12-04, “add bcm63xx HSSPI driver”), ancestor of this tree.
**Step 3.2 — Fixes: tag**
Record: none. Buggy code has been in the driver since introduction; that commit is in this tree.
**Step 3.3 — Related file history**
Record: v6.18.53 already contains b782a7cb0a424 (“disable clocks on resume failure”, Can Peng, Cc: stable, Fixes: 142168eba9dc). That is the resume-side counterpart of the same class of bug. No later revert of this suspend fix.
**Step 3.4 — Author**
Record: Jiawen Liu; same-week series of the same one-line check on spi- bcm63xx.c, spi-bcm-qspi.c, spi-bcmbca-hsspi.c. Not the driver maintainer; **William Zhang**, who is, acked this patch.
**Step 3.5 — Prerequisites**
Record: none. Needs only spi_controller_suspend() (present since the original driver) and the existing clock disable sequence. Standalone; series 2/3 touches only this file. 1/3 is spi-bcm63xx.c, 3/3 is spi- bcm-qspi.c.
---
## PHASE 4: MAILING LIST / EXTERNAL
**Step 4.1 — Original discussion**
Record: b4 dig -c 3b5414d76a0381db77b9694537254af7acfa187a → https://p
atch.msgid.link/[email protected] b4 dig -a: **v1 only**, [PATCH 2/3]. Thread saved via b4 dig -m. No NAK, no requested respin.
**Step 4.2 — Recipients (b4 dig -w)**
Record: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], bcm-kernel- [email protected]. Right maintainers were on Cc.
**Step 4.3 — Bug report**
Record: no syzbot/bugzilla. Found by code review of ignored spi_controller_suspend() returns.
**Step 4.4 — Series**
Record: 2/3 in a three-driver series. Each patch is a self-contained per-driver check. William Zhang: Acked-by on this patch. Kamal Dasu:Reviewed-by on 3/3 (spi-bcm-qspi). Mark Brown applied it.
**Step 4.5 — Stable list**
Record: lore.kernel.org search via WebFetch returned **403**. No stable- thread evidence found. Absence of Cc: stable is expected for this pipeline.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Functions**
Record: bcm63xx_hsspi_suspend() only.
**Step 5.2 — Callers**
Record: wired through SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, ...) / platform_driver.driver.pm. Invoked from the PM core on **system sleep**, not a syscall hot path. Requires CONFIG_SPI_BCM63XX_HSSPI and CONFIG_PM_SLEEP.
**Step 5.3 — Callees**
Record: spi_controller_suspend() → spi_stop_queue() (can return -EBUSY); then clk_disable_unprepare() on PLL and core clocks.
**Step 5.4 — Reachability**
Record: Yes, on suspend of BCM63xx/BCMBCA boards that use this controller (brcm,bcm6328-hsspi, brcm,bcmbca-hsspi-v1.0 in MIPS bcm63xx and ARM/ARM64 bcmbca DT). Trigger is suspend while the SPI queue stays busy for ~5 seconds.
**Step 5.5 — Similar patterns**
Record: same ignore-error bug in sibling Broadcom SPI drivers; same return-check already used in many in-tree SPI drivers. Systematic, not a one-off style tweak.
semcode MCP tools were not available; this used git grep and direct reads of spi.c / the driver.
---
## PHASE 6: LOCAL TREE CROSS-CHECK
**Step 6.1 — Buggy code in this tree?**
Record: **Yes**, at v6.18.53 bcm63xx_hsspi_suspend():
```c spi_controller_suspend(host); clk_disable_unprepare(bs->pll_clk); clk_disable_unprepare(bs->clk); return 0; ```
Bug introduced 2013, present for the whole 6.18.y lifetime.
**Step 6.2 — Backport difficulty**
Record: **clean apply with +6 line offset** (patch --dry-run succeeded against the v6.18.53 file). Surrounding remove() differs from later mainline; the suspend hunk itself matches.
**Step 6.3 — Related fixes already here?**
Record: resume-path clock cleanup (b782a7cb0a424) **is** in v6.18.53. This suspend-path check is **not**. No alternate fix for the ignored suspend error.
---
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1**
Record: **SPI driver** (drivers/spi/spi-bcm63xx-hsspi.c). Criticality:
**IMPORTANT** (platform SPI, often SPI flash on Broadcom CPE/BCA SoCs), not core MM/VFS. Not staging.
**Step 7.2**
Record: Mature driver (2013), still maintained (William Zhang / Kursad Oney / Jonas Gorski). Recent PM fix already landed in this stable series.
---
## PHASE 8: IMPACT AND RISK
**Step 8.1 — Who is affected**
Record: users of CONFIG_SPI_BCM63XX_HSSPI on BCM63XX / BMIPS / ARCH_BCMBCA (routers, gateways, BCA ARM64 boards). Not universal.
**Step 8.2 — Trigger**
Record: system suspend while spi_stop_queue() times out (-EBUSY after ~5s of a non-empty queue or ctlr->busy). Unprivileged users cannot hit it directly unless they can suspend. Timing-dependent; real when a transfer is stuck or a long SPI flash op overlaps suspend.
**Step 8.3 — Failure mode**
Record: clocks gated while the controller may still be busy; PM is told suspend succeeded. Possible bus hang, incomplete SPI transaction, or SPI-flash corruption if a NOR/NAND op is in flight. Severity: **HIGH** (hang / possible corruption on the error path), not a guaranteed oops on every suspend.
**Step 8.4 — Risk/benefit**
Record: **Benefit: medium-high** for those platforms (correct suspend abort, clocks stay on). **Risk: very low** (5 lines, error path only, same pattern as peer drivers; resume counterpart already in this tree). Ratio favors backport.
---
## PHASE 9: SYNTHESIS
**Step 9.1 — Evidence**
For:
- Real PM bug: ignored -EBUSY, then clock gate + success.
- Queued controller, so spi_stop_queue() can actually fail.
- Possible hang / in-flight SPI (including flash) with clocks off.
- 5-line, obviously correct, no new API.
- Acked by driver maintainer; applied by SPI maintainer.
- Resume-side analogue already in 6.18.53 as a Cc: stable fix.
- Applies to v6.18.53 with only a line-number offset.
- Bug present since 2013 in this tree.
Against:
- No Reported-by / syzbot / crash log.
- Trigger is the uncommon queue-stop timeout, not every suspend.
- SPI core still marks the controller suspended on failure (pre- existing; this patch does not fix or worsen that).
- Peripheral SoC driver, not core kernel.
Unresolved: lore.kernel.org HTML/WebFetch was 403; discussion recovered via b4 dig -m instead.
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — trivial check; acked by maintainer; in mainline.
2. Real bug affecting users? **PASS** — wrong suspend result and clocks- off while busy.
3. Important (crash/security/corruption/deadlock)? **PASS** — hang / possible SPI-flash corruption if suspend proceeds after queue-stop failure; same class as the resume fix already in this tree.
4. Small and contained? **PASS** — +5/−1, one function.
5. No new features/APIs? **PASS**.
6. Can apply to this tree? **PASS** — buggy code present; applies with offset 6.
**Step 9.3 — Exception category**
Record: none (not a device ID / quirk / DT / build / docs exception). It is a normal small bugfix.
**Step 9.4 — Decision**
This belongs in 6.18.y: it stops the driver from disabling HSSPI clocks and reporting successful suspend when the SPI core could not stop the queue. The matching resume cleanup is already here; this is the suspend- side hole that lacked a Cc: stable tag.
---
## What the commit solves (for this tree)
On Broadcom BCM63xx/BCMBCA HSSPI, system suspend called spi_controller_suspend() and ignored -EBUSY from spi_stop_queue(). It then turned off the PLL and core clocks and returned 0, so the PM core continued suspend while the controller could still be busy. That can hang the bus or interrupt an in-flight SPI flash transfer. The fix returns the error and leaves clocks enabled so suspend is aborted.
It meets the stable rules: real bug, important on the failure path, five lines, no new API, applies to 6.18.53.
Risk vs benefit: very low risk, meaningful benefit on the platforms that use this driver. No missing prerequisites.
---
## Verification
- **[Phase 1]** Parsed tags: author Jiawen Liu; Acked-by William Zhang; SOB Mark Brown; Link to msgid; no Fixes/Reported-by/Cc-stable.
- **[Phase 2]** Diff: +5/−1 in bcm63xx_hsspi_suspend(); check spi_controller_suspend() before clk_disable_unprepare.
- **[Phase 2]** spi_controller_suspend() in drivers/spi/spi.c: on ctlr->queued, spi_stop_queue() can return -EBUSY; then __spi_mark_suspended(); return ret.
- **[Phase 2]** spi_stop_queue(): 500 iterations × usleep_range(10000, 11000), then -EBUSY.
- **[Phase 2]** Driver sets transfer_one_message, not transfer; core sets queued = true (also true at v6.18.53).
- **[Phase 3]** git blame at v6.18.53: ignore-error suspend from original 142168eba9dc5 (2013); git merge-base --is-ancestor 142168eba9dc5 v6.18.53 → YES.
- **[Phase 3]** git merge-base --is-ancestor 3b5414d76a0381db77b9694537254af7acfa187a v6.18.53 → NO (fix not in 6.18.53).
- **[Phase 3]** Resume counterpart b782a7cb0a424 **is** ancestor of v6.18.53 (Can Peng, Cc: stable).
- **[Phase 3]** No revert of this change in drivers/spi/spi-bcm63xx- hsspi.c.
- **[Phase 4]** b4 dig -c 3b5414d76a0381…: lore msgid above; v1 only; William Zhang Acked-by; no NAK.
- **[Phase 4]** b4 dig -w: SPI list + Broadcom maintainers Cc’d.
- **[Phase 4]** b4 dig -m /tmp/hsspi-thread.mbox: 4 messages, series 2/3 standalone.
- **[Phase 4]** WebFetch of lore.kernel.org: 403; discussion taken from b4 mbox instead.
- **[Phase 5]** Callers: SIMPLE_DEV_PM_OPS → platform PM; CONFIG SPI_BCM63XX_HSSPI depends on BCM63XX || BMIPS_GENERIC || ARCH_BCMBCA.
- **[Phase 5]** DT: brcm,bcm6328-hsspi / brcm,bcmbca-hsspi-v1.0 on bcm63xx MIPS and bcmbca ARM/ARM64.
- **[Phase 6]** git describe HEAD / make kernelversion: 6.18.53.
- **[Phase 6]** git show v6.18.53:drivers/spi/spi-bcm63xx-hsspi.c:
still ignores suspend error.
- **[Phase 6]** patch --dry-run against that file: hunk succeeded at line 895 (offset 6).
- **[Phase 7]** MAINTAINERS: “BROADCOM Broadband SoC High Speed SPI Controller DRIVER”, M: William Zhang.
- **[Phase 8]** Failure mode verified from spi.c + driver suspend path, not from a user crash report.
- **UNVERIFIED:** live reproduction of spi_stop_queue() timeout on BCM hardware; stable@ lore thread (HTTP 403).
The fix is small, surgical, present as a real bug in this 6.18.53 tree, and meets the stable criteria.
**YES**
drivers/spi/spi-bcm63xx-hsspi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +5 -1
@@ -895,8 +895,12 @@ static int bcm63xx_hsspi_suspend(struct device *dev) {struct spi_controller *host =dev_get_drvdata (dev);struct bcm63xx_hsspi *bs =spi_controller_get_devdata (host); +int ret; + + ret =spi_controller_suspend (host); +if (ret) +return ret; -spi_controller_suspend (host);clk_disable_unprepare (bs->pll_clk);clk_disable_unprepare (bs->clk);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 docs: cgroup-v2: fix stale "io" controller introduction
In reply to Sasha LevinFrom: Zhe Liu <[email protected]>
[ Upstream commit 3345c7248a9e2a91cb9e2477c29af16881706f4f ]
The introductory paragraph for the IO controller still states that weight based distribution is "available only if cfq-iosched is in use" and that "neither scheme is available for blk-mq devices". This text dates from when the cgroup v2 documentation was first written (2015) and was correct at the time, but is no longer accurate:
* cfq-iosched was removed in v5.0;
* blk-mq is now the only block I/O path, and both the absolute limit scheme (io.max via blk-throttle) and the weight based scheme (io.weight via iocost, or io.bfq.weight under BFQ) work on it;
* latency based protection (iolatency) and I/O priority (ioprio) controllers have since been added.
The rest of the section already documents io.weight, io.max, io.cost.{qos,model}, io.latency and io.prio.class correctly, so the introduction is the only part that contradicts them. Rewrite it to reflect the current state.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: this is a docs-only correction of text that is already wrong in 6.12, and the rewrite matches features this tree actually ships.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [docs / cgroup-v2] [fix] [rewrite the stale IO controller introduction so it no longer claims CFQ-only weights and no blk-mq support]
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Zhe Liu <[email protected]> (author)
- Reviewed-by: Tao Cui <[email protected]>
- Signed-off-by: Tejun Heo <[email protected]> (cgroup maintainer; applied the patch)
- No Fixes: tag (expected)
- No Reported-by / Tested-by / Link / Cc: stable
- Ignore any pipeline-added Sasha Levin SOB / "[Upstream commit ...]" markers; they are not evidence of selection
Notable pattern: maintainer SOB plus a Reviewed-by; single standalone patch, not a series.
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- [Bug] Admin-guide intro for the cgroup v2 "io" controller still says weight-based control needs cfq-iosched and that neither weight nor limits work on blk-mq.
- [Symptom] Operators reading the intro are told IO control does not work on modern (blk-mq-only) kernels, which contradicts the rest of the same document.
- [Version info] Text written in 2015; cfq-iosched removed in v5.0; blk- mq is now the only block path.
- [Root cause] Documentation was never updated after CFQ removal and after iocost / iolatency / ioprio / BFQ cgroup support landed. The rest of the section already documents io.weight, io.max, io.cost.{qos,model}, io.latency, and io.prio.class.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a hidden runtime bug. It is an explicit documentation correction of obsolete, contradictory admin-guide text. No leak/race/UAF disguised as cleanup.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: Documentation/admin-guide/cgroup-v2.rst (+7 / -3, 10 lines with context)
- Functions modified: none (prose only)
- Scope: single-file surgical documentation rewrite of one introductory paragraph
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: "weight based distribution is available only if cfq-iosched is in use and neither scheme is available for blk-mq devices."
- After: Absolute BPS/IOPS limits via blk-throttle on all devices; proportional weight via iocost (CONFIG_BLK_CGROUP_IOCOST) and BFQ (io.bfq.weight when BFQ is the device scheduler); also iolatency (CONFIG_BLK_CGROUP_IOLATENCY) and ioprio (CONFIG_BLK_CGROUP_IOPRIO).
- Path affected: documentation readers only; no kernel execution path.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: [Logic / correctness in documentation] The intro describes 2015-era CFQ/legacy-request_fn constraints that do not exist in this tree. Not a memory-safety, locking, or refcount bug.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct relative to this tree: CFQ is gone, blk-mq is the I/O path, and the named configs/files exist.
- Minimal: one paragraph, no unrelated edits.
- Regression risk: none at runtime. Residual docs risk is only if the new sentence were wrong; it matches block/Kconfig, block/Kconfig.iosched, and the later IO sections of the same file. io.bfq.weight is documented in Documentation/block/bfq- iosched.rst, not in the cgroup-v2 interface-file list; that is consistent with the intro pointing at BFQ's own cgroup support.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record: Stale paragraph introduced by 6c2920926b10e8 ("cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation", Tejun Heo, 2015-11-16). Present since cgroup v2 docs were written. Converted to rST by 633b11bee40c37 (2017) without changing that claim. git merge-base --is-ancestor 6c2920926b10e8 HEAD succeeded.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Not applicable. The "bug" is long-lived stale documentation, not a later functional regression.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent cgroup-v2.rst changes in this tree are unrelated (writeback folio conversion, mm/zswap docs, cgroup-for-6.12 merge). No prerequisite refactor of the IO intro. Standalone one-patch change (b4:
v1 only, not patch X/Y).
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Zhe Liu has this one commit on origin/master for this file. Tejun Heo (cgroup maintainer) applied it. Tao Cui reviewed and corrected the CFQ-removal version in the commit message from v4.12 to v5.0.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: No code-structure dependencies. The rewrite only names controllers/configs that already exist in 6.12 (BLK_CGROUP_IOCOST, BLK_CGROUP_IOLATENCY, BLK_CGROUP_IOPRIO, BFQ_GROUP_IOSCHED, BLK_DEV_THROTTLING). Can apply standalone. git show 3345c7248a9e2 | git apply --check succeeded at offset -172 lines.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- Commit: 3345c7248a9e2a91cb9e2477c29af16881706f4f (not an ancestor of this HEAD; git merge-base --is-ancestor exit 1)
- b4 dig:
https://patch.msgid.link/[email protected]
- Single v1 series; no v2/v3. Tejun applied v1 after fixing the CFQ version in the changelog.
- Reviewer feedback: Tao Cui, "cfq-iosched was removed in v5.0, not v4.12 (f382fb0bcef4)". Otherwise "looks good." Reviewed-by added.
- Tejun: "Applied to cgroup/for-7.3 with the cfq removal version in the description corrected to v5.0"
- No NAK, no stable nomination in the thread
- Included in the v7.3 cgroup pull ([GIT PULL] cgroup: Changes for v7.3)
- Later origin/master text of this paragraph is unchanged; no follow- up rewrite
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): To/Cc included [email protected], [email protected], [email protected], [email protected], [email protected], cgroups@, linux-doc@, linux-kernel@. Those are the cgroup maintainers plus linux- doc. Applied by Tejun Heo.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No Reported-by, bugzilla, or syzbot. Author noticed the intro contradicting the rest of the same document. Severity from a reporter's
perspective: documentation accuracy, not a crash.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Standalone. Later cgroup-v2 doc commits on origin/master (misc.events, io.latency rotational, io.pressure, etc.) do not touch this paragraph and are not prerequisites.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable WebFetch returned HTTP 403. UNVERIFIED whether anyone already requested or rejected this on stable@. No evidence from b4 or lkml mirrors of a stable discussion.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: None. Documentation only.
Step 5.2: TRACE CALLERS
Record: N/A — no functions. Impact surface is readers of the cgroup v2 admin guide (container/cgroup operators), not a call graph.
Step 5.3: TRACE CALLEES
Record: N/A.
Step 5.4: FOLLOW THE CALL CHAIN
Record: N/A for kernel reachability. The misleading text is in the primary user-facing cgroup v2 document. Userspace does not "trigger" a bug; operators can be misled about whether io.max / io.weight work.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: cfq-iosched in this tree's docs remains only in this stale intro (plus an unrelated historical RCU lockdep-splat example). init/Kconfig BLK_CGROUP help still mentions CFQ; that is a separate stale-help issue, not part of this patch.
===============================================================
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** (pending-6.12, git describe HEAD = p-6.12-3-gc504cf0baa3d8). Stale text is at Documentation/admin- guide/cgroup-v2.rst lines 1834–1838. Features the rewrite describes are present:
- CFQ source block/cfq-iosched.c absent; removed by f382fb0bcef4 (ancestor of HEAD)
- iocost: block/blk-iocost.c, CONFIG_BLK_CGROUP_IOCOST (7caa47151ab2e, ancestor)
- iolatency: block/blk-iolatency.c (d70675121546c, ancestor)
- ioprio: block/blk-ioprio.c (556910e39249d, ancestor)
- blk-throttle: CONFIG_BLK_DEV_THROTTLING
- BFQ cgroup: CONFIG_BFQ_GROUP_IOSCHED, io.bfq.weight in Documentation/block/bfq-iosched.rst
- Same file already documents io.cost.*, io.weight, io.max, io.latency, io.prio.class
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Clean apply with hunk offset -172 (upstream intro at ~1988; this tree at ~1833). Surrounding Memory Ownership / IO Interface Files context matches. Difficulty: clean apply.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: git log --grep='stale "io" controller' and --grep='cfq- iosched' on this file: empty. No equivalent fix in this checkout. git merge-base --is-ancestor 3345c7248a9e2 HEAD failed.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: [Documentation / cgroup v2 admin-guide] Criticality: IMPORTANT for operators (the user-facing contract for cgroup IO), PERIPHERAL for kernel runtime (no code change). MAINTAINERS: CONTROL GROUP, Tejun Heo et al., file Documentation/admin-guide/cgroup-v2.rst.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: cgroup-v2.rst still receives interface-doc updates. The IO intro itself has been untouched since 2015. Mature, long-stale paragraph rather than a bug in brand-new code.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Anyone reading the cgroup v2 IO intro on 6.12 (container hosts, systemd/cgroup users, Kubernetes node kernels). Not a runtime/config/platform subset. No kernel code path changes.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Reading the admin guide. Common for operators enabling IO control. Not a race; not triggerable as a crash by unprivileged users.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: [Failure mode] Contradictory, obsolete documentation: claims IO weight/limits do not work on blk-mq, i.e. on essentially all 6.12 block devices. [Severity] LOW as kernel runtime; the rest of the same chapter already describes working interfaces. The harm is misleading operators, not oops/corruption/deadlock.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: medium for documentation accuracy of a widely used controller; the intro currently tells 6.12 users the opposite of reality.
- Risk: very low (docs-only, 7 insertions / 3 deletions, apply-check clean).
- Ratio: high benefit-to-risk for a documentation exception; no runtime regression vector.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Stale intro is present in this 6.12 tree and is factually false here (CFQ gone since v5.0; blk-mq-only; iocost/iolatency/ioprio/BFQ all present).
- Same document already documents the working interfaces; the intro is the part that contradicts them.
- Small, obviously correct, maintainer-applied (Tejun Heo), Reviewed-by Tao Cui.
- Applies cleanly.
- Zero runtime risk.
- Documentation/comment fixes are an allowed stable exception.
- This pending-6.12 tree already carries other docs: backports under Documentation/admin-guide/.
AGAINST:
- Not a crash, UAF, deadlock, corruption, or security hole.
- No user report / syzbot / Cc: stable (absence of Cc: stable is expected and not a negative).
- Later sections already describe the real interfaces, so a careful reader can recover.
- stable-kernel-rules.rst also says no trivial-without-benefit changes; this is more than spelling, but it is still docs-only.
UNRESOLVED:
- lore.kernel.org/stable search HTTP 403; no confirmed stable@ thread.
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — matches Kconfig and the rest of the same document; reviewed and applied by the cgroup maintainer.
2. Fixes a real bug that affects users? **PASS** (documentation bug) — the intro is wrong for every 6.12 blk-mq system.
3. Important issue (crash, security, corruption, deadlock)? **FAIL** as a runtime severity; **PASS** under the documentation exception (incorrect admin-guide, not a spelling nit).
4. Small and contained? **PASS** — 10 lines, one file.
5. No new features or APIs? **PASS** — describes existing 6.12 interfaces only.
6. Can apply to the local tree? **PASS** — git apply --check succeeded.
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: **Documentation fix** (incorrect/obsolete admin-guide text). That exception applies. Not a device-ID, quirk, DT, or build fix.
Step 9.4: MAKE YOUR DECISION
This should be backported to **this** 6.12 tree. The buggy paragraph is here, the features the new text describes are here, the patch applies, and runtime risk is zero. Stable rules allow documentation corrections of incorrect material; this is not a feature add and not a whitespace cleanup.
What it solves for stable users: the cgroup v2 admin guide currently says weight-based IO control needs CFQ and that neither weights nor limits work on blk-mq. On 6.12 that is false for all block devices and contradicts io.max / io.weight / iocost / iolatency / ioprio in the same file.
Risk vs benefit: documentation-only, surgical, maintainer-acked; benefit is correcting the primary operator document for a common container feature.
Concerns: none on apply or prerequisites. Not a crash-class fix; accepted because it is a contained docs correction of still-present stale text.
Verification:
- [Phase 1] Parsed tags: SOB Zhe Liu, Reviewed-by Tao Cui, SOB Tejun Heo; no Fixes/Reported-by/Cc: stable
- [Phase 1] Body: stale 2015 CFQ/blk-mq claims; cfq removed v5.0
- [Phase 2] Diff: Documentation/admin-guide/cgroup-v2.rst +7/-3, IO intro only
- [Phase 3] git describe HEAD / make kernelversion:
p-6.12-3-gc504cf0baa3d8, 6.12.111, branch pending-6.12
- [Phase 3] git blame: stale lines from 6c2920926b10e8 (2015); ancestor of HEAD
- [Phase 3] git merge-base --is-ancestor 3345c7248a9e2 HEAD: not in this tree
- [Phase 3] CFQ removal f382fb0bcef4 is ancestor; no block/cfq- iosched.c
- [Phase 3] iocost 7caa47151ab2e, iolatency d70675121546c, ioprio 556910e39249d are ancestors
- [Phase 3] git apply --check of 3345c7248a9e2: hunk succeeded at 1833 (offset -172)
- [Phase 4] b4 dig -c 3345c7248a9e2: msgid [email protected]
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] b4 dig -w: cgroup maintainers + linux-doc on the original To/Cc
- [Phase 4] lkml/openwall: Tao Cui v5.0 correction; Tejun applied to cgroup/for-7.3; no NAK
- [Phase 4] origin/master still has the rewritten paragraph; no later rewrite
- [Phase 4] lore.kernel.org/stable: HTTP 403, UNVERIFIED
- [Phase 5] No functions/callers; docs-only
- [Phase 6] Stale text at lines 1834–1838 of this tree's cgroup-v2.rst; io.cost/io.weight/io.max/io.latency/io.prio.class already documented below
- [Phase 6] CONFIG_BLK_CGROUP_IOCOST, IOLATENCY, IOPRIO, BFQ_GROUP_IOSCHED, BLK_DEV_THROTTLING exist in this tree
- [Phase 7] MAINTAINERS CONTROL GROUP: Tejun Heo; file listed
- [Phase 8] Failure mode: misleading admin-guide, severity LOW runtime / docs exception
- UNVERIFIED: whether this SHA was already discussed on stable@
**YES**
Documentation/admin-guide/cgroup-v2.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/admin-guide/cgroup-v2.rst +7 -3
@@ -1959,9 +1959,13 @@ IO The "io" controller regulates the distribution of IO resources. This controller implements both weight based and absolute bandwidth or IOPS -limit distribution; however, weight based distribution is available -only if cfq-iosched is in use and neither scheme is available for -blk-mq devices. +limit distribution. Absolute BPS and IOPS limits are enforced by +blk-throttle and apply to all devices, while weight based proportional +distribution is provided by the iocost cost model controller +(CONFIG_BLK_CGROUP_IOCOST) and, when the BFQ I/O scheduler is in use +for a device, by BFQ's own cgroup support. Latency-based protection +(CONFIG_BLK_CGROUP_IOLATENCY) and I/O priority assignment +(CONFIG_BLK_CGROUP_IOPRIO) are also available. IO Interface Files
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amd/display: fix max dispclk_khz/dppclk_khz double 1000
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit f48124ff35357d05a98d9cd5cb7982e7e5509003 ]
[why]
Fix regresson caused by double roundup and index out of range
---
LLM Generated explanations, may be completely bogus:
I have enough to judge this for 6.18.y: the DML21 clock-table bug is present here, the fix is four lines, and it applies to the local dml21_wrapper.c path.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [drm/amd/display] [fix] correct max dispclk_khz/dppclk_khz (remove double *1000 and fix last-index)
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Reviewed-by: Dillon Varone <[email protected]> (AMD DC)
- Reviewed-by: Dmytro Laktyushkin <[email protected]> (AMD DC)
- Signed-off-by: Charlene Liu <[email protected]> (author)
- Signed-off-by: Aurabindo Pillai <[email protected]> (AMD DC, series submitter)
- Tested-by: Dan Wheeler <[email protected]> (AMD QA)
- Signed-off-by: Alex Deucher <[email protected]> (amdgpu maintainer)
- No Fixes: tag (expected for this review)
- No Cc: stable (expected)
- No Reported-by: / syzbot / Link
- Ignore pipeline Signed-off-by: Sasha Levin and [Upstream commit ...]
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- Bug: “regression caused by double roundup and index out of range.”
- Symptom: wrong max_supported_dispclk_khz / max_supported_dppclk_khz (0 from off-by-one into a zero pad, or ~1000× too large from a second * 1000).
- No stack trace, no public repro, no version list.
- Root cause as stated: double unit conversion plus using num_clk_values as an index instead of num_clk_values - 1.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. Subject and body both describe a correctness fix (units + indexing).
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- User/mainline path:
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c
- This tree: drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c (DML21 not yet split into dml2_0 + _fpu)
- 4 lines changed, same function: dml21_calculate_rq_and_dlg_params
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- Before, if num_clk_values > 1: read clk_values_khz[num_clk_values] (one past last valid entry) and multiply by 1000.
- Before, else: read [0] and multiply by 1000.
- After: last valid entry [num_clk_values - 1], no extra * 1000.
- Same for dispclk and dppclk. Path is normal modeset validation on DML21, not an error path.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- Category: logic/correctness + off-by-one (g, plus memory-safety-class indexing).
- Table fill in dcn401_soc_and_ip_translator.c already does dispclk_mhz * 1000 into clk_values_khz[]. Unused slots are 0. Valid indices are 0 .. num_clk_values-1.
- Mechanism: copy-paste of DML2.0’s *_mhz * 1000 onto a table that is already kHz, plus using count as an index.
- Verified sibling: dml2_utils.c still converts from dispclk_mhz * 1000 because that path stores MHz.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct vs the type name clk_values_khz and vs every other DML21 use of clk_values_khz[num_clk_values - 1] (e.g. dml2_dpmm_dcn4.c, dml2_core_dcn4_calcs.c).
- Minimal; no API or struct change.
- Regression risk: very low. Correcting max-clock metadata; does not change DML’s min_clocks programming path.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Introduced in 70839da6360500 (“drm/amd/display: Add new DCN401 sources”, Aurabindo Pillai, 2024-04-19).
- git merge-base --is-ancestor 70839da6360500 HEAD → yes. Present since DCN401 landed; in this 6.18.y tree from day one of DML21.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Buggy commit is the DCN401/DML21 introduction above, which is in this tree.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- Recent file history is DML21 FPU guards, init refactor, mcache, etc.
- Related later change on this branch: 5d22a3f28b5b9 (“add DalForceMaxDisplayClock debug option to DML2”) copies max_supported_* into bw_dispclk_khz / bw_dppclk_khz when forced_clocks or debug.max_disp_clk. That is **not** in v6.18.53.
- This fix is standalone; it is not patch N/M of a required sequence in- tree.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Charlene Liu is a regular AMD DC contributor. Series was signed off by Aurabindo Pillai and Alex Deucher. AMD QA Tested-by present.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Submitted as [PATCH 07/24] in “DC Patches for 8 June 2026”. Neighbors are unrelated (PHY SSC, writeback, KUnit, dead code). Diff needs no new helpers. Can apply standalone to this tree’s dml21_wrapper.c.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c f48124ff35357d05a98d9cd5cb7982e7e5509003: lore search failed (server error / 403).
- Found on amd-gfx: https://www.mail-archive.com/amd-
[email protected]/msg144416.html
- Message-id: [email protected]
- From Charlene Liu, submitted by Aurabindo Pillai, 2026-06-04, [PATCH 07/24].
- Body matches the committed patch. No v2/v3 of this hunk found.
- No reviewer NAK in the archived message; R-b already on the patch (internal AMD review before list).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: Dillon Varone, Dmytro Laktyushkin (AMD DC); maintainer SOB Alex Deucher. Appropriate reviewers.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No public bugzilla/syzbot. “Regression” is AMD-internal. QA Tested-by: Dan Wheeler.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: 24-patch DC drop; this hunk is independent. Later DalForceMaxDisplayClock uses the fields this commit corrects; it is not a prerequisite for this fix.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search not usable here (403). No evidence this was rejected for stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: dml21_calculate_rq_and_dlg_params only.
**Step 5.2: TRACE CALLERS**
Record:
- Called from dml21_validate() after mode programming (dml21_wrapper.c ~line 262).
- dml2_validate() dispatches to dml21_validate when architecture == dml2_architecture_21.
- dml2_create() selects DML21 when `debug.using_dml21 && dce_version
Quoted 1 line
= DCN_VERSION_4_01`.
- DCN401 debug defaults: .using_dml21 = true in dcn401_resource.c.
- DCN401 is AMDGPU_FAMILY_GC_12_0_0 (RDNA4, e.g. Navi 48).
- Call context: modeset / bandwidth validation, not IRQ.
**Step 5.3: TRACE CALLEES**
Record: This hunk only indexes soc_bb.clk_table.{dispclk,dppclk}.clk_values_khz. Actual pipe clocks are set earlier in the same function via dml21_program_dc_pipe → dml21_utils.c (dppclk_khz from DML min_clocks), then dml21_copy_clocks_to_dc_state overwrites dispclk_khz from programming output. It does **not** overwrite max_supported_*.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Userspace modeset on DCN401 reaches this on every validate-and- program. Buggy **fields** are written on that path. Verified DCN401 consumers of max_supported_*:
- dcn401_update_clocks / dcn401_are_clock_states_equal: do **not** read them.
- dcn401_get_max_clock_khz: uses SMU DPM table, not these fields.
- amdgpu_dm_trace.h and dcn10_hwseq.c log them.
- dcn20_clk_mgr.c does use them for clock_cfg->max_clock_khz, but that clk_mgr is not DCN401.
- In **this checkout**, after a later candidate, forced_clocks / debug.max_disp_clk copy them into bw_*clk_khz. That later commit is **not** in v6.18.53.
So the default 6.18.y DCN401 clock request path does not program SMU from these two fields. They are still wrong on every modeset.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: No remaining clk_values_khz[num_clk_values] (without - 1) under dc/dml2. Other DML21 code already uses num_clk_values - 1.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Record:
- git describe HEAD → v6.18.53-5049-g0f0bdc2b0dffb
- make kernelversion → 6.18.53
- v6.18.53 dml21_wrapper.c still has `clk_values_khz[num_clk_values]
* 1000`.
- dml2_0/.../dml21_wrapper_fpu.c does **not** exist here; equivalent file is dml2/dml21/dml21_wrapper.c.
- Bug introduced with DCN401 (2024); this series has it.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: Expected apply: **clean** on this tree’s file (4-line context matches v6.18.53). Path rename vs mainline only.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No earlier fix of this indexing/unit bug in v6.18.53. DalForceMaxDisplayClock is a separate later change, not an alternate fix.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: drivers/gpu/drm/amd/display DML21 / DCN401. Criticality:
**IMPORTANT** (shipping RDNA4 display), not core mm/net. Peripheral to machines without DCN401.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: High churn (DC drops). Bug is old (initial DCN401), not last- week code.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Driver-specific: AMD DCN 4.0.1 (GC 12.0.0) with DML21, which is the default. Not universal.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Every DML21 validate-and-program (typical modeset). Not a race. Unprivileged DRM modeset can run the writer. Common: num_clk_values is
Quoted 1 line
1 (DPM table); then the off-by-one hits a 0 pad. Rare: single-level
table takes the * 1000 branch.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Not a C-array OOB crash: DML_MAX_CLK_TABLE_SIZE is 20, fill is min(20, MAX_NUM_DPM_LVL=8), so index num_clk_values (≤8) stays in- bounds. “Index out of range” is **logical** OOB of valid entries.
- Wrong stored max: typically **0** (multi-level) or **1000×** (single- level). max_supported_* are int; value_khz * 1000 can overflow signed 32-bit if kHz > ~2.147e6 (clocks ≳ 2147 MHz).
- Default DCN401 programming does not consume these fields for SMU (verified). User-visible black screen / wrong clocks on stock 6.18.y is **not verified**.
- Author still called it a **regression**; AMD QA tested the fix.
- Severity for stock 6.18.y runtime: **MEDIUM** (wrong clock caps in DC state / traces; debug force-max path would mis-program). Class of bug (bad max clocks / logical OOB) is what stable takes for GPU display.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: correct max disp/dpp clocks on DCN401 DML21; unblocks any path that reads them (including later force-max debug); matches DML21’s kHz units.
- Risk: very low (4 lines, local assignment).
- Ratio: high benefit/risk for a contained DC correctness fix.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real unit + off-by-one bug in code that runs on every DCN401 modeset.
- Tiny, obviously correct; AMD DC review + QA Tested-by.
- Buggy code is in this 6.18.y tree; applies cleanly.
- No new API; no series dependency.
- Shipping RDNA4 hardware.
AGAINST:
- Stock DCN401 clk_mgr does not program SMU from these two fields (verified).
- No public crash/syzbot; sparse “[why]” text.
- Logical OOB, not a KASAN-class overflow of the 20-entry array.
UNRESOLVED:
- Exact AMD-internal regression symptom (black screen vs wrong debug clocks) not in the public thread.
- lore.kernel.org/stable not readable here (403).
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — units + last index; R-b + Tested-by.
2. Fixes a real bug that affects users? **PASS** — wrong max clocks on DCN401 DML21; hardware is in this kernel.
3. Important issue? **PASS** — display clock-limit correctness / logical OOB; not a proven panic, but a real modeset-path clock bug on shipping GPUs, which stable routinely takes for amdgpu DC.
4. Small and contained? **PASS** — 4 lines, one function.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — same hunk in dml2/dml21/dml21_wrapper.c.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not an ID/quirk/DT/build/doc exception). Ordinary bugfix.
**Step 9.4: MAKE YOUR DECISION**
Backport. The tree has the bug, the fix is surgical and correct, and DML21 is the default path for DCN401. Limited SMU use of these fields lowers severity but does not make the fix inappropriate for 6.18.y.
===============================================================
Detailed explanation
===============================================================
This commit repairs dml21_calculate_rq_and_dlg_params so max_supported_dispclk_khz and max_supported_dppclk_khz take the last DPM table entry already stored in kHz. The old code indexed one past the last valid slot (usually a 0 pad) and multiplied by 1000 again even though dcn401_soc_and_ip_translator.c already converted MHz→kHz.
On this tree that matters: DCN401 defaults using_dml21 = true, so RDNA4 modesets hit DML21. The patch is four assignment lines, reviewed and tested at AMD, and matches existing num_clk_values - 1 use elsewhere in DML21.
It meets the stable rules: obviously correct, real bug, small, no new API, applies to local dml21_wrapper.c. Risk is negligible. Benefit is correct max-clock state for DCN401 and any consumer of those fields (trace, later force-max debug). The main caveat is that dcn401_clk_mgr does not currently feed these fields to SMU on the default path, so this is not a verified oops; it is still a real clock-table bug on hardware this kernel supports.
===============================================================
Verification
===============================================================
- [Phase 1] Subject/tags: fix + AMD R-b/Tested-by/SOB; no Fixes/syzbot. Pipeline SOB/Upstream ignored.
- [Phase 2] Diff: 4 lines in dml21_calculate_rq_and_dlg_params; drop * 1000, index num_clk_values - 1.
- [Phase 2] Table fill: dcn401_soc_and_ip_translator.c dispclk_mhz * 1000 into clk_values_khz; unused = 0.
- [Phase 2] Array: DML_MAX_CLK_TABLE_SIZE 20; MAX_NUM_DPM_LVL 8 — C OOB not hit; logical OOB is real.
- [Phase 3] Blame parent: 70839da6360500 DCN401 sources; ancestor of HEAD.
- [Phase 3] v6.18.53 file still has * 1000 and num_clk_values without - 1.
- [Phase 3] No Fixes tag; no other in-tree fix of this bug at v6.18.53.
- [Phase 4] b4 dig failed (lore error). Thread: mail-archive amd-gfx [PATCH 07/24], 2026-06-04, standalone in a 24-patch DC drop.
- [Phase 5] Callers: dml21_validate ← dml2_validate when arch 21; using_dml21 true on DCN401; GC 12.0.0.
- [Phase 5] dcn401_update_clocks / are_clock_states_equal do not read max_supported_*.
- [Phase 5] dml21_copy_clocks_to_dc_state does not overwrite max_supported_*.
- [Phase 6] Tree is 6.18.53; file exists as dml2/dml21/dml21_wrapper.c, not dml2_0/..._fpu.c.
- [Phase 6] Apply difficulty: clean on this path.
- [Phase 8] Failure mode: wrong max clocks (0 or 1000× / possible int overflow); default SMU programming impact not verified.
- UNVERIFIED: exact user-visible regression AMD saw; stable-list discussion (lore 403).
**YES**
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c +4 -4
@@ -152,16 +152,16 @@ static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_sta context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz;if (in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.num_clk_values >1 ) { context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = - in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.clk_values_khz[in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.num_clk_values] *1000 ; + in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.clk_values_khz[in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.num_clk_values -1 ]; }else { - context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.clk_values_khz[0 ] *1000 ; + context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dispclk.clk_values_khz[0 ]; }if (in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.num_clk_values >1 ) { context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = - in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.clk_values_khz[in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.num_clk_values] *1000 ; + in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.clk_values_khz[in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.num_clk_values -1 ]; }else { - context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.clk_values_khz[0 ] *1000 ; + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = in_ctx->v21.dml_init.soc_bb.clk_table.dppclk.clk_values_khz[0 ]; }/* get global mall allocation */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda/realtek: Fix mute LED for HP Victus 15-fa1xxx (MB 8C3F)
In reply to Sasha LevinFrom: Yashraj Ghule <[email protected]>
[ Upstream commit 19b02fecd8f857909af779afe3816e487ac10cd0 ]
The HP Victus 15-fa1xxx with motherboard 8C3F is missing the existing mute LED quirk for ALC245 codecs.
Add the 103c:8c3f subsystem ID to the existingALC245_FIXUP_HP_MUTE_LED_COEFBIT quirk.
Tested on HP Victus 15-fa1xxx (MB 8C3F). The mute LED works as intended.
---
LLM Generated explanations, may be completely bogus:
Confirmed: this is a one-line HDA subsystem-ID quirk, the existing ALC245 mute-LED fixup is already in 6.12, and 0x8c3f is not. Writing the full nine-phase analysis.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[ALSA: hda/realtek]** **[Fix]** mute LED for HP Victus 15-fa1xxx motherboard 8C3F by adding PCI/HDA subsystem ID 103c:8c3f to an existing quirk.
**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; the body states the author tested it on the matching machine
- **Reviewed-by:** none
- **Acked-by:** none
- **Link:** https://patch.msgid.link/20260816110655.11592-1- [email protected]
- **Cc: stable:** none (expected; not a negative signal)
- **Signed-off-by:** Yashraj Ghule <[email protected]> (author); Takashi Iwai <[email protected]> (ALSA maintainer)
- Ignore any Sasha Levin SOB if present in candidate packaging
Notable: ALSA maintainer SOB; author-tested; no syzbot/crash report (not expected for a hardware quirk).
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** HP Victus 15-fa1xxx with motherboard ID 8C3F does not match the existing ALC245 mute-LED quirk, so the mute LED does not follow mute state.
- **Symptom:** mute LED stays wrong / does not work.
- **Version info:** none in the message.
- **Root cause:** missing SND_PCI_QUIRK for SSID 103c:8c3f. Same product line already has other SSIDs (this tree already has 103c:8bc8 "HP Victus 15-fa1xxx").
- **Fix:** add that SSID to ALC245_FIXUP_HP_MUTE_LED_COEFBIT.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a hidden fix. It is an explicit hardware quirk / device-ID addition. The verb "Fix" is accurate: the LED hardware is already there; the driver never maps this SSID onto the existing coefbit LED helper.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File in the candidate: sound/hda/codecs/realtek/alc269.c (+1 / −0)
- This 6.12 tree still uses sound/pci/hda/patch_realtek.c (codec split not present)
- Function/table: alc269_fixup_tbl[]
- Scope: single-file, one-line surgical quirk addition
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** snd_hda_pick_fixup() during Realtek ALC269-family probe walks alc269_fixup_tbl by PCI SSID. 103c:8c3f does not match. Probe then may fall through to pin fixups and the vendor-wide HP entry SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED) (alc269_fixup_vendor_tbl). That generic HP LED path is not the ALC245 coefbit path used by other Victus 15-fa/fb machines.
- **After:** SSID 103c:8c3f matches ALC245_FIXUP_HP_MUTE_LED_COEFBIT, so alc245_fixup_hp_mute_led_coefbit() runs at HDA_FIXUP_ACT_PRE_PROBE and registers the mute LED via coef index 0x0b.
- Path affected: codec probe / mute-LED setup on that one HP SSID only.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** hardware workaround / device ID addition (stable exception).
- **Mechanism:** HP reused the Victus 15-fa1xxx name across motherboard SSIDs (8bc8 already in this tree; mainline also has 8c2d, 8c3f, and later 8bb1). Quirk matching is exact vendor:device. Missing ID → LED not driven by the ALC245 coefbit helper.
- Not UAF, leak, race, or crash.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: one SND_PCI_QUIRK using the same fixup already used by many Victus SKUs in this file (8a4f, 8a50, 8bc8, 8c30, 8c99, 8c9c, …).
- Minimal; no unrelated edits.
- Regression risk is very low: the new entry is SSID-specific. Wrong SSID would not match. Same helper is already production-used on this tree.
- v2 reordering (SSID sort) does not change runtime (the table is a match list, not order-dependent beyond uniqueness).
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Insertion sits next to SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT) — blamed to b474f60f6a0c9 (Adam Queler, 2024-09-03), already in this tree, originally Cc: stable.
- The fixup enum/function ALC245_FIXUP_HP_MUTE_LED_COEFBIT / alc245_fixup_hp_mute_led_coefbit() exists here (patch_realtek.c around 4778 and 10522).
- Helper was brought in via c4cc8f6c31263 ("ALSA: hda/realtek - Support mute led function for HP platform", upstream 22c7f77247a8), ancestor of HEAD.
- Same product line: 96fe253552c26 already added 103c:8bc8 "HP Victus 15-fa1xxx" to this tree (upstream a0914bf56e26, `Cc:
stable`).
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. N/A. The "bug" is a missing table entry, not a regression from a specific prior commit.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- This tree already contains many of the same class of patches (git log --grep='mute LED' -- sound/pci/hda/patch_realtek.c returned 166 commits).
- Recent examples: Victus 16-e0xxx MB 88ED (faee5b4612c26), Victus 15-fa0xxx MB 8A50 (0ecc9d81b46b1), Victus 16-s0xxx, 16-r0xxx, 15-fb1xxx (b474f60f6a0c9).
- Mainline context line 103c:8c2d "HP Victus 15-fa1xxx (MB 8C2D)" is **not** in this tree (git log --grep='8C2D' -- sound/pci/hda/patch_realtek.c empty). That is neighboring context, not a functional prerequisite.
- Standalone: yes. Not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: git log --author='Yashraj Ghule' -- sound/pci/hda/ is empty in this tree. Author is an end-user contributor, not the subsystem maintainer. Weight comes from Takashi Iwai applying it, plus the well- worn quirk pattern.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record:
- Needs ALC245_FIXUP_HP_MUTE_LED_COEFBIT and alc269_fixup_tbl — both present.
- Does **not** need the later alc269.c file split.
- Does **not** need the 8C2D quirk.
- Can apply standalone with path remap to sound/pci/hda/patch_realtek.c and insertion after the existing 0x8c30 line.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c <HEAD> cannot match this commit; it is not in this checkout.
- b4 mbox on Message-ID [email protected] found **4 messages**.
- Thread: v1 (15 Aug 2026) → Takashi review → v2 (16 Aug 2026) → Takashi "Applied now."
- v1 issues (not technical risk of the quirk): SOB must use a real name; table must stay in PCI SSID order (8c3f belongs after 8c30, not before).
- v2 addressed both; that is the committed form.
- No NAK. No reviewer concern about the quirk itself. No Cc: stable in the thread.
- lore.kernel.org HTTP fetch returned 403; thread recovered from lore via b4 mbox.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (from mbox, equivalent of b4 dig -w):
- To: Jaroslav Kysela [email protected]
- Cc: Takashi Iwai [email protected], [email protected]
- Reviewer/applier: Takashi Iwai (ALSA/HDA maintainer)
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No bugzilla/syzbot link. Evidence of user impact is the author test on HP Victus 15-fa1xxx (MB 8C3F). Same model family already needed extra SSIDs (8bc8 here; 8C2D and 8BB1 in later/mainline discussion), which matches HP shipping multiple board IDs under one marketing name.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone v1→v2, not a multi-patch series. Related but
independent: 8C2D (Eren Demir) and 8BB1 (Krish Gulati / bugzilla 221982) add other fa1xxx SSIDs. None of those replace 8C3F.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: No stable-list discussion found for 8C3F specifically. Closely related 8bc8 and 8c30 quirks in this tree **did** carry Cc: stable and were backported. That is the established policy for this exact pattern, not evidence this commit was already selected.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: KEY FUNCTIONS**
Record: table alc269_fixup_tbl; runtime helper alc245_fixup_hp_mute_led_coefbit() (unchanged); picker snd_hda_pick_fixup().
**Step 5.2: TRACE CALLERS**
Record:
- Realtek ALC269-family probe in patch_realtek.c (~12583) calls snd_hda_pick_fixup(..., alc269_fixup_tbl, alc269_fixups).
- Then snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE) (~12606).
- Context: codec probe (device enumeration), not IRQ/hot path.
**Step 5.3: TRACE CALLEES**
Record: alc245_fixup_hp_mute_led_coefbit() sets spec->mute_led_coef (idx 0x0b, mask/on/off bits) and snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: userspace/hw mute → HDA mixer/LED classdev → coef write. Reachable on this laptop at boot + mute key. Not a syscall security path.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: many ALC245_FIXUP_HP_MUTE_LED_COEFBIT rows for Victus SSIDs already in this file (including 0x8bc8 15-fa1xxx and 0x8c30 15-fb1xxx). Same bug, different board ID — systematic HP SSID fragmentation.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record:
- Tree: pending-6.12 / git describe p-6.12-3-gc504cf0baa3d8 / make kernelversion **6.12.111**.
- sound/hda/codecs/realtek/alc269.c does **not** exist.
- Equivalent table: sound/pci/hda/patch_realtek.c alc269_fixup_tbl.
- 0x8c3f is **absent** (grep on that file: no match).
- ALC245_FIXUP_HP_MUTE_LED_COEFBIT **is** present.
- Nearby 0x8c30 **is** present (line 11088).
- Nearby mainline 0x8c2d is **absent**.
- Bug is a missing ID, not a post-6.12 logic regression. The machine and the helper both exist for 6.12 users.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **minor path/context adjustment**, not a rework.
- Remap file to sound/pci/hda/patch_realtek.c.
- Insert after 0x8c30 (8c2d context from mainline is missing, so a verbatim git-apply of the mainline hunk may not be fully clean).
- No API/data-structure change.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: 0x8bc8 covers a different fa1xxx SSID, not 8C3F. Exact PCI SSID match only. No substitute for this ID.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: SUBSYSTEM AND CRITICALITY**
Record: ALSA HD-audio / Realtek codec (sound/pci/hda/). **IMPORTANT** for laptop audio users, **PERIPHERAL** in blast radius (one HP SSID). Not mm/fs/net core.
**Step 7.2: SUBSYSTEM ACTIVITY**
Record: High churn of device quirks; this file is the standard place for HP mute-LED IDs. Mature helper, incremental table growth.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: WHO IS AFFECTED**
Record: **driver-specific / hardware-specific** — only HP SSID 103c:8c3f (Victus 15-fa1xxx MB 8C3F). CONFIG_SND_HDA_CODEC_REALTEK (standard laptop configs).
**Step 8.2: TRIGGER CONDITIONS**
Record: every boot + mute on that SKU. Not a race. Unprivileged user can observe the LED; not a privilege-escalation path.
**Step 8.3: FAILURE MODE SEVERITY**
Record: mute LED does not track mute. **MEDIUM** functionally (no oops/corruption). Still a real hardware bug. Stable rules explicitly include device IDs and hardware quirks.
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit:** restores mute LED on a shipping HP Victus SKU for 6.12 users; same class already backported here many times.
- **Risk:** very low (one SSID-guarded line, existing helper).
- **Ratio:** strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Stable rules: "fix a real bug … **or just add a device ID**" and "**hardware quirk**" (Documentation/process/stable-kernel-rules.rst lines 15–20).
- One-line addition to an existing driver/fixup.
- Target SSID missing; helper and table present in 6.12.111.
- Author tested on the exact machine; ALSA maintainer applied v2.
- Same Victus 15-fa1xxx family already has 8bc8 in this tree; 8C3F is another board ID.
- Dozens of identical mute-LED quirk backports already in this file.
AGAINST:
- Not a crash/security/data-corruption fix.
- Mainline path differs (alc269.c vs patch_realtek.c); 8c2d context line missing (trivial).
- No Cc: stable on the original (expected here; similar quirks often still go to stable).
UNRESOLVED:
- Direct lore.kernel.org HTTP was 403; discussion was recovered via b4 mbox.
- Could not b4 dig -c an upstream SHA because that commit is not in this checkout.
- No independent bugzilla for 8C3F (author is the tester).
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — one table entry; author tested; maintainer applied.
2. Fixes a real bug that affects users? **PASS** — mute LED dead on that SKU.
3. Important issue? **PASS** as hardware quirk / device ID (severity MEDIUM, allowed exception).
4. Small and contained? **PASS** — +1 line.
5. No new features or APIs? **PASS** — enables existing fixup for one SSID.
6. Can apply to the local tree? **PASS** — helper+table exist; needs path remap and insert after 0x8c30.
**Step 9.3: EXCEPTION CATEGORIES**
Record: **Device ID addition to an existing driver** and **hardware quirk/workaround** (HDA SND_PCI_QUIRK).
**Step 9.4: DECISION**
This should be backported to **this** 6.12 tree. The bug is present (missing 103c:8c3f), the fix is the standard Realtek mute-LED quirk, and it is self-contained aside from a trivial file-path/context tweak.
What it solves for stable users: HP Victus 15-fa1xxx systems with motherboard SSID 8C3F get a working mute LED, matching other fa1xxx/fb1xxx board IDs already quirked here.
Risk vs benefit: one SSID-specific line vs a user-visible LED bug on a current consumer laptop. Benefit dominates.
Concerns: apply to sound/pci/hda/patch_realtek.c, not alc269.c; do not require the absent 8C2D row.
Verification:
- [Phase 1] Parsed subject/tags/body from the candidate message; Link msgid [email protected]; SOBs Ghule
+ Iwai; no Fixes/syzbot/stable Cc.
- [Phase 2] Diff is +1 SND_PCI_QUIRK(0x103c, 0x8c3f, ..., ALC245_FIXUP_HP_MUTE_LED_COEFBIT) in alc269_fixup_tbl.
- [Phase 3] git describe HEAD → p-6.12-3-gc504cf0baa3d8; make kernelversion → 6.12.111; branch pending-6.12.
- [Phase 3] alc269.c missing; quirk table in sound/pci/hda/patch_realtek.c.
- [Phase 3] grep 0x8c3f in that file: no match. ALC245_FIXUP_HP_MUTE_LED_COEFBIT present (enum ~8222, fixup ~10522, function ~4778).
- [Phase 3] 0x8c30 present (blame b474f60f6a0c9); 0x8bc8 present (96fe253552c26); 0x8c2d absent.
- [Phase 3] git merge-base --is-ancestor for b474f60f6a0c9 and c4cc8f6c31263: both ancestors of HEAD.
- [Phase 3] git log --grep='mute LED' -- sound/pci/hda/patch_realtek.c: 166 commits of the same class.
- [Phase 4] b4 mbox on the msgid: v1, Takashi review (SOB name + SSID sort), v2, "Applied now."
- [Phase 4] Recipients: perex, tiwai, linux-sound. No NAK.
- [Phase 4] lore WebFetch 403; discussion taken from the saved mbox.
- [Phase 5] Probe path snd_hda_pick_fixup ~12583 → snd_hda_apply_fixup PRE_PROBE ~12606; vendor HP fallback ALC269_FIXUP_HP_MUTE_LED at alc269_fixup_vendor_tbl.
- [Phase 6] Backport difficulty: path remap + insert after 8c30 (8c2d context missing).
- [Phase 7] ALSA HDA Realtek; quirk-table activity high.
- [Phase 8] Failure: mute LED inoperative on one HP SSID; severity MEDIUM; risk very low.
- UNVERIFIED: upstream mainline SHA of this commit (not in this checkout; b4 dig -c HEAD cannot match it).
**YES**
sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6974,6 +6974,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8c21 ,"HP Pavilion Plus Laptop 14-ey0XXX" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x8c2d ,"HP Victus 15-fa1xxx (MB 8C2D)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8c30 ,"HP Victus 15-fb1xxx" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ), +SND_PCI_QUIRK (0x103c ,0x8c3f ,"HP Victus 15-fa1xxx (MB 8C3F)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8c46 ,"HP EliteBook 830 G11" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8c47 ,"HP EliteBook 840 G11" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 iommu/qcom: Check pm_runtime_resume_and_get() return in probe
In reply to Sasha LevinFrom: Mukesh Ojha <[email protected]>
[ Upstream commit e910315ae08a23bc953daed10b1c518abac1df49 ]
The SMMU_INTR_SEL_NS register write in qcom_iommu_device_probe() uses pm_runtime_get_sync() without checking the return value. If runtime resume fails the subsequent writel_relaxed() would access hardware with clocks potentially disabled.
Switch to pm_runtime_resume_and_get() which handles the usage-count cleanup on failure, check the return value, and unwind the already registered iommu device on error.
---
LLM Generated explanations, may be completely bogus:
I have the tree version, the probe path, series context, and review thread. Compiling the nine-phase analysis and verdict next.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[iommu/qcom]** **[Check]** Check pm_runtime_resume_and_get() return in probe. “Check” here is a missing-error-handling fix, not a feature.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Reviewed-by:** Konrad Dybcio \<[email protected]\> (Qualcomm reviewer)
- **Signed-off-by:** Mukesh Ojha \<[email protected]\> (author)
- **Signed-off-by:** Will Deacon \<[email protected]\> (IOMMU/SMMU maintainer who applied it)
- **No Fixes:** tag (expected for this review pipeline)
- **No Cc: stable** (expected)
- **No Reported-by / Tested-by / Link / Acked-by**
- Ignore any pipeline “Signed-off-by: Sasha Levin” / “[Upstream commit …]” markers (none in the real commit)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** qcom_iommu_device_probe() does pm_runtime_get_sync() then writel_relaxed() to SMMU_INTR_SEL_NS without checking the PM call.
- **Symptom:** If runtime resume fails, MMIO is written with clocks possibly off. On Qualcomm that can hang the interconnect / SError, and probe still returns success so interrupt routing may be wrong.
- **Root cause:** ignored pm_runtime_get_sync() return; that API also leaves the usage count up on failure (the new API drops it).
- **Fix:** pm_runtime_resume_and_get(), check ret, unwind iommu_device_unregister + existing sysfs remove.
- **Version info:** none in the message. Code dates to the original driver (v4.14).
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not disguised. Explicit error-path / unclocked-access fix. The “usage-count cleanup” wording is slightly overstated at this site because the old code always called pm_runtime_put_sync() after the write; the real bugs are the unclocked writel and probe succeeding after a failed resume.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/iommu/arm/arm-smmu/qcom_iommu.c (+5 / −1)
- Function: qcom_iommu_device_probe()
- Scope: single-file surgical probe error path
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record: Before (only when qcom_iommu->local_base is set):pm_runtime_get_sync → always writel_relaxed(0xffffffff, local_base + SMMU_INTR_SEL_NS) → pm_runtime_put_sync → return 0. After:pm_runtime_resume_and_get; on failure goto err_iommu_unregister (unregister IOMMU, remove sysfs, return error); on success same write + put as before.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** (a) error-path unwind + (g) missing return check, which prevents unclocked MMIO.
- **Mechanism:** qcom_iommu_resume() enables iface/bus/tbu clocks via clk_bulk_prepare_enable(). If that (or SCM restore) fails, the old path still wrote SMMU_INTR_SEL_NS. Switch to pm_runtime_resume_and_get() is required: pm_runtime_get_sync() can return 1 (already active), so if (ret) on get_sync would mis- handle success.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Minimal and correct. pm_runtime_resume_and_get() returns 0 or negative (include/linux/pm_runtime.h). Unwind matches qcom_iommu_device_remove(). Regression risk is low: only the RPM- failure path starts failing probe instead of succeeding after a possibly unclocked write. If clocks cannot be enabled, failing probe is the right outcome.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: The if (qcom_iommu->local_base) write was added in **0ae349a0f33fb0** (“iommu/qcom: Add qcom_iommu”, Rob Clark, 2017-08-09), first in **v4.14-rc1**. Present in this tree (git merge- base --is-ancestor 0ae349a0f33fb0 HEAD). Long-lived bug, not new code.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Buggy code is the original 2017 driver, not a recent regression.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Same-day IOMMU pull (Will Deacon, 2026-07-22):
- c579f18e79599 — adds err_sysfs_remove (**soft prerequisite** for the new goto)
- bf69e515b1802 — devm_pm_runtime_enable() (series 2/6; changes nearby error labels)
- **e910315ae08a2** — this commit (series 3/6)
- Later 4/6–6/6 are other bugs in the same file, not needed for this hunk
Standalone for the probe RPM check, but the hunk assumes err_sysfs_remove exists. That label is in this tree.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Mukesh Ojha (Qualcomm) sent the “iommu/qcom: Misc Fixes” series. Not the file’s listed maintainer (Rob Clark); Konrad reviewed, Will applied. Related author commits on this file are the rest of that series.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Needs err_sysfs_remove from c579f18e79599 (cover letter:
series sits on Haoxiang Li’s sysfs cleanup). pm_runtime_resume_and_get() exists in this tree. Can apply standalone **on this checkout**. Does not need 4/6–6/6.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- **b4 dig:** v2 3/6, https://patch.msgid.link/20260717144608.3216274-4-
[email protected]
- **Revisions:** v1 3/8 (2026-06-23) → v2 3/6 (2026-07-17). Same hunk; v1 still had err_pm_disable (removed by 2/6).
- Konrad R-b on v1 with no requested changes: Message-ID [email protected]
- Will applied the whole v2 series 2026-07-22; no NAKs
- No reviewer asked for Cc: stable
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: To/Cc included Rob Clark, Will Deacon, Joerg Roedel, Robin Murphy, [email protected], linux-arm-msm. Konrad R-b; Will merged.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by, syzbot, or bugzilla. Author analysis of the error path, not a user crash report.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Cover: “[PATCH v2 0/6] iommu/qcom: Misc Fixes”. Independent fixes in one file. This patch does not need 4/6 (pgtbl leak), 5/6 (mutex publish), or 6/6 (ctx_probe clocks). 2/6 only shifts nearby labels.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: gnuweeb /stable/?q=qcom_iommu+pm_runtime_resume_and_get had no discussion of this fix. Not previously rejected for stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: qcom_iommu_device_probe(); new label err_iommu_unregister calling iommu_device_unregister().
**Step 5.2: TRACE CALLERS**
Record: .probe = qcom_iommu_device_probe on qcom-iommu. Triggered by DT qcom,msm-iommu-v1 / v2 during boot (or bind). Not a syscall. local_base is optional (first MEM resource); the RPM get/write runs only if that resource exists.
**Step 5.3: TRACE CALLEES**
Record: pm_runtime_resume_and_get → qcom_iommu_resume → clk_bulk_prepare_enable and possibly qcom_scm_restore_sec_cfg. Then writel_relaxed to SMMU_INTR_SEL_NS (0x2000), pm_runtime_put_sync.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Boot/device probe on MSM8916-class SoCs. Unprivileged users can rebind if they can unbind the driver; typical trigger is boot. Path is real on those boards.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same file still uses unchecked pm_runtime_get_sync in domain_free, attach_dev, identity_attach, unmap, flush_iotlb_all. Comments there already warn about unclocked TLB access. This commit only fixes probe. Sibling 6/6 adds a checked resume around ctx-bank FSR access.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Local tree is **v7.3-rc4** (git describe HEAD = v7.3-rc4-27-gf0100363d8c37, VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4). Driver is present. The unclocked-write pattern existed here from v4.14 until e910315ae08a2. HEAD already has the fixed form in qcom_iommu_device_probe() (lines 866–880). Evaluation is technical merit for this tree’s code, not “already landed.”
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** on this tree: err_sysfs_remove and devm_pm_runtime_enable are present. Hunk matches current/pre-fix context.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No alternate fix for this probe RPM check. Sysfs unwind (c579f18e79599) is here and is what this goto chains into.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **IOMMU / Qualcomm legacy SMMU** (drivers/iommu/arm/arm- smmu/qcom_iommu.c). **IMPORTANT** for MSM8916/8917/8937/8939/8953/8976 (DT still uses qcom,msm-iommu-v1). Not core MM/VFS; IOMMU failures break DMA/display/modem on those SoCs.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature “legacy qcom_iommu” (author’s words). Occasional correctness fixes in 2026, not heavy churn. Long-lived bug, more relevant for stable.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver/platform-specific**, CONFIG_QCOM_IOMMU, older Qualcomm ARM64 boards listed above. Not universal.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Probe, and only if local_base is mapped **and** runtime resume fails (clk_bulk_prepare_enable or SCM restore). Uncommon on healthy hardware; realistic on clock/GDSC/SCM failure. Not a normal userspace trigger.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Unclocked MMIO → possible **bus hang / SError** (**HIGH** if it fires). Otherwise probe succeeds with SMMU_INTR_SEL_NS not programmed (**MEDIUM** functional). Trigger rarity → overall **MEDIUM–HIGH**, still a real hang class, not cosmetic.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** Avoid hang/abort and false-successful probe when clocks cannot come up; fail cleanly and unwind registration.
- **Risk:** Very low (6-line error path, reviewed, standard API).
- **Ratio:** Favorable.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real unclocked MMIO on a documented-sensitive Qualcomm path
- Small (+5/−1), obviously correct
- pm_runtime_resume_and_get is the right API (get_sync’s 1 is success)
- Konrad R-b, Will merged; no NAKs
- Driver in this tree since v4.14; DT still ships for several SoCs
- Same-file comments treat unclocked access as a real hang risk
- Prerequisites (err_sysfs_remove, pm_runtime_resume_and_get) are in this tree
- Matches stable’s “oops, hang, … or some ‘oh, that’s not good’ issue”
**AGAINST:**
- No user/syzbot report; error path is uncommon
- Series patch 3/6 (but functionally independent)
- Other get_sync sites in the file remain unchecked
- Usage-count leak at this site was already balanced by put_sync
**UNRESOLVED:** lore.kernel.org HTTP 403; discussion recovered via b4 dig mbox, gnuweeb, and openwall. No evidence of a field crash, only code-path analysis.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — API contract matches; maintainer applied after R-b
2. Fixes a real bug that affects users? **PASS** — unclocked write and successful probe after failed resume on shipped MSM8916-class IOMMU
3. Important issue? **PASS** — hang/SError class; trigger is rare but severity is not “trivial”
4. Small and contained? **PASS** — 6 lines, one function
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — code and labels exist here
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID, quirk table, DT, build, or doc fix). Qualifies as a normal small bugfix.
**Step 9.4: MAKE YOUR DECISION**
This is a small, reviewed probe-path fix that stops a writel to SMMU MMIO when runtime resume (clocks) has failed, and fails probe instead of continuing. That is a real stability bug on a still-used Qualcomm IOMMU, the change is contained, and this checkout has the driver plus the sysfs unwind label the hunk uses. Benefit outweighs risk.
---
### What the commit solves for this tree
qcom_iommu_device_probe() programmed SMMU_INTR_SEL_NS after pm_runtime_get_sync() with no check. Resume enables the IOMMU clocks; on failure the write can hit unclocked hardware (hang/SError) and probe still returned 0. The fix uses pm_runtime_resume_and_get(), returns the error, and unregisters the IOMMU device.
It meets stable rules: obviously correct, real hang-class bug, ~6 lines, no new API. Risk is confined to the already-broken clock-failure path.
---
### Verification
- **[Phase 1]** Parsed e910315ae08a2: R-b Konrad Dybcio; SOB Mukesh Ojha, Will Deacon; no Fixes/Reported-by/stable Cc
- **[Phase 2]** Diff: +5/−1 in qcom_iommu_device_probe(); pm_runtime_get_sync → checked pm_runtime_resume_and_get + err_iommu_unregister
- **[Phase 2]** Confirmed pm_runtime_resume_and_get() returns 0 or negative (include/linux/pm_runtime.h); get_sync may return 1
- **[Phase 2]** Confirmed resume path: qcom_iommu_resume() → clk_bulk_prepare_enable()
- **[Phase 3]** Blame: write from 0ae349a0f33fb0 (v4.14-rc1); merge- base --is-ancestor true
- **[Phase 3]** c579f18e79599 and bf69e515b1802 are ancestors of HEAD
- **[Phase 4]** b4 dig -c e910315ae08a2: v2 3/6 of “Misc Fixes”; v1 3/8 same hunk
- **[Phase 4]** b4 dig -a/-w/-m: Konrad R-b, Will applied 1/6–6/6; recipients were IOMMU/QCOM lists; no NAK
- **[Phase 4]** Stable-list search: no prior discussion of this fix
- **[Phase 5]** Probe is platform driver for qcom,msm-iommu-v1/v2; DT hits in msm8916/8917/8937/8939/8953/8976
- **[Phase 6]** git describe HEAD = v7.3-rc4-27-gf0100363d8c37; Makefile 7.3.0-rc4; driver present; hunk matches
- **[Phase 8]** Failure mode: unclocked MMIO hang/SError if RPM resume fails at probe; severity HIGH if hit, trigger uncommon
- **UNVERIFIED:** lore.kernel.org 403 (mbox/mirrors used instead); no field reproducer found
The fix is small, surgical, and meets the stable criteria for this tree.
**YES**
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +5 -1
@@ -863,13 +863,17 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) }if (qcom_iommu->local_base) { -pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto err_iommu_unregister;writel_relaxed (0xffffffff , qcom_iommu->local_base +SMMU_INTR_SEL_NS );pm_runtime_put_sync (dev); }return 0 ; +err_iommu_unregister: +iommu_device_unregister (&qcom_iommu->iommu); err_sysfs_remove:iommu_device_sysfs_remove (&qcom_iommu->iommu); err_pm_disable:
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 misc: bcm-vk: validate write size before allocation
In reply to Sasha LevinFrom: Yousef Alhouseen <[email protected]>
[ Upstream commit f66c40cd90954f52809b3eabd386137f56bb6215 ]
bcm_vk_write() uses the user-supplied write count to size a flexible-array work entry and then copies count bytes into that array. The allocation expression is evaluated before any overflow check, so a very large count can wrap the allocation smaller than the subsequent copy.
Reject empty writes, check the allocation arithmetic before kzalloc(), and initialize the __counted_by field before copying into to_v_msg[].
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Subsystem: misc: bcm-vk
- Action: **validate** (pre-check / prevent)
- Claimed intent: reject a user-controlled write length that is used as an allocation size before the copy.
Record: [misc/bcm-vk] [validate] [check write count before sizing the work-entry allocation]
**Step 1.2: Tags**
- Signed-off-by: Yousef Alhouseen <[email protected]> (author)
- `Link: https://patch.msgid.link/20260629160605.29412-1-
[email protected]`
- Signed-off-by: Greg Kroah-Hartman <[email protected]> (char-misc maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence of the last two is expected in this pipeline)
- Sasha Levin SOB is not present on the real commit f66c40cd90954
Record: Author SOB + Greg SOB + msgid Link. No syzbot, no Fixes, no stable CC.
**Step 1.3: Body**bcm_vk_write() sizes a flexible-array work entry with the user count, then copy_from_user()s count bytes into it. The sum sizeof(*entry) + count + vk->ib_sgl_size is evaluated with wrapping C addition **before** any overflow check, so a huge count can make kzalloc() allocate less than count, and the copy overruns the slab object.
The patch: reject count == 0, check the two additions with check_add_overflow() before kzalloc(), and set to_v_blks (the __counted_by field) before the copy.
Record:
- Bug: integer wrap of allocation size vs subsequent copy length
- Symptom: heap buffer overflow (or HARDENED_USERCOPY abort) on write()
- Version info: none in the message
- Root cause: unchecked size_t addition of a user length
**Step 1.4: Hidden bug fix?**
Not hidden. The subject says “validate”; the body describes wrap, then copy. The empty-write reject and __counted_by move are the same write path, not a cleanup-only change.
Record: Explicit memory-safety fix, not disguised cleanup.
---
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- File: drivers/misc/bcm-vk/bcm_vk_msg.c (+12 / −6; git show --stat reports 18 lines changed)
- Include: #include <linux/overflow.h>
- Function: bcm_vk_write() only (the bcm_vk_msg_init hunk in the prompt is context-only; no functional change there)
Record: Single-file surgical fix in one syscall handler.
**Step 2.2: Code flow**
Before (verified on f66c40cd90954^):
1. Reject count not a multiple of 16 (VK_MSGQ_BLK_SIZE).
2. kzalloc(sizeof(*entry) + count + vk->ib_sgl_size, GFP_KERNEL) with wrapping add.
3. copy_from_user(&entry->to_v_msg[0], buf, count).
4. Then entry->to_v_blks = count >> 4, then a **later** msgq-size check.
After:
1. Also reject count == 0.
2. check_add_overflow(sizeof(*entry), count, &entry_size) then add vk->ib_sgl_size; fail with -EOVERFLOW.
3. kzalloc(entry_size).
4. Set to_v_blks **before** the copy.
5. Same copy and later msgq check.
Record: Normal write() path; hardening of alloc + copy, not an error- path-only change.
**Step 2.3: Bug mechanism**
- Category: **integer overflow → heap buffer overflow** (also __counted_by / bounds-sanitizer correctness).
- User count is only required to be a multiple of 16. Near SIZE_MAX, the sum wraps to a small size, kzalloc succeeds, then copy_from_user uses the original huge count. The first mapped user page(s) are enough to overflow the slab object before the copy hits -EFAULT.
- The msgq bound is **after** the copy, so it does not prevent the overflow.
- to_v_msg[] is __counted_by(to_v_blks) in this tree. kzalloc leaves to_v_blks == 0, so the copy used to write into a counted-by- zero flexible array.
Record: Alloc-size wrap + copy; __counted_by initialized too late.
**Step 2.4: Fix quality**
- Obviously correct: standard check_add_overflow + allocate checked size.
- Minimal; no API/structure change.
- Regression risk: low. -EOVERFLOW / -EINVAL for impossible sizes. Rejecting count == 0 is reasonable (zero-length messages are not a multiple of a useful blk payload). check_add_overflow is an existing helper.
Record: High quality, low regression risk.
---
## Phase 3: Git history
**Step 3.1: Blame / introduction**
- Driver messaging (including this alloc+copy) landed in 111d746bb4767 (“misc: bcm-vk: add VK messaging support”), contained in v5.12-rc1.
- __counted_by on struct bcm_vk_wkent: 3c69d52e3e12f (contained in v6.7-rc1).
- Parent of the fix still had the wrapping kzalloc expression.
Record: Buggy alloc/copy since v5.12; counted-by issue since v6.7.
**Step 3.2: Fixes: tag**
None. Ancestor of the bug is 111d746bb4767, and git merge-base --is- ancestor 111d746bb4767 HEAD is true.
**Step 3.3: File history**
Recent bcm-vk work is mostly style, kmalloc_obj conversion, an acquire/release change, and this overflow check. No prerequisite series for this hunk. Standalone.
**Step 3.4: Author**
Yousef Alhouseen also has nearby misc overflow/bounds patches (hpilo, ibmvmc, xilinx_sdfec, genwqe, sgi-gru) merged the same day by Greg. Not the bcm-vk maintainer; a correctness/security sweep. Greg still took the patch.
**Step 3.5: Dependencies**
- check_add_overflow() / linux/overflow.h: present in this tree (helpers date to 2018).
- __counted_by field exists here; moving to_v_blks does not need extra commits.
- Applies standalone.
Record: No missing prerequisites in this checkout.
---
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**b4 dig -c f66c40cd90954 matched msgid [email protected].b4 dig -a: **v1 only**, 2026-06-29.
Saved mbox: **one message** (the patch). No replies, NAKs, or reviewer comments in that thread. Greg applied it to char-misc.
Direct lore HTTP fetch returned 403; discussion content was taken from the b4 mbox instead.
**Step 4.2: Recipients (b4 dig -w)**
- Maintainer: Scott Branden
- Broadcom internal list
- Arnd Bergmann
- Greg Kroah-Hartman
- [email protected]
Right lists/people were CCed. No Reviewed-by on the committed patch.
**Step 4.3: Bug report**
No Reported-by / syzbot / bugzilla. Trigger needs /dev/bcm-vk.N (PCI device), so syzbot is unlikely.
**Step 4.4: Series**
Standalone [PATCH], not N/M.
**Step 4.5: Stable list**
Web search did not turn up a stable@ discussion of this subject. Unverified beyond that (lore search HTTP 403).
Record: v1, maintainer-tree merge, no NAK, no explicit stable nomination in the thread.
---
## Phase 5: Semantic / call graph
**Step 5.1: Functions**bcm_vk_write() only.
**Step 5.2: Callers**
Wired as .write = bcm_vk_write in bcm_vk_fops (bcm_vk_dev.c). That is the miscdevice write() path. Reachable from the write syscall on /dev/bcm-vk.N.
**Step 5.3: Callees**bcm_vk_drv_access_ok, kzalloc, copy_from_user, later get_q_num, msgq readl, bcm_vk_get_msg_id. The overflow is **before** queue/id logic.
**Step 5.4: Reachability**
1. PCI probe of Broadcom Valkyrie (PCI_DEVICE_ID_VALKYRIE 0x5e87) registers the misc device.
2. bcm_vk_drv_access_ok() requires msgq_inited (card messaging up); otherwise -EPERM.
3. Then user write() with a 16-aligned huge length hits the wrap.
Userspace-reachable on systems that have this card and a live msgq.
**Step 5.5: Similar patterns**
Same author’s same-day misc write/size checks. Same class of bug, not a bcm-vk-only refactor.
Record: Syscall-reachable heap overflow on a real device node.
---
## Phase 6: This checkout
**Step 6.1: Local tree**
- git describe HEAD: v7.3-rc4-27-gf0100363d8c37
- make kernelversion: 7.3.0-rc4
- Makefile: VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4
- Driver, bcm_vk_write(), check_add_overflow, and __counted_by are all present.
- git merge-base --is-ancestor f66c40cd90954 HEAD is true (current bcm_vk_write() already has the checks). That is not used as “already selected for stable”; it only confirms the code this patch targets exists here.
Record: Buggy path exists in this lineage since v5.12; this tree is 7.3-rc4 and has the helpers the patch needs.
**Step 6.2: Backport difficulty**
Against this tree: clean (the hunk matches current code). overflow.h is already used by the patched file.
**Step 6.3: Other fixes for the same bug**
No earlier overflow check on this alloc. No competing fix.
---
## Phase 7: Subsystem context
**Step 7.1**
- Subsystem: drivers/misc/bcm-vk (Broadcom VK PCIe accelerator, video/crypto offload).
- Criticality: **PERIPHERAL** hardware, but the handler is a generic write() with a kernel heap overflow.
**Step 7.2**
Mature driver (v5.12). Low churn besides treewide kmalloc conversions and this safety patch. Maintainer status: Supported (Scott Branden).
---
## Phase 8: Impact and risk
**Step 8.1: Who is affected**
Users of Broadcom VK (CONFIG_BCM_VK, PCI 14e4:5e87). Not universal. Device node is a miscdevice; .mode is unset, so default char-dev permissions (typically root/udev). Anyone who can open the node can issue the write().
**Step 8.2: Trigger**
- Hardware present, driver loaded, msgq initialized.
- write(fd, buf, count) with count a non-zero multiple of 16 large enough to wrap sizeof(*entry) + count + ib_sgl_size (ib_sgl_size default 16×16 = 256).
- Not every boot; it is a deliberate/malicious or buggy huge write, not a typical message size.
- Unprivileged only if udev grants the node; otherwise local privileged/compromised userspace with device access.
**Step 8.3: Failure mode**
Heap overflow of a kzalloc object, or usercopy abort if HARDENED_USERCOPY is on. Severity: **HIGH** (memory corruption / crash). Security-relevant if the node is writable.
**Step 8.4: Risk vs benefit**
- Benefit: stops a user-controlled wrap-and-copy; also makes __counted_by consistent before the copy.
- Risk: ~12 insertions in one function; overflow helpers already in this tree.
- Ratio: high benefit / very low risk for this tree.
---
## Phase 9: Synthesis
**Evidence FOR**
- Real wrap of kzalloc size vs copy_from_user length; msgq check is too late.
- Syscall-reachable (write on /dev/bcm-vk.N).
- Small, obviously correct, uses existing check_add_overflow.
- Merged by Greg KH; CCed to the bcm-vk maintainer.
- Driver and helpers exist in this 7.3-rc4 tree.
- __counted_by init-before-copy is required in this tree.
**Evidence AGAINST**
- Niche PCIe accelerator, not a core-path bug.
- No reporter, syzbot, Fixes, or stable CC.
- No mailing-list review comments (v1 applied as-is).
- Author is not the subsystem maintainer (audit-style series).
**Unresolved**
- Full lore HTML was 403; thread content is from b4 dig -m (single email).
- No stable@ discussion found.
**Stable rules**
1. Obviously correct and tested — **PASS** (standard overflow check; merged to char-misc). No extra Tested-by.
2. Real bug affecting users — **PASS** (heap overflow on write for VK users).
3. Important (crash/security/corruption) — **PASS** (HIGH: heap smash / usercopy BUG).
4. Small and contained — **PASS** (one function, ~12 lines).
5. No new features/APIs — **PASS**.
6. Can apply to this tree — **PASS** (overflow.h, bcm_vk_write, __counted_by all present).
**Exception category:** none (not an ID/quirk/DT/build/doc exception). It is a normal memory-safety fix.
This tree is **7.3.0-rc4**. The driver has had this alloc+copy since v5.12. The patch is a contained security/correctness fix and belongs here.
---
## What the commit solves for this tree
bcm_vk_write() trusted a user size_t count in kzalloc(sizeof(*entry) + count + vk->ib_sgl_size) and then copied count bytes. A 16-aligned huge count wraps the size, allocates a small object, and overflows it on copy. The later queue-size check does not run first. The fix checks the arithmetic, rejects empty writes, and sets to_v_blks before touching to_v_msg[].
It matches stable rules: real overflow, small, no new API, helpers already in this tree. Risk is low; benefit is avoiding a write-triggered heap overflow on Broadcom VK devices.
---
## Verification
- [Phase 1] git show f66c40cd90954 --format=fuller: subject/body/tags as above; no Fixes/Reported-by/Cc: stable
- [Phase 2] Diff vs parent: overflow.h, !count check, two check_add_overflow, to_v_blks moved before copy_from_user
- [Phase 2] git show f66c40cd90954^:drivers/misc/bcm-vk/bcm_vk_msg.c:
wrapping kzalloc then copy then to_v_blks
- [Phase 3] 111d746bb4767 contained in v5.12-rc1; 3c69d52e3e12f counted_by in v6.7-rc1
- [Phase 3] git merge-base --is-ancestor 111d746bb4767 HEAD: driver in this tree
- [Phase 3] Author log under drivers/misc/: clustered overflow/bounds patches merged 2026-07-17
- [Phase 4] b4 dig -c f66c40cd90954: msgid 20260629160605.29412-1; v1 only
- [Phase 4] b4 dig -w: Branden, Broadcom list, Arnd, Greg, lkml
- [Phase 4] b4 dig -m: 1-message mbox, no replies/NAKs
- [Phase 4] WebFetch lore: 403; stable@ search: no dedicated thread found
- [Phase 5] .write = bcm_vk_write; bcm_vk_drv_access_ok is atomic_read_acquire(&vk->msgq_inited)
- [Phase 5] PCI id table: Broadcom Valkyrie 0x5e87 only
- [Phase 6] git describe HEAD = v7.3-rc4-27-gf0100363d8c37; kernelversion 7.3.0-rc4
- [Phase 6] Current bcm_vk_write() already contains check_add_overflow; include/linux/overflow.h defines it
- [Phase 6] to_v_msg[] __counted_by(to_v_blks) in bcm_vk_msg.h
- [Phase 8] nr_ib_sgl_blk default BCM_VK_DEF_IB_SGL_BLK_LEN 16; VK_MSGQ_BLK_SIZE 16
- UNVERIFIED: distro udev mode for /dev/bcm-vk.N (whether unprivileged open is allowed)
**YES**
drivers/misc/bcm-vk/bcm_vk_msg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/misc/bcm-vk/bcm_vk_msg.c +12 -6
@@ -9,6 +9,7 @@#include <linux/interrupt.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/overflow.h> #include <linux/poll.h> #include <linux/sizes.h> #include <linux/spinlock.h>
@@ -1090,6 +1091,7 @@ ssize_t bcm_vk_write(struct file *p_file,u32 q_num;u32 msg_size;u32 msgq_size; +size_t entry_size;if (!bcm_vk_drv_access_ok (vk))return -EPERM ;
@@ -1097,20 +1099,26 @@ ssize_t bcm_vk_write(struct file *p_file,dev_dbg (dev,"Msg count %zu\n" , count);/* first, do sanity check where count should be multiple of basic blk */ -if (count & (VK_MSGQ_BLK_SIZE -1 )) { -dev_err (dev,"Failure with size %zu not multiple of %zu\n" , +if (!count || count & (VK_MSGQ_BLK_SIZE -1 )) { +dev_err (dev,"Failure with size %zu not a positive multiple of %zu\n" , count,VK_MSGQ_BLK_SIZE ); rc = -EINVAL ; goto write_err; } +if (check_add_overflow (sizeof (*entry), count, &entry_size) || +check_add_overflow (entry_size, vk->ib_sgl_size, &entry_size)) { + rc = -EOVERFLOW ; + goto write_err; + } +/* allocate the work entry + buffer for size count and inband sgl */ - entry =kzalloc (sizeof (*entry) + count + vk->ib_sgl_size, -GFP_KERNEL ); + entry =kzalloc (entry_size,GFP_KERNEL );if (!entry) { rc = -ENOMEM ; goto write_err; } + entry->to_v_blks = count >>VK_MSGQ_BLK_SZ_SHIFT ;/* now copy msg from user space, and then formulate the work entry */ if (copy_from_user (&entry->to_v_msg[0 ], buf, count)) {
@@ -1118,7 +1126,6 @@ ssize_t bcm_vk_write(struct file *p_file, goto write_free_ent; } - entry->to_v_blks = count >>VK_MSGQ_BLK_SZ_SHIFT ; entry->ctx = ctx;/* do a check on the blk size which could not exceed queue space */
@@ -1355,4 +1362,3 @@ void bcm_vk_msg_remove(struct bcm_vk *vk)bcm_vk_drain_all_pend (&vk->pdev->dev, &vk->to_v_msg_chan,NULL );bcm_vk_drain_all_pend (&vk->pdev->dev, &vk->to_h_msg_chan,NULL ); } -
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: mld: cancel wiphy work before freeing wiphy
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit c99bc4d4e0ba6f4661b2b914c96a597d26e7cc05 ]
When we fail to load the fw during op-mode start, we purge the list of the async handlers but we don't cancel the work.
Same when we stop the op-mode.
Before freeing wiphy, we need to cancel/flush any pending wiphy work, otherwise the work will fire with a freed memory.
cfg80211 will do it anyway, but it will warn.
Cancel the work in those cases.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: this is a small UAF/WARN fix in iwlwifi MLD, the buggy path exists in this 7.3-rc4 tree, and the change is self- contained.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [iwlwifi/mld] [cancel] cancel wiphy work before freeing wiphy
- Subsystem: wifi: iwlwifi: mld
- Action verb: **cancel** (prevent leftover work from running after teardown)
- Intent: stop pending wiphy_work before ieee80211_free_hw() so it cannot run against freed memory
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Reviewed-by: Johannes Berg <[email protected]> — mac80211/cfg80211 and iwlwifi maintainer
- `Link: https://patch.msgid.link/20260714165826.07aa49f755a2.I734a27b1b
0eeb5b0e821aee3318fee8dc0a6bc03@changeid`
- Signed-off-by: Miri Korenblit <[email protected]> (author; ignore any Sasha Levin SOB)
- **No** Fixes:, **no** Cc: stable, **no** Reported-by, **no** Tested-by — expected for this review pipeline
- Notable: maintainer Reviewed-by; no syzbot/KASAN report in the message
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** On op-mode start firmware-load failure, async handler *list* is purged (iwl_mld_stop_fw() → iwl_mld_cancel_async_notifications()), but async_handlers_wk is not cancelled. Same gap on op-mode stop.
- **Symptom:** Pending wiphy work can run after ieee80211_free_hw(); cfg80211 still drains/cancels and **WARNs**.
- **Failure mode:** use-after-free of wiphy/iwl_mld if the work runs; otherwise WARN_ON(!list_empty(&rdev->wiphy_work_list)) in cfg80211_dev_free().
- **Root cause:** cancel of async_handlers_wk was removed from the generic purge helper; start-fail/stop still free the wiphy with work queued.
- **Version info in message:** none
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not disguised. Explicit teardown correctness / UAF-prevention. Not style cleanup.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: drivers/net/wireless/intel/iwlwifi/mld/mld.c — **+3 lines**, 0 removed (git show --stat: 3 insertions)
- Functions: iwl_op_mode_mld_start(), iwl_op_mode_mld_stop()
- Scope: **single-file surgical fix**
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
Hunk 1 (iwl_op_mode_mld_start, firmware/NVM failure):
- **Before:** wiphy_unlock → rtnl_unlock → goto err → ieee80211_free_hw() with async_handlers_wk possibly still on wiphy_work_list.
- **After:** wiphy_work_cancel(mld->wiphy, &mld->async_handlers_wk) while wiphy_lock is still held, then unlock/free.
- Path: **error path** (fw load or NVM read failure during probe/op-mode start).
Hunk 2 (iwl_op_mode_mld_stop):
- **Before:** lock, iwl_mld_low_latency_stop / iwl_mld_deinit_time_sync, unlock, ieee80211_unregister_hw / ieee80211_free_hw.
- **After:** same, but cancel async_handlers_wk under the wiphy lock first.
- Path: **teardown** (module unload / transport op-mode leave).
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** memory safety (use-after-free of work item / wiphy) + leftover-work WARN
- **Mechanism:** wiphy_work_queue() during RX after ALIVE; iwl_mld_stop_fw() purges async_handlers_list but (after 59a5876e474ac) no longer cancels the work. ieee80211_free_hw() → wiphy_free() → cfg80211_dev_free() WARNs if the list is non-empty. Worker cfg80211_wiphy_work() can also run iwl_mld_async_handlers_wk() after unlock and race teardown.
- **Fix:** wiphy_work_cancel() under the wiphy mutex (required by lockdep_assert_held(&wiphy->mtx) in wiphy_work_cancel()).
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: both sites already hold wiphy_lock; cancel of a not-queued work is a no-op (list_empty check in wiphy_work_cancel()).
- Minimal; no API/data-structure change.
- Regression risk: **very low**. Cancel vs flush is appropriate here (do not run handlers from a dead/going-away FW). Does not restore the lock requirement on iwl_mld_cancel_async_notifications().
- Residual (pre-existing, not introduced here): NVM-fail path still does not call iwl_mld_stop_fw(); cancel avoids running those handlers during free. That is strictly safer than leaving work queued.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Surrounding start-fail/stop skeleton: d1e879ec600f9 (“wifi: iwlwifi:
add iwlmld sub-driver”, 2025-02/03) — first appeared in **v6.15**.
- The two new cancel lines: c99bc4d4e0ba6 (this commit, 2026-07-14).
- Stop-path wiphy_lock wrapper: 83128399f3b492 (Benjamin Berg, 2025-05).
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Historical chain (verified with git show / git log -S):
1. 4f7a07791944e (2025-04, Fixes: d1e879ec600f9) — cancel async notifs on start failure specifically because work can run after ieee80211_free_hw (**UAF**).
2. 833026098b2d9 — fold cancel+purge into iwl_mld_cancel_async_notifications().
3. **59a5876e474ac (2026-05-26, in v7.2, not in v7.1)** — **removed** wiphy_work_cancel() from that helper so it can run without the wiphy lock. That **reopened** the free-without-cancel hole.
4. This commit puts cancel back on the two paths that actually free the wiphy.
59a5876e474ac **is** an ancestor of this tree (git merge-base --is- ancestor → yes via v7.2).
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- Nearby: a40ad60a47f7c purge-on-NIC-error; 59a5876e474ac remove cancel from helper.
- This is **not** patch-dependent on other hunks in the 15-patch iwlwifi-next dump; parent is unrelated 21b3263b90e80 (“mvm: validate monitor notif link_id”).
- Standalone: **yes**.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Miri Korenblit is a primary iwlwifi MLD author (driver introduction and most async-handler work). Johannes Berg reviewed. High confidence in the diagnosis.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS** Record:
- Needs wiphy_work_* and struct wiphy_work async_handlers_wk — present since MLD intro in this tree.
- Needs the start-fail if (ret) / stop wiphy_lock shape — present.
- Needs 59a5876e474ac as the regression that made cancel missing; that commit is in this tree.
- **Can apply standalone: yes** (already an ancestor of HEAD).
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c c99bc4d4e0ba6: **[PATCH iwlwifi-next 08/15]**
https://patch.msgid.link/20260714143119.07aa49f755a2.I734a27b1b0eeb5b0
e821aee3318fee8dc0a6bc03@changeid
- b4 dig -a: v1 then **v2** “wifi: iwlwifi: updates - 07-14-2026”
https://patch.msgid.link/20260714165826.07aa49f755a2.I734a27b1b0eeb5b0
e821aee3318fee8dc0a6bc03@changeid
Committed Link: is **v2** (latest).
- Lore WebFetch returned **403**; patchwork bot-blocked. Review body beyond tags is **UNVERIFIED**. No NAK found in b4 metadata.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): Miri Korenblit; Johannes Berg ([email protected] / intel.com); linux- [email protected]. Maintainer was To/Cc and Reviewed-by.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by / bugzilla / syzbot. Author-found from code (consistent with 4f7a077’s earlier UAF write-up). User count:
**UNVERIFIED**, but the start-fail path is firmware-load failure — a real probe path.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: 08/15 of a mixed iwlwifi-next batch, not a dependent 1/N fix series. Parent commit unrelated. No other series patch required for this hunk.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: WebSearch of lore.kernel.org/stable for this subject did **not** find a stable-specific thread. **UNVERIFIED** that anyone nominated or rejected it on stable@ (absence of Cc:stable is expected).
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: iwl_op_mode_mld_start, iwl_op_mode_mld_stop. Related
callees: wiphy_work_cancel, iwl_mld_load_fw, iwl_mld_stop_fw, ieee80211_free_hw.
**Step 5.2: TRACE CALLERS**
Record:
- iwl_mld_ops.start = iwl_op_mode_mld_start — op-mode start from iwlwifi transport when iwlmld is selected (iwl_opmode_register("iwlmld", ...)).
- Stop is the matching .stop callback on unbind/unload.
- Context: process, probe/remove — not IRQ. Reachable whenever CONFIG_IWLMLD hardware probes or the module is removed.
**Step 5.3: TRACE CALLEES**
Record:
- Start-fail: iwl_mld_load_fw() on error after ALIVE calls iwl_mld_stop_fw() → purges list, does **not** cancel work.
- Then ieee80211_free_hw() → wiphy_free() → put_device() → wiphy_dev_release() → cfg80211_dev_free() which WARN_ON(!list_empty(&rdev->wiphy_work_list)) then cancel_work_sync(&rdev->wiphy_work).
- Worker: cfg80211_wiphy_work() → wk->func → iwl_mld_async_handlers_wk().
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Userspace/admin trigger: load iwlwifi on MLD firmware (Wi-Fi 7 Intel), failed firmware/NVM, or unload. Not a syscall exploit path; **driver probe/remove**. Common enough for production laptops.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: MVM already cancels/flushes analog work in iwl_mvm_mac_stop() (wiphy_work_cancel on async_handlers_wiphy_wk). MLD iwl_mld_mac80211_stop() already cancels add_txqs_wk but **not** async_handlers_wk. This commit aligns MLD teardown with that rule.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?** Record:
- Local tree: **v7.3-rc4** (git describe HEAD → v7.3-rc4-27-gf0100363d8c37; VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4).
- MLD driver **present** (drivers/net/wireless/intel/iwlwifi/mld/mld.c).
- Regression 59a5876e474ac **is** in this history (v7.2+).
- Current file already contains both wiphy_work_cancel calls (this commit is ancestor of HEAD). Pre-fix parent of c99bc4d4e0ba6 matches the supplied diff exactly.
- Bug was introduced **before** this 7.3 branch (in v7.2), not after.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply** on this tree (already applied). Surrounding iwl_op_mode_mld_start/stop matches the patch. wiphy_work_cancel exists in net/wireless/core.c.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: 4f7a07791944e / 833026098b2d9 / 59a5876e474ac are all here. No alternate fix of this hole besides c99bc4d4e0ba6. git log --grep='cancel wiphy work' only this commit.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: drivers/net/wireless/intel/iwlwifi/mld — Intel Wi-Fi MLD (CONFIG_IWLMLD). **IMPORTANT** (shipping Wi-Fi 7 NICs), not core mm/VFS, not staging.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Very active (NAN, RSC, scan, firmware API churn in recent git log on mld.c). Mature enough that this is a teardown correctness fix, not new-feature scaffolding.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **driver-specific / config-specific** — CONFIG_IWLMLD users (Intel MLD firmware devices). Not universal.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- Start-fail: firmware load/init failure after ALIVE (missing/bad fw, PNVM/init timeout) — **realistic probe path**.
- Stop: op-mode teardown/unload.
- Timing: leftover wiphy_work after list purge.
- Unprivileged trigger: only if an unprivileged user can unload the driver or force fw failure — typically **admin/probe**. Not a syzbot- style syscall UAF, but probe-fail is still user-visible.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- Confirmed: WARN_ON in cfg80211_dev_free() if work remains queued (taint; panic if panic_on_warn).
- Author/prior commit (4f7a077): work running after ieee80211_free_hw is **UAF**. cfg80211’s cancel_work_sync in cfg80211_dev_free reduces but does not make the WARN or the post- unlock race imaginary (cfg80211_wiphy_work can run after wiphy_unlock and before free).
- Severity: **HIGH** (WARN + realistic UAF race on probe fail / unload).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- Benefit: **high** for IWLMLD users — stops WARN/UAF on fw init failure and stop.
- Risk: **very low** — 3 lines, existing API, lock already held.
- Ratio: strongly in favor of including the fix.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real teardown bug: pending async_handlers_wk after wiphy free
- Regression from 59a5876e474ac (in this tree); restores cancel only where memory is freed
- Same UAF class as 4f7a07791944e (explicit “access freed memory”)
- 3-line, obviously correct, maintainer Reviewed-by
- Applies to this tree’s MLD code; prerequisites present
- cfg80211 documents leftover work with WARN_ON
AGAINST:
- No Fixes:/Cc:stable/Reported-by (not a negative per pipeline rules)
- Error/teardown path, not hot datapath
- cfg80211 already cancel_work_syncs, so many hits are WARN rather than a guaranteed oops
- 08/15 series member (but standalone)
UNRESOLVED:
- Full lore review text (HTTP 403)
- Whether stable@ already discussed this subject
- How often start-fail hits with work still queued (depends on notifications after ALIVE)
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — lock already held; Johannes reviewed; cancel is the documented API.
2. Fixes a real bug that affects users? **PASS** — leftover wiphy work on fw-start failure and op-mode stop.
3. Important issue? **PASS** — UAF risk + WARN_ON in cfg80211 (HIGH).
4. Small and contained? **PASS** — +3 lines, one file, two call sites.
5. No new features or APIs? **PASS**.
6. Can apply to the local tree? **PASS** — MLD + wiphy_work_cancel + matching functions exist (commit already in 7.3-rc4).
**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**
This tree is **7.3-rc4** and contains the iwlwifi MLD op-mode. The hole is real here: after 59a5876e474ac, start-fail and stop free the wiphy without cancelling async_handlers_wk. That is a use-after-free/WARN class bug on firmware load failure — a path users hit. The fix is three lines, matches cfg80211’s contract, and does not need the rest of the 15-patch series.
---
### What the commit solves
On MLD op-mode start, firmware can ALIVE and queue async_handlers_wk. Failure then purges the handler list in iwl_mld_stop_fw() but leaves the wiphy work queued. ieee80211_free_hw() then frees that memory. cfg80211 still cancel_work_syncs and **WARNs**; there is also a window after wiphy_unlock where the worker can run. The same missing cancel exists in iwl_op_mode_mld_stop. Cancelling under the wiphy lock closes that.
### Stable rules
Meets all six criteria for **this** tree: small, correct, no new API, real WARN/UAF, code present.
### Risk vs benefit
Benefit high for Intel MLD hardware; risk very low (idempotent cancel, lock already held).
### Concerns
None that block inclusion. Not a dependent series member. NVM-fail still does not iwl_mld_stop_fw() (pre-existing); this patch still improves that path by not leaving work queued.
Verification:
- [Phase 1] Parsed subject/tags: Reviewed-by Johannes Berg; Link to v2 msgid; no Fixes/Cc:stable/Reported-by
- [Phase 1] Body: purge-without-cancel on start-fail and stop; work vs freed wiphy; cfg80211 WARN
- [Phase 2] Diff: +3 lines in mld.c; iwl_op_mode_mld_start error path and iwl_op_mode_mld_stop; wiphy_work_cancel
- [Phase 2] wiphy_work_cancel() in net/wireless/core.c requires wiphy mutex; both sites already wiphy_lock
- [Phase 2] cfg80211_dev_free():
WARN_ON(!list_empty(&rdev->wiphy_work_list)) then cancel_work_sync
- [Phase 3] git describe HEAD: v7.3-rc4-27-gf0100363d8c37; make kernelversion 7.3.0-rc4
- [Phase 3] git merge-base --is-ancestor c99bc4d4e0ba6 HEAD → yes
- [Phase 3] git blame start-fail/stop: skeleton d1e879ec600f9 (MLD intro); cancel lines this commit
- [Phase 3] MLD first in v6.15 (git merge-base --is-ancestor d1e879ec600f9 v6.15); not in v6.14
- [Phase 3] git show 59a5876e474ac: removed wiphy_work_cancel from iwl_mld_cancel_async_notifications; in v7.2, not v7.1
- [Phase 3] git show 4f7a07791944e: original UAF fix on start-fail;
- [Phase 3] git log -S wiphy_work_cancel -- mld/: d1e879ec, 4f7a077, 833026, 59a5876, c99bc4d4
- [Phase 3] Parent of candidate is unrelated mvm change; series 08/15 is a mixed iwlwifi-next batch
- [Phase 4] b4 dig -c: lore/patchwork msgid for 08/15; -a: v1 then v2 (applied); -w: Johannes + linux-wireless
- [Phase 4] WebFetch lore 403; patchwork bot wall; spinics 500 — review comments UNVERIFIED
- [Phase 4] No stable@ hit for this subject (search not useful)
- [Phase 5] iwl_mld_ops.start = iwl_op_mode_mld_start; RX path wiphy_work_queue(&mld->async_handlers_wk) in notif.c
- [Phase 5] iwl_mld_load_fw error after init sequence calls iwl_mld_stop_fw (purge, no cancel)
- [Phase 5] MVM iwl_mvm_mac_stop already cancels analogous wiphy work
- [Phase 6] Local mld.c already has both cancel sites; pre-image of parent matches the candidate diff
- [Phase 7] CONFIG_IWLMLD in drivers/net/wireless/intel/iwlwifi/Kconfig
- [Phase 8] Trigger: fw load fail after ALIVE / op-mode stop; severity HIGH (WARN + UAF race)
- UNVERIFIED: exact lore review discussion text; field frequency of this WARN
**YES**
drivers/net/wireless/intel/iwlwifi/mld/mld.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/mld/mld.c +3 -0
@@ -440,6 +440,8 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, }if (ret) { +/* wiphy memory is about to be freed, we should cancel any pending work */ +wiphy_work_cancel (mld->wiphy, &mld->async_handlers_wk);wiphy_unlock (mld->wiphy);rtnl_unlock (); goto err;
@@ -505,6 +507,7 @@ iwl_op_mode_mld_stop(struct iwl_op_mode *op_mode)iwl_mld_thermal_exit (mld);wiphy_lock (mld->wiphy); +wiphy_work_cancel (mld->wiphy, &mld->async_handlers_wk);iwl_mld_low_latency_stop (mld);iwl_mld_deinit_time_sync (mld);wiphy_unlock (mld->wiphy);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/panel-edp: Add BOE NV116WH2-M30, BOE NT116WHM-N21, BOE NV116FH1-M31, BOE NV116FH1-M30
In reply to Sasha LevinFrom: Terry Hsiao <[email protected]>
[ Upstream commit d4ae726fc08024b359e9cacf2507f1c256b9d71c ]
The raw EDIDs for each panel:
BOE NV116WH2-M30
00 ff ff ff ff ff ff 00 09 e5 6e 38 00 00 00 00
0a 24 01 04 95 1a 0e 78 03 0b 55 9a 5f 58 95 28
1e 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 96 1d 56 c8 50 00 26 30 30 20
36 00 00 90 10 00 00 1a b9 13 56 c8 50 00 26 30
30 20 36 00 00 90 10 00 00 1a 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
00 0d 40 ff 0a 3c 7d 0f 0c 17 7d 00 00 00 00 80
BOE NT116WHM-N21
00 ff ff ff ff ff ff 00 09 e5 79 38 00 00 00 00
08 24 01 04 95 1a 0e 78 03 3a d5 95 5c 58 94 29
24 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 38 1d 56 c8 50 00 1c 30 30 20
36 00 00 90 10 00 00 1a 7b 13 56 c8 50 00 1c 30
30 20 36 00 00 90 10 00 00 1a 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
00 0d 40 ff 0a 3c 7d 0f 0c 17 7d 00 00 00 00 7a
BOE NV116FH1-M31
00 ff ff ff ff ff ff 00 09 e5 8b 38 01 ff 00 00
0c 24 01 04 a5 1a 0e 78 03 50 d5 9c 55 52 8f 27
15 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 9a 36 80 a0 70 38 28 40 30 20
35 00 00 90 10 00 00 1a 67 24 80 a0 70 38 28 40
30 20 35 00 00 90 10 00 00 1a 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
00 0d 36 ff 0a 3c 96 0f 0b 1a 96 00 00 00 01 cd
70 20 79 02 00 20 00 0c 9a 0e 00 8b 38 00 00 00
00 0c 1a 00 21 01 1d 03 0a a2 05 80 07 38 04 88
c2 39 55 1e 15 8f 7a 32 15 02 35 54 b0 5c b0 5c
00 36 12 78 22 00 14 ff 21 02 85 7f 07 9f 00 2f
00 1f 00 37 04 27 00 02 00 04 00 81 00 15 74 1a
00 00 03 00 28 3c 00 00 53 5a 53 5a 3c 00 00 00
00 00 00 2b 00 06 27 00 28 3b 00 00 2e 00 06 80
4b b0 5c b0 5c 00 00 00 00 00 00 00 00 00 89 90
BOE NV116FH1-M30
00 ff ff ff ff ff ff 00 09 e5 8c 38 01 ff 00 00
0c 24 01 04 a5 1a 0e 78 03 50 d5 9c 55 52 8f 27
15 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 9a 36 80 a0 70 38 28 40 30 20
35 00 00 90 10 00 00 1a 67 24 80 a0 70 38 28 40
30 20 35 00 00 90 10 00 00 1a 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
00 0d 36 ff 0a 3c 96 0f 0b 1a 96 00 00 00 01 cc
70 20 79 02 00 20 00 0c 9a 0e 00 8c 38 00 00 00
00 0c 1a 00 21 01 1d 03 0a a2 05 80 07 38 04 88
c2 39 55 1e 15 8f 7a 32 15 02 35 54 b0 5c b0 5c
00 36 12 78 22 00 14 ff 21 02 85 7f 07 9f 00 2f
00 1f 00 37 04 27 00 02 00 04 00 81 00 15 74 1a
00 00 03 00 28 3c 00 00 53 5a 53 5a 3c 00 00 00
00 00 00 2b 00 06 27 00 28 3b 00 00 2e 00 06 80
4b b0 5c b0 5c 00 00 00 00 00 00 00 00 00 88 90
---
LLM Generated explanations, may be completely bogus:
This is a four-line addition of BOE eDP panel IDs to the existing panel-edp table in **6.18.53**. That is the device-ID exception for
stable: the driver and delay helper already exist here; only the IDs are new.
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Subsystem: drm/panel-edp
- Action verb: **Add**
- Claimed intent: register four BOE 11.6" eDP panels by EDID product ID
Record: [drm/panel-edp] [Add] [four BOE panel IDs to the EDID lookup table]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Signed-off-by: Terry Hsiao <[email protected] partner.google.com> (author; Compal/Google Chromebook ODM)
- Reviewed-by: Douglas Anderson <[email protected]> (panel-edp maintainer)
- Signed-off-by: Douglas Anderson <[email protected]> (applied to drm-misc)
- `Link: https://patch.msgid.link/20260608080310.15126-3-
[email protected]`
- No Fixes: tag (expected)
- No Cc: stable (expected)
- No Reported-by: / Tested-by: / Acked-by:
- Ignore pipeline Signed-off-by: Sasha Levin and [Upstream commit ...]
Record: Author SOB + maintainer Reviewed-by/SOB + lore Link. No syzbot, no Fixes. Series msgid -3 is patch 2/2 of a 2-patch series.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
The body is four raw EDIDs. Product IDs in those EDIDs match the table entries (bytes 10–11 LE): 6e 38 → 0x386e, 79 38 → 0x3879, 8b 38 → 0x388b, 8c 38 → 0x388c. Manufacturer 09 e5 is BOE.
Record: [Bug: these panel IDs are missing from edp_panels[]] [Symptom:
unknown-panel WARN_ON plus conservative 2000 ms unprepare / 200 ms enable instead of panel-specific 500/80 ms] [No version range stated] [Root cause: hardware not in the EDID delay table]
**Step 1.4: DETECT HIDDEN BUG FIXES**
Not a disguised leak/race fix. It is hardware enablement plus power- sequencing timings (quirk-style).
Record: [Not a hidden memory-safety fix. It is a device-ID / timing- quirk addition.]
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- File: drivers/gpu/drm/panel/panel-edp.c (+4 / −0)
- Function/data: edp_panels[] only
- Scope: single-file surgical table insert
Record: [1 file, +4 lines] [edp_panels[]] [single-file surgical]
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Before: find_edp_panel() misses these IDs → WARN_ON(!detected_panel) → panel_edp_set_conservative_timings() (unprepare=2000, enable=200).
After: match BOE 0x386e/0x3879/0x388b/0x388c and copy delay_200_500_e80 (hpd_absent=200, unprepare=500, enable=80).
Record: [unknown-panel conservative path → identified panel with delay_200_500_e80]
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Category **(h) hardware workarounds / device IDs**. Mechanism: EDID identity was not in the delay table.
Record: [Device ID / panel quirk] [Missing table rows; add four EDP_PANEL_ENTRY lines using an existing delay struct]
**Step 2.4: ASSESS THE FIX QUALITY**
Obviously correct: sorted by vendor then product ID (0x386e after 0x0ddf). Reuses delay_200_500_e80, already used by many BOE 11.6" panels. No API/struct change. Regression risk is limited to these four IDs; wrong delays would only affect those panels, and 80 ms enable is the common BOE value.
Record: [Minimal, correct, low risk] [No public API change]
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Local tree: v6.18.53 (6.18.53), branch autosel.
- panel-edp.c exists since 5f04e7ce392db (2021, ancestor of v6.18.53)
- delay_200_500_e80 from 4d53cf8147950 (2023, ancestor of v6.18.53)
- Insertion point at v6.18.53 is after BOE 0x0ddf (518867b093942)
Record: [Table/driver long present] [Bug is missing IDs, not a regression in old lines] [First appeared as a gap whenever these panels are used with edp-panel]
**Step 3.2: FOLLOW THE FIXES: TAG**
No Fixes: tag.
Record: [N/A — no Fixes tag]
**Step 3.3: CHECK FILE HISTORY**
v6.18..v6.18.53 already contains several of the same class of commits, e.g. 89097c138061e, 2583d6dcbf500, bafdd6284f1b9, ed713c88b6bf7, 7eeefe23a8196, 0bd968c04acfb.
Record: [This tree already takes panel-edp ID additions] [No prerequisite refactor for these 4 lines] [Series 2/2; independent of 1/2]
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Terry Hsiao has other panel-edp ID additions in this tree (bafdd6284f1b9, ed713c88b6bf7, d4b9b6da5777b). Douglas Anderson is the subsystem maintainer and reviewed/applied this.
Record: [Regular Chromebook panel contributor; maintainer-reviewed]
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS** Series 1/2 adds unrelated AUO/CMN/CSW IDs. EDP_PANEL_ENTRY and delay_200_500_e80 are already in v6.18.53. 0x0db3 is in the **mainline** hunk context but **not** in v6.18.53; the 4 added lines do not need it.
Record: [No functional dependency on 1/2] [Can apply standalone]
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION** b4 dig -c d4ae726fc08024b359e9cacf2507f1c256b9d71c matched:
https://patch.msgid.link/[email protected]
partner.google.com
b4 dig -a: single revision **v1**, series `[PATCH v1 0/2] drm/panel-
edp: Add AUO, BOE, CMN, and CSW panels`.
Doug Anderson: Reviewed-by and pushed to drm-misc-next as d4ae726fc08024b359e9cacf2507f1c256b9d71c. No NAK, no stable discussion in-thread.
Record: [lore/msgid above] [v1 only] [Maintainer R-b, no objections] [No
Cc: stable in review]
**Step 4.2: CHECK WHO REVIEWED THE PATCH**b4 dig -w: To/Cc included [email protected], DRM maintainers (Airlie, Vetter, Ripard, Zimmermann, Lankhorst, Armstrong), dri-devel, linux-kernel.
Record: [Correct lists; panel-edp maintainer reviewed]
**Step 4.3: SEARCH FOR THE BUG REPORT**
No bugzilla/syzbot. Evidence is author-supplied EDIDs from Compal/Google hardware.
Record: [No public crash report] [Real panels documented by EDID dumps]
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES** Patch 1/2 is independent ID adds. Not required for 2/2.
Record: [Standalone among the series]
**Step 4.5: CHECK STABLE MAILING LIST HISTORY** lore.kernel.org HTTP fetch returned 403. Thread mbox from b4 dig -m has no stable@ traffic.
Record: [No stable-specific discussion found in the submission thread] [UNVERIFIED: lore.kernel.org/stable web search 403]
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS**
Modified: edp_panels[]. Consumers: find_edp_panel(), generic_edp_panel_probe().
Record: [edp_panels[] / find_edp_panel / generic_edp_panel_probe]
**Step 5.2: TRACE CALLERS**generic_edp_panel_probe() ← panel_edp_probe() when DT compatible is edp-panel ← panel_edp_platform_probe / DP AUX probe (panel_edp_dp_aux_ep_probe path at line 2190).
Record: [Probe-time, one path per panel] [Not IRQ/hot-path]
**Step 5.3: TRACE CALLEES**drm_edid_read_base_block, drm_edid_get_panel_id, find_edp_panel, drm_edid_match. On match: desc->delay = *entry->delay.
Record: [EDID identify + delay copy]
**Step 5.4: FOLLOW THE CALL CHAIN**
Userspace does not call this directly. It runs when an eDP panel with compatible edp-panel is probed (typical Chromebook/laptop). Reachable on machines that actually have these BOE panels.
Record: [Device probe] [Reachable on those laptops] [Unprivileged users do not trigger a new attack surface]
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Many existing BOE NT116WHM-N21 / NV116* rows already use delay_200_500_e80 or nearby delays. Same pattern as other stable panel-edp ID commits in this tree.
Record: [Same table-add pattern already used in 6.18.y]
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Yes. panel-edp.c and edp_panels[] exist at v6.18.53. git grep of 0x386e|0x3879|0x388b|0x388c|NV116WH2-M30 on **v6.18.53** found nothing. git merge-base --is-ancestor of the candidate vs v6.18.53 is false.
Record: [IDs missing from 6.18.53] [Driver present since 2021]
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Dry-run: git show 75ecc68dd7996 patch against v6.18.53:drivers/gpu/drm/panel/panel-edp.c applied cleanly (patch --dry-run exit 0). Mainline context mentions 0x0db3 (not in 6.18.53); the 3-line context used for this tree (0x0d45/0x0d73/0x0ddf) matches.
Record: [Clean apply to 6.18.53]
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
No other commit on this file adds these four IDs except the autosel candidate itself (ignored as pipeline). No alternate fix.
Record: [IDs not in v6.18.53]
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY** drivers/gpu/drm/panel/ — DRM eDP panel database. Criticality:
**IMPORTANT** for machines with these panels; **PERIPHERAL** globally. CONFIG_DRM_PANEL_EDP is the existing Kconfig.
Record: [drm/panel-edp] [IMPORTANT for affected laptops]
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Actively receiving ID additions; mature table, small well-known change type.
Record: [Mature table, frequent ID adds]
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Only systems whose eDP EDID is BOE product 0x386e/0x3879/0x388b/0x388c (11.6" Compal/Google Chromebook-class panels). CONFIG_DRM_PANEL_EDP.
Record: [driver-specific / config-specific]
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS** Every probe of those panels (boot, resume). Not a race. Not unprivileged-exploitable beyond “this laptop’s panel”.
Record: [Boot/probe of those four panels] [Likely if that hardware ships on 6.18] [No extra userspace trigger]
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Without the IDs: WARN_ON plus conservative delays (2 s unprepare). Panel generally still lights; sequencing is slower/less accurate. With wrong HPD-absent handling, flicker or failed light-up is possible; that is why the table exists.
Record: [WARN_ON + suboptimal eDP power sequencing] [Severity MEDIUM, hardware-enablement HIGH for those devices]
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Benefit: enable correct timings for four real panels; stop WARN_ON; same class already accepted in 6.18.y.
Risk: four static table rows, existing delay struct, no locking/API.
Record: [High benefit for those devices, very low risk] [Favorable]
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Explicit stable exception: device IDs / quirks on an existing driver
- Driver, macro, and delay_200_500_e80 already in 6.18.53
- +4 lines, maintainer-reviewed, EDIDs match IDs
- Applies cleanly to v6.18.53
- Same class already in 6.18.y
- Avoids WARN_ON and 2 s conservative unprepare on those panels
AGAINST:
- Not a crash/UAF/security fix
- Fallback path still tries to run the panel
- Affects only four panel SKUs
UNRESOLVED:
- lore.kernel.org HTTP 403 for a stable@ archive search (thread mbox had no stable@)
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — EDIDs, maintainer R-b, pushed to drm-misc-next
2. Fixes a real bug that affects users? **PASS** — missing IDs for real panels (WARN_ON + wrong delays)
3. Important issue? **PASS** under the device-ID exception (not CRITICAL crash)
4. Small and contained? **PASS** — +4 lines, one table
5. No new features or APIs? **PASS** — IDs only, existing helper
6. Can apply to the local tree? **PASS** — dry-run clean on 6.18.53
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: [NEW DEVICE IDs to existing driver — also hardware timing quirk]
**Step 9.4: MAKE YOUR DECISION**
This belongs in 6.18.y. The local tree already has panel-edp and the delay helper; these four BOE IDs are missing; the change is the same kind of ID add this series already ships.
What it solves for stable users: Chromebook/laptop eDP panels identified by those EDIDs get correct power-on/off delays instead of the unknown- panel WARN_ON and 2000 ms conservative unprepare.
Risk vs benefit: four static rows vs making those panels sequence correctly. No dependencies on series 1/2.
### Verification
- [Phase 1] Tags: Hsiao SOB, Anderson R-b/SOB, msgid 20260608080310.15126-3; no Fixes/Reported-by
- [Phase 1] EDIDs: product IDs 0x386e/0x3879/0x388b/0x388c match added rows
- [Phase 2] Diff: +4 EDP_PANEL_ENTRY lines in edp_panels[] using delay_200_500_e80
- [Phase 2] Fallback: generic_edp_panel_probe() lines 814–824 WARN_ON + panel_edp_set_conservative_timings() (unprepare 2000, enable 200)
- [Phase 3] git describe HEAD / Makefile: **6.18.53** (v6.18.53-5049-g0f0bdc2b0dffb)
- [Phase 3] git merge-base --is-ancestor 4d53cf8147950 v6.18.53 yes; 5f04e7ce392db yes
- [Phase 3] git grep on v6.18.53: IDs **absent**; delay_200_500_e80 **present** at line 1760
- [Phase 3] Similar ID adds already in v6.18..v6.18.53 (e.g. 89097c138061e, bafdd6284f1b9)
- [Phase 4] b4 dig -c d4ae726fc080...: matched series; v1 only; Anderson R-b; drm-misc-next d4ae726fc080
- [Phase 4] b4 dig -w: dri-devel + DRM maintainers + dianders
- [Phase 4] b4 dig -m: cover 0/2, 1/2 independent IDs, 2/2 this patch; no NAK
- [Phase 4] WebFetch lore/msgid.link: 403 — discussion taken from mbox instead
- [Phase 5] Callers of generic_edp_panel_probe: only panel_edp_probe for edp-panel
- [Phase 6] Dry-run apply of candidate hunk onto v6.18.53 panel-edp.c:
**success**
- [Phase 6] 0x0db3 (mainline context) **not** in v6.18.53; not required
- [Phase 7] CONFIG_DRM_PANEL_EDP present in this tree
- [Phase 8] Failure mode: WARN_ON + conservative delays, not oops
- UNVERIFIED: stable@ archive web search (HTTP 403)
**YES**
drivers/gpu/drm/panel/panel-edp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/panel/panel-edp.c +4 -0
@@ -2005,6 +2005,10 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0d45 , &delay_200_500_e80,"NV116WHM-N4B" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0d73 , &delay_200_500_e80,"NE140WUM-N6S" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0ddf , &delay_200_500_e80,"NV116WHM-T01" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x386e , &delay_200_500_e80,"NV116WH2-M30" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x3879 , &delay_200_500_e80,"NT116WHM-N21" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x388b , &delay_200_500_e80,"NV116FH1-M31" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x388c , &delay_200_500_e80,"NV116FH1-M30" ),EDP_PANEL_ENTRY ('C' ,'M' ,'N' ,0x1130 , &delay_200_500_e50,"N116BGE-EB2" ), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1132, &delay_200_500_e80_d50, "N116BGE-EA2"),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ksmbd: return buffer too small for short security queries
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit 2103add92a02505bdd536ba6fce7f64a427222a2 ]
SMB2 QUERY_INFO security requests with an output buffer too small for the self-relative security descriptor header can fall through descriptor construction and be reported as STATUS_INVALID_INFO_CLASS.
After validating the file handle, reject buffers shorter than struct smb_ntsd with STATUS_BUFFER_TOO_SMALL before building the descriptor.
This fixes smb2.getinfo.qsec_buffercheck.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.12.111** (pending-6.12). The candidate is mainline 2103add92a02 (“ksmbd: return buffer too small for short security queries”). It is not an ancestor of HEAD, but the buggy path is present and the patch applies.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [ksmbd] [return] SMB2 QUERY_INFO security with a too-small output buffer should return STATUS_BUFFER_TOO_SMALL instead of a wrong NT status.
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Namjae Jeon \<[email protected]\> (ksmbd maintainer)
- 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
- Pipeline-added markers (Upstream commit / Sasha Levin SOB) ignored per instructions
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: SMB2 QUERY_INFO (security) with OutputBufferLength smaller than struct smb_ntsd can still run descriptor construction and be reported as STATUS_INVALID_INFO_CLASS
- Symptom: wrong NT status on short security queries; Samba smbtorture smb2.getinfo.qsec_buffercheck fails
- Author’s root cause: missing early reject after the file handle is validated
- Fix: if OutputBufferLength \< sizeof(struct smb_ntsd), set STATUS_BUFFER_TOO_SMALL, put the fd, return -ENOSPC
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a disguised cleanup. It is an explicit protocol/error-code fix. The “fall through descriptor construction” wording matches a real control-flow bug, not style.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: fs/smb/server/smb2pdu.c (+6 / -0)
- Function: smb2_get_info_sec()
- Scope: single-file surgical fix, one insertion after ksmbd_lookup_fd_slow()
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: after a successful fd lookup, the function always builds POSIX ACL fattr / optional SD xattr, allocates a scratch SD, calls build_sec_desc(), then buffer_check_err().
- After: if OutputBufferLength < sizeof(struct smb_ntsd) (20 bytes), return immediately with STATUS_BUFFER_TOO_SMALL and ksmbd_fd_put().
- Path: error path for client-provided undersized QUERY_INFO security buffers (including the Samba test’s 0- and 1-byte probes).
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: logic / protocol correctness (wrong NT status)
- Mechanism verified in this tree:
1. Samba qsec_buffercheck uses AdditionalInformation=0 and OutputBufferLength 0 then 1.
2. smb_acl_sec_desc_scratch_len() with no OWNER/GROUP/DACL flags returns sizeof(struct smb_ntsd) = 20.
3. build_sec_desc() also sets secdesclen to 20.
4. The OOB-fix guard ALIGN(secdesclen, 8) > scratch_len is 24 > 20, so rc = -EFBIG with Status still 0.
5. smb2_query_info() maps unmapped errors with Status==0 to STATUS_INVALID_INFO_CLASS.
- That matches the commit message. MS-SMB2 3.3.5.20.3 requires STATUS_BUFFER_TOO_SMALL when OutputBufferLength is zero or insufficient for the security descriptor.
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct: a self-relative NTSD is at least sizeof(struct smb_ntsd); smaller buffers cannot hold one.
- ksmbd_fd_put() is required after ksmbd_lookup_fd_slow(); no leak.
- smb2_query_info() does not remap -ENOSPC when Status is already set, so BUFFER_TOO_SMALL is preserved.
- Regression risk is low: only OutputBufferLength < 20 on QUERY_INFO security changes, from a wrong error to the spec-required one.
- Incomplete vs MS-SMB2: the error response still has ByteCount 0 (smb2_set_err_rsp()), so the required size is not returned. The torture test only asserts the status. That does not make the patch incorrect.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Insertion point is immediately after the fd lookup, which dates to e2f34481b24db2 (Namjae Jeon, 2021, original cifsd QUERY_INFO security path).
- The INVALID_INFO_CLASS outcome for this short-buffer case comes from d48c64fb80ad7 (“ksmbd: fix OOB write in QUERY_INFO for compound requests”, 2026-03-25), which added scratch_len + ALIGN check + buffer_check_err. That commit **is** in this tree.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Functionally this is a follow-up to d48c64fb80ad7, which is already in HEAD.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Related QUERY_INFO buffer-status commits already in this tree:
- fb29c008e1f3b ksmbd: return buffer overflow for partial filesystem info (fixes smb2.getinfo.qfs_buffercheck)
- df33d8243ce6b ksmbd: fix partial file information responses (mainline parent of this candidate)
- ab1da5f071fae ksmbd: keep compound responses on query info errors
- ff021a8abacab ksmbd: fix partial normalized name responses This is the security-info counterpart of qfs_buffercheck, not a large series that needs extra unapplied patches.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Namjae Jeon is the ksmbd maintainer (MAINTAINERS / Kconfig SMB_SERVER). Many of his QUERY_INFO buffer-handling fixes are already on this branch.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: Standalone. Needs smb2_get_info_sec(), struct smb_ntsd, ksmbd_fd_put(), STATUS_BUFFER_TOO_SMALL, and the existing query_info error mapper — all present. git apply --check of 2103add92a succeeded (hunk offset only). Parent 6b8b79226bc3 (“fix partial file information responses”) is in the tree as df33d8243ce6b.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- Mainline SHA confirmed via GitHub API:
2103add92a02505bdd536ba6fce7f64a427222a2
- b4 dig -c 2103add92a failed: lore.kernel.org returned server errors (exact patch-id, author+subject, and in-body From all failed)
- lore WebFetch also 403
- UNVERIFIED: mailing-list review comments, NAKs, Cc: stable from reviewers, series revisions
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: Commit has only the author’s SOB. UNVERIFIED original To/Cc (b4 -w not usable without lore).
Step 4.3: SEARCH FOR THE BUG REPORT
Record: Samba smbtorture source4/torture/smb2/getinfo.c torture_smb2_qsec_buffercheck():
- QUERY_INFO SECURITY, output_buffer_length 0 → expect NT_STATUS_BUFFER_TOO_SMALL
- same with length 1 → expect NT_STATUS_BUFFER_TOO_SMALL This is a documented interoperability test against Windows/Samba behavior, not a theoretical check.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Not labeled X/Y. Parent is the already-backported partial file- info fix. Sister test qfs_buffercheck is already fixed in this tree. No extra series member is required for this hunk.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: UNVERIFIED (lore.kernel.org/stable search not available; 403). Decision does not rely on stable-list history.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: smb2_get_info_sec() only.
Step 5.2: TRACE CALLERS
Record:
- smb2_query_info() → case SMB2_O_INFO_SECURITY
- Registered in fs/smb/server/smb2ops.c as SMB2_QUERY_INFO_HE
- Reachable from any SMB2 client that issues QUERY_INFO security (Windows ACL UI, icacls, Samba, etc.)
Step 5.3: TRACE CALLEES
Record: New path calls ksmbd_fd_put() and returns. It avoids ksmbd_acls_fattr, ksmbd_vfs_get_sd_xattr, smb_acl_sec_desc_scratch_len, build_sec_desc.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Userspace/network reachable: authenticated SMB2 QUERY_INFO on an open handle. Unprivileged local users cannot hit it unless they can speak SMB to a ksmbd share; remote SMB clients can.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Same QUERY_INFO buffer-status pattern already fixed for filesystem info (qfs_buffercheck) and file info. Security info was the remaining class for this Samba suite.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. smb2_get_info_sec() at fs/smb/server/smb2pdu.c:5789 has the lookup then immediately file_mnt_idmap() with no OutputBufferLength vs sizeof(struct smb_ntsd) check. git merge-base --is-ancestor 2103add92a HEAD is false. git describe HEAD = p-6.12-3-gc504cf0baa3d8, make kernelversion = 6.12.111.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Clean apply (git apply --check succeeded; offset -507 lines because mainline’s file is larger). No API mismatch.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: qfs_buffercheck / partial file info / compound query-info error handling are here. This exact BUFFER_TOO_SMALL early reject is not. No alternate fix for qsec_buffercheck found (git log --grep=qsec empty on fs/smb/server).
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: ksmbd (fs/smb/server, CONFIG_SMB_SERVER, default n).
Criticality: IMPORTANT for ksmbd deployments (network file server), PERIPHERAL for kernels that do not enable it.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Actively maintained; recent 6.12 backports are mostly ksmbd protocol and lifetime fixes from Namjae Jeon.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: ksmbd users (CONFIG_SMB_SERVER). Windows/Samba clients querying security descriptors with a short or zero output buffer.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Common for ACL probes: OutputBufferLength 0 or 1 (exactly what the Samba test sends; Windows often probes with a small buffer then retries). Authenticated SMB client on a share; not a local unprivileged syscall.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: Wrong NT status (INVALID_INFO_CLASS instead of BUFFER_TOO_SMALL). Clients that treat INVALID_INFO_CLASS as “unsupported” will not retry with a larger buffer, so ACL queries can fail. Not a kernel oops/UAF. Severity: MEDIUM (interop / functional failure on a file server), HIGH for ksmbd ACL usability.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: restores MS-SMB2-required status for short security queries; unbreaks smb2.getinfo.qsec_buffercheck; repairs fallout from an OOB fix already in this tree.
- Risk: very low (6 lines, error path only, fd_put balanced).
- Ratio: favorable.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real protocol bug: MS-SMB2 3.3.5.20.3 MUST return STATUS_BUFFER_TOO_SMALL for insufficient security QUERY_INFO buffers
- Concrete user-visible failure: Samba torture qsec_buffercheck; Windows ACL size-probe pattern
- Mechanism verified in this tree: ALIGN(secdesclen,8) > scratch_len → -EFBIG → INVALID_INFO_CLASS
- Follow-up to d48c64fb80ad7, which is already in 6.12.111 (stable-to- stable)
- 6-line surgical change, fd_put correct, Status not overwritten
- Applies cleanly
- Same class as qfs_buffercheck, already backported here
- Maintainer-authored
AGAINST:
- Not a crash, UAF, or data-corruption fix
- Incomplete vs spec (no 4-byte required length in the error body)
- ksmbd is optional (default n)
- No Fixes:/Cc:stable (expected; not used as a NO)
UNRESOLVED:
- lore/b4 discussion (lore returned errors)
- Whether any reviewer NAK’d (no evidence either way)
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? PASS — size check vs NTSD header; author cites passing qsec_buffercheck; logic confirmed in-tree
2. Fixes a real bug that affects users? PASS — wrong SMB status on security queries; Windows/Samba clients
3. Important issue? PASS — interoperability failure on a network file server; fallout from an already-applied OOB fix. Not a panic, but user-visible ACL query failure
4. Small and contained? PASS — +6 lines, one function
5. No new features or APIs? PASS — error-code correction only
6. Can apply to the local tree? PASS — apply --check succeeded; prerequisites present
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 should be backported to this 6.12 tree. The buggy path exists, the OOB-fix regression is here, the patch is tiny and applies, and the wrong status is a real ksmbd interop bug.
What the commit solves for stable users:
ksmbd currently answers short SMB2 QUERY_INFO security requests with STATUS_INVALID_INFO_CLASS (or INFO_LENGTH_MISMATCH when extra secinfo flags are set). Clients that probe with a 0-byte buffer then retry never learn that they only needed a larger buffer. The patch returns STATUS_BUFFER_TOO_SMALL after the handle is validated, which is what MS- SMB2 requires and what Samba’s qsec_buffercheck expects.
Risk vs benefit:
Benefit is restoring ACL query probing on ksmbd 6.12. Risk is a 6-line error-path change with balanced fd_put. No new APIs, no extra prerequisites.
Verification:
- [Phase 1] Parsed tags: only Namjae Jeon SOB; no Fixes/Reported- by/Link/Cc stable
- [Phase 2] Diff: +6 in smb2_get_info_sec after fd lookup; STATUS_BUFFER_TOO_SMALL + ksmbd_fd_put + return -ENOSPC
- [Phase 2] Confirmed sizeof packed smb_ntsd is 20 bytes (le16+le16+4×le32)
- [Phase 2] Confirmed smb2_query_info() keeps pre-set Status for -ENOSPC (does not map to INVALID_INFO_CLASS)
- [Phase 2] Confirmed ALIGN(20,8)=24 > scratch_len 20 produces -EFBIG → INVALID_INFO_CLASS for AdditionalInformation=0
- [Phase 3] git describe HEAD: p-6.12-3-gc504cf0baa3d8; kernelversion 6.12.111
- [Phase 3] git merge-base --is-ancestor 2103add92a HEAD: not ancestor
- [Phase 3] git merge-base --is-ancestor d48c64fb80ad7 HEAD: yes (OOB fix present)
- [Phase 3] git blame: lookup from e2f34481b24db2 (2021); ALIGN/scratch from d48c64fb80ad7
- [Phase 3] Parent 6b8b79226bc3 is in tree as df33d8243ce6b
- [Phase 3] git apply --check: clean (offset -507)
- [Phase 4] GitHub API: mainline SHA 2103add92a02505bdd536ba6fce7f64a427222a2
- [Phase 4] b4 dig: UNVERIFIED (lore server error)
- [Phase 4] Samba getinfo.c: qsec_buffercheck expects BUFFER_TOO_SMALL for lengths 0 and 1
- [Phase 4] MS-SMB2 3.3.5.20.3: MUST return BUFFER_TOO_SMALL when OutputBufferLength is zero or insufficient
- [Phase 5] Caller: smb2_query_info via SMB2_QUERY_INFO_HE; network- reachable
- [Phase 6] Buggy code at smb2pdu.c:5840–5846; no existing qsec fix in git log
- [Phase 8] Failure mode: wrong NT status → ACL probe/retry failure; severity MEDIUM/HIGH for ksmbd users
- UNVERIFIED: lore review thread, stable@ discussion, whether error-data required-size follow-up exists in later mainline
**YES**
fs/smb/server/smb2pdu.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/smb/server/smb2pdu.c +6 -0
@@ -5902,6 +5902,12 @@ static int smb2_get_info_sec(struct ksmbd_work *work,if (!fp)return -ENOENT ; +if (le32_to_cpu (req->OutputBufferLength) <sizeof (struct smb_ntsd )) { + rsp->hdr.Status =STATUS_BUFFER_TOO_SMALL ; +ksmbd_fd_put (work, fp); +return -ENOSPC ; + } + idmap =file_mnt_idmap (fp->filp); inode =file_inode (fp->filp);ksmbd_acls_fattr (&fattr, idmap, inode);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ASoC: amd: yc: Add DMI quirk for Lenovo V15 G6 ARP
In reply to Sasha LevinFrom: Daniel Ortiz <[email protected]>
[ Upstream commit d395e1b62d9694f2e4add9122f8d473eacd374aa ]
The Lenovo V15 G6 ARP (product name 83UU) uses the ACP6x PDM interface for its internal digital microphone array. Its firmware exposes neither the AcpDmicConnected _DSD property nor the _WOV method, so acp6x_probe() falls through to the DMI check and returns -ENODEV, leaving acp_yc_mach.0 unbound and no capture device registered.
Add a DMI quirk entry for this model. With it, the machine driver binds and the DMIC capture device is created:
acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC support via DMI card 2: acp6x [acp6x], device 0: DMIC capture dmic-hifi-0
Capture was verified working with arecord and PipeWire.
---
LLM Generated explanations, may be completely bogus:
Local tree is **6.18.y** (v6.18.57-155-gcdf239ca885b2, VERSION=6 PATCHLEVEL=18 SUBLEVEL=57). Verdict is for this tree only.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[ASoC/amd/yc] [Add] [DMI quirk so Lenovo V15 G6 ARP (83UU) binds the existing ACP6x DMIC machine driver]**
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Fixes:: none (expected)
- Reported-by:: none
- Tested-by:: none as a tag; body says capture was verified with arecord and PipeWire
- Reviewed-by:: none
- Acked-by:: none
- Link:: https://patch.msgid.link/20260920011920.2482786-1-
[email protected]
- Cc: [email protected]: absent (expected; not a negative)
- Signed-off-by: Daniel Ortiz <[email protected]> (author)
- Signed-off-by: Mark Brown <[email protected]> (ASoC maintainer)
- Pipeline tags ([Upstream commit ...], Signed-off-by: Sasha Levin) ignored per instructions
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** Lenovo V15 G6 ARP firmware exposes neither AcpDmicConnected _DSD nor _WOV. acp6x_probe() therefore misses ACPI enablement, the DMI table does not match, and probe returns -ENODEV.
- **Symptom:** acp_yc_mach.0 stays unbound; no capture PCM is registered (internal mic missing).
- **Root cause:** incomplete ACPI on this model; the driver already has a DMI fallback table for that class of firmware.
- **Fix:** add LENOVO / 83UU to yc_acp_quirk_table. After that, dmesg shows Enabling ACP DMIC support via DMI and DMIC capture dmic-hifi-0.
- **Version info:** none in the message. Maintainer applied it to for-7.3.
- **Author explanation:** firmware gap → DMI check → -ENODEV; quirk makes the existing machine driver bind.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not a disguised cleanup. It is an explicit hardware-quirk addition. That is a documented stable exception (quirks/workarounds for broken firmware), not a new driver or API.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: sound/soc/amd/yc/acp6x-mach.c — **+7 / -0**
- Function/object: yc_acp_quirk_table[] only
- Scope: **single-file surgical quirk** (one dmi_system_id entry)
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Before:** DMI match on this model fails; if ACPI _WOV/AcpDmicConnected also fail, platform_get_drvdata() is NULL and acp6x_probe() returns -ENODEV.
- **After:** dmi_first_match() hits LENOVO+83UU, sets drvdata to &acp6x_card, and the existing DMIC card is registered.
- Path affected: **probe/init** for this DMI identity only. Other machines unchanged.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **[Hardware workaround / DMI quirk]** Incomplete ACPI means the existing DMI table is the only enable path. Missing table entry → probe failure → no capture device. Same pattern as the many Lenovo/HP/ASUS entries already in this file.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- Obviously correct: copies the established { .driver_data = &acp6x_card, DMI_BOARD_VENDOR "LENOVO", DMI_PRODUCT_NAME "<sku>" } pattern used by 83N6/83Q2/83Q3.
- Minimal: 7 lines, no logic, locking, or API change.
- Regression risk: **very low**. Match is vendor+product SKU 83UU. Wrong enablement would only hit that SKU; author confirmed capture works on the real machine.
- Red flags: none.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Insertion sits after Lenovo 83Q3 (from b9a8ea185f3f8 “ASoC: acp:
Support microphone from Lenovo Go S”, in this tree since **v6.14-rc1**).
- Driver file and table originated in fa991481b8b22 (“ASoC: amd: add YC machine driver using dmic”, **v5.16-rc3**).
- DMI override in probe: e521f087780d07 (2022-04-11).
- _WOV failure → goto check_dmi_entry: 984795e76def5c (“ASoC: amd:
yc: Fix the wrong return value”, **v6.13-rc3**).
- Bug for this laptop is **absence of a DMI row**, not a recent logic regression. The probe fallback this quirk uses is in 6.18.y.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Not applicable. The “broken” thing is this model’s firmware plus a missing quirk row.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: This file is a long list of the same DMI additions (HP, Lenovo, ASUS, MSI, Acer, …). Recent examples already in this tree: ThinkPad E16 Gen 2 (21JN), Acer Aspire Go 15, HyperX OMEN 16-ap1xxx, HP Victus 16-e1xxx. Standalone; not patch X/Y. No prerequisites beyond the existing table and acp6x_probe() DMI fallback, both present.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: git log --author='Daniel Ortiz' -- sound/soc/amd/ shows only this commit. Author is a hardware reporter, not the subsystem maintainer. Weight comes from Mark Brown applying it and from the standard quirk pattern, not from maintainer authorship.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Diff only needs yc_acp_quirk_table, acp6x_card, and dmi_first_match() in acp6x_probe(). All exist in this checkout. Applies standalone. Parent of the candidate already has 83Q3 immediately before the insertion point.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c d395e1b62d9694f2e4add9122f8d473eacd374aa → https://patch.m
sgid.link/[email protected]
- b4 dig -a: **v1 only** (2026-09-19). No later revision.
- lore.kernel.org fetch returned **403**; thread recovered from Openwall/Patchew mirrors.
- Mark Brown applied it to git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3 on 2026-09-21. No NAK, no requested respin, no reviewer concern in the apply mail.
- No reviewer Cc: stable in the thread (not a negative).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): To/Cc included Vijendar Mukunda (AMD ACP), Mark Brown (ASoC), Liam Girdwood, Venkata Prasad Potturu, Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel. Maintainer applied it. No Acked-by/Reviewed-by on the commit itself.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No bugzilla/syzbot link. Evidence of user impact is the author reproducing missing capture, then verifying arecord/PipeWire after the quirk. Web search confirms the same patch text; no independent multi- user report found. **UNVERIFIED:** how many other 83UU owners hit this (likely all of them given ACPI gap, but not counted).
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Standalone 1/1 patch. Not part of a multi-patch series.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search returned 403 / no useful hits for this subject. **UNVERIFIED:** no prior stable-list NAK or explicit nomination found. Same class of ACP6x DMI quirks has historically been AUTOSEL’d (e.g. MSI Bravo 15 C7UCX).
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
semcode MCP is not available; used file reads and git grep.
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: No function body changed. Data only: yc_acp_quirk_table[].
Consumer: acp6x_probe().
**Step 5.2: TRACE CALLERS**
Record:
- acp6x_mach_driver.probe = acp6x_probe (module_platform_driver).
- Platform device "acp_yc_mach" registered from sound/soc/amd/yc/pci- acp6x.c when ACP is in ACP6x_PDM_MODE.
- Context: PCI probe / boot on ACP6x Yellow Carp systems with CONFIG_SND_SOC_AMD_YC_MACH. Not a hot path, IRQ, or syscall.
**Step 5.3: TRACE CALLEES**
Record: acp6x_probe() uses acpi_dev_get_property("AcpDmicConnected"), acpi_evaluate_integer("_WOV"), dmi_first_match(yc_acp_quirk_table), devm_snd_soc_register_card(). The quirk only changes whether dmi_first_match() returns an entry.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Boot → ACP PCI driver → register acp_yc_mach → acp6x_probe() → ACPI miss → DMI table → with this entry, card registers. Userspace then sees the capture PCM (arecord/PipeWire). Reachable on this laptop without special config beyond the existing ASoC ACP6x machine driver.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: 108 DMI_MATCH(DMI_BOARD_VENDOR rows in this file. 83UU appears only once (this entry). Nearby Lenovo SKUs 83N6/83Q2/83Q3 are Go S quirks from b9a8ea185f3f8, not this model.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** sound/soc/amd/yc/acp6x-mach.c is present. acp6x_probe() still returns -ENODEV when ACPI and DMI both miss (lines 845–853). Parent of the candidate has no 83UU. Without this row, Lenovo V15 G6 ARP has no capture device on **this** 6.18.y tree. Driver dates to v5.16; DMI fallback is long-standing.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Parent context is 83Q3 then Nitro ANV15-41; the hunk is a pure insertion. No refactor of the table or probe vs this tree.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: Many other DMI quirks are already in this tree. None match 83UU. No alternate fix for this SKU.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **[ASoC AMD Yellow Carp DMIC machine driver] [PERIPHERAL / driver-specific]** — important for owners of that laptop, not core mm/fs. Config: CONFIG_SND_SOC_AMD_YC_MACH (depends on SND_SOC_AMD_ACP6x && ACPI, depends on X86 && PCI for ACP6x).
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained quirk table (many DMI additions through 2025–2026). Mechanism is mature; this commit does not change it.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Driver/platform-specific** — Lenovo V15 G6 ARP (DMI product name 83UU) with ACP6x PDM DMIC. No effect on other DMI IDs.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Every boot/probe on that model. Not a race. Unprivileged users do not trigger a crash; they simply have **no microphone**. Common for anyone using this SKU on 6.18.y.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: **Missing audio capture device** (internal mic dead). Not panic/UAF/corruption. Severity **MEDIUM** for that hardware, but this is the documented **hardware quirk** exception: without the row, the existing driver cannot bind.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** High for 83UU users (mic actually works); zero for everyone else.
- **Risk:** Very low (7-line table add, unique SKU, author-tested).
- **Ratio:** Strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real user-visible bug: no DMIC capture on Lenovo V15 G6 ARP because firmware omits ACPI DMIC methods.
- Existing driver and DMI fallback are in 6.18.y; only the SKU row is missing.
- Textbook stable exception: hardware quirk / DMI table entry on an existing driver.
- 7 lines, copy of established pattern, ASoC maintainer applied v1 unchanged.
- Author verified arecord and PipeWire.
- Same class of ACP6x DMI quirks is already common in this tree.
AGAINST:
- Not a crash/security/corruption fix.
- Single-model, one reporter; no Cc: stable / Fixes: (expected).
- No independent second user report found.
UNRESOLVED:
- lore.kernel.org itself 403’d; discussion taken from b4 + Openwall/Patchew.
- No stable-list thread found.
- Population of 83UU users not counted.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — identical table pattern; author tested capture.
2. Fixes a real bug that affects users? **PASS** — mic never appears without the quirk.
3. Important issue? **PASS** under the hardware-quirk exception (broken firmware / missing device), not a kernel crash.
4. Small and contained? **PASS** — +7 lines, one file.
5. No new features or APIs? **PASS** — no new driver, Kconfig, or userspace API; enables existing DMIC machine driver for one SKU.
6. Can apply to the local tree? **PASS** — table and probe path present; applies cleanly.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: **Hardware quirk/workaround** (DMI match for firmware that does not describe the DMIC). Closely analogous to device-ID additions.
**Step 9.4: MAKE YOUR DECISION**
This tree already has acp6x_probe()’s DMI fallback and a large yc_acp_quirk_table. Adding LENOVO/83UU is the standard, low-risk way to make the internal microphone work on the Lenovo V15 G6 ARP. It should be backported to this 6.18.y tree.
------------------------------------------------
What the commit solves
The laptop’s ACPI does not advertise DMIC (AcpDmicConnected / _WOV). Probe then depends on DMI, finds no match, returns -ENODEV, and users get no capture device. One quirk row binds acp_yc_mach and registers the existing ACP6x DMIC PCM.
Why it meets stable rules
It is a 7-line, obviously correct DMI quirk on a driver that already exists in 6.18.y, tested on the hardware, with no API or behavioral change except for that SKU.
Risk vs benefit
Benefit is a working microphone on this model; risk is confined to LENOVO+83UU. That is the usual stable trade-off for ID/quirk patches.
Concerns
None that block backport: no missing prerequisites, no apply conflicts, no series dependency. Severity is “device missing,” not a panic, which is still accepted for quirks.
Verification:
- [Phase 1] Subject/tags: ASoC amd yc DMI quirk; SOB Daniel Ortiz + Mark Brown; Link msgid 20260920011920.2482786-1; no Fixes/Reported- by/Cc:stable
- [Phase 1] Body: ACPI miss → DMI → -ENODEV; arecord/PipeWire verification quoted
- [Phase 2] git show: +7 lines in yc_acp_quirk_table only (LENOVO/83UU → &acp6x_card)
- [Phase 2] Read acp6x_probe() at 807–865: ACPI then dmi_first_match; NULL card → -ENODEV
- [Phase 3] git describe HEAD / Makefile: **6.18.57**
- [Phase 3] git blame: 83UU row is this commit; neighbors 83Q3 from b9a8ea185f3f8 (v6.14-rc1)
- [Phase 3] File added fa991481b8b22 (v5.16-rc3); DMI fallback e521f087780d07; _WOV goto 984795e76def5c (v6.13-rc3)
- [Phase 3] git grep 83UU on parent: absent; on HEAD: only this entry
- [Phase 3] Author log on sound/soc/amd/: only this commit
- [Phase 4] b4 dig -c d395e1b62d96: lore msgid match; -a v1 only; -w AMD ACP + ASoC maintainers
- [Phase 4] Openwall 2026/09/20/35: original patch; 2026/09/21/1579:
Mark Brown applied to for-7.3
- [Phase 4] lore.kernel.org WebFetch 403; stable search: no relevant hits
- [Phase 5] git grep acp_yc_mach: defined in acp6x-mach.c; registered in pci-acp6x.c:238
- [Phase 5] Kconfig SND_SOC_AMD_YC_MACH depends on SND_SOC_AMD_ACP6x && ACPI
- [Phase 6] Probe/DMI table present in this tree; insertion context 83Q3 → ANV15-41 matches parent
- [Phase 8] Failure: no capture device on 83UU; not a crash
- UNVERIFIED: exact number of affected users; full lore.kernel.org HTML
(403)
**YES**
sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -374,6 +374,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "83Q3"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83UU"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ksmbd: honor client signing-required in all modes
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit bc2f3f3dd69424f76e2ed3dc53d29bfd6c9966d4 ]
The SMB2 NEGOTIATE request's SMB2_NEGOTIATE_SIGNING_REQUIRED bit requires the server to set Connection.ShouldSign. KSMBD represents that state with conn->sign, but previously set it only when its signing configuration was auto or disabled.
Set conn->sign whenever the client requires signing, independently of the server's signing mode. Keep the mandatory server-mode handling unchanged.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject**
Record: [ksmbd] [honor] honor client signing-required in all modes
**Step 1.2 — Tags**
Record:
- Signed-off-by: Namjae Jeon <[email protected]> (ksmbd maintainer; author and committer of upstream bc2f3f3dd694)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Link:, or Cc: stable (absence expected for this review)
- Pipeline Signed-off-by: Sasha Levin ignored per instructions
**Step 1.3 — Body**
Record:
- Bug: MS-SMB2 requires Connection.ShouldSign when the client sets SMB2_NEGOTIATE_SIGNING_REQUIRED on NEGOTIATE. ksmbd stores that in conn->sign, but only set it when server_conf.signing was AUTO or DISABLED.
- Symptom: with server signing = enabled, a client that requires signing does not get conn->sign set. Later session signing (sess->sign) can stay off unless SESSION_SETUP repeats the flag.
- Failure mode: protocol MUST violation; session may not be treated as signing-required.
- Version: present since ksmbd was merged; not a new-code-only bug.
**Step 1.4 — Hidden fix?**
Record: Not disguised. It is an explicit protocol/security correctness fix.
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record:
- File: fs/smb/server/smb2pdu.c (upstream +2/−4; this tree matches at lines 1252–1263)
- Function: smb2_handle_negotiate()
- Scope: single-file surgical logic change
**Step 2.2 — Before → after**
Record:
- Before: conn->sign = true only if (AUTO || DISABLED) && client SIGNING_REQUIRED, else if MANDATORY (force required + conn->sign).
- After: if client SIGNING_REQUIRED → conn->sign = true in every server mode. MANDATORY handling is a separate if (not else if) and is otherwise unchanged.
- Path: SMB2 NEGOTIATE, once per connection.
**Step 2.3 — Bug mechanism**
Record: Logic/correctness (protocol security). KSMBD_CONFIG_OPT_ENABLED (1) was the missing case. Userspace maps server signing = enabled to that value.
**Step 2.4 — Fix quality**
Record: Obviously correct vs MS-SMB2 3.3.5.4. Minimal. Changing else if to if is equivalent for AUTO/DISABLED/MANDATORY. Regression risk is very low; the only new behavior is honoring client-required signing when the server mode is ENABLED.
## Phase 3: Git history
**Step 3.1 — Blame**
Record: Buggy condition is from e2f34481b24db (“cifsd: add server-side procedures for SMB3”, 2021-05-10). Whitespace-only tweak in 64b39f4a2fd29. Present since ksmbd entered mainline (~v5.15).
**Step 3.2 — Fixes: tag**
Record: None. Introduction commit is an ancestor of this tree (git merge-base --is-ancestor e2f34481b24db HEAD succeeded).
**Step 3.3 — File history**
Record: Recent smb2pdu.c work is leases, durable reconnect, negotiate races — not this signing condition. Standalone, not “patch X/Y”.
**Step 3.4 — Author**
Record: Namjae Jeon is the ksmbd maintainer. Nearby work is other ksmbd protocol/security fixes, not a prerequisite series for this hunk.
**Step 3.5 — Dependencies**
Record: None. Uses existing conn->sign, server_conf.signing, and SMB2_NEGOTIATE_SIGNING_REQUIRED_LE. git apply --check of a line- adjusted patch is clean.
## Phase 4: Mailing list / external
**Step 4.1 — Original discussion**
Record: Upstream SHA bc2f3f3dd69424f76e2ed3dc53d29bfd6c9966d4 (authored 2026-07-17, committed 2026-08-17). b4 dig failed:
lore.kernel.org returned errors (bot protection). No thread URL retrieved.
**Step 4.2 — Reviewers**
Record: UNVERIFIED via b4. Namjae is both author and committer; typical for ksmbd maintainer commits.
**Step 4.3 — Bug report**
Record: No Reported-by / syzbot / bugzilla. The 7.3-rc1 ksmbd pull (Namjae Jeon, 2026-08-23) lists “signing-required handling” under “SMB2/SMB3 protocol validation and security issues” and mentions smbtorture-validated compatibility fixes.
**Step 4.4 — Series**
Record: Independent of the 7.3 features landed the same day (replay, sequence window, Time Machine). This hunk does not use those structures.
**Step 4.5 — stable@**
Record: lore.kernel.org/stable search returned 403. No stable-specific NAK found.
## Phase 5: Code semantics
**Step 5.1 — Functions**
Record: smb2_handle_negotiate() only.
**Step 5.2 — Callers**
Record: Called from fs/smb/server/smb_common.c during SMB2 dialect negotiate, under conn->srv_mutex. That is the first SMB2 command on a connection (TCP 445). User-reachable on every ksmbd connection.
**Step 5.3 — Callees / effects**
Record: conn->sign is Connection.ShouldSign. It is consumed in NTLM and Kerberos session setup to set sess->sign. sess->sign causes response signing in __handle_ksmbd_work().
**Step 5.4 — Reachability**
Record: Yes, from the network. Gated on CONFIG_SMB_SERVER (default n).
**Step 5.5 — Similar patterns**
Record: SESSION_SETUP has a second check: req->SecurityMode & SMB2_NEGOTIATE_SIGNING_REQUIRED. Compliant clients (MS-SMB2 MUST, Linux CIFS) usually set the same flag on SESSION_SETUP, so sess->sign can still be set. That is a fallback, not a reason the NEGOTIATE bug is absent. SMB1-style negotiate around line 307 only advertises REQUIRED in MANDATORY mode and does not set conn->sign.
Verified in this tree: smb2_is_sign_req() still only looks at SMB2_FLAGS_SIGNED on the request. This patch does not add reject- unsigned-when-required. It only sets ShouldSign so session signing state can follow the spec.
## Phase 6: This tree (6.12.111)
**Step 6.1 — Buggy code present?**
Record: Yes, fs/smb/server/smb2pdu.c lines 1255–1263. Local tree:p-6.12-3-gc504cf0baa3d8, make kernelversion = **6.12.111**. Upstream commit is **not** an ancestor (git merge-base --is-ancestor bc2f3f3dd694 HEAD failed).
**Step 6.2 — Backport difficulty**
Record: Clean apply after shifting hunks (~1252 vs upstream ~1687). Surrounding negotiate code matches.
**Step 6.3 — Related fixes already here?**
Record: 1ae94dd9dea50 (“mark invalid session responses as signed”) is a different FLAGS_SIGNED error-path issue. No existing fix for the ENABLED-mode conn->sign gap.
## Phase 7: Subsystem
**Step 7.1**
Record: fs/smb/server (ksmbd). Criticality: IMPORTANT (network-facing SMB3 server; not core mm/VFS, but production NAS/OpenWrt/etc.).
**Step 7.2**
Record: Actively maintained; this 6.12 tree already carries many later ksmbd security/protocol backports.
## Phase 8: Impact and risk
**Step 8.1 — Who**
Record: ksmbd users (CONFIG_SMB_SERVER) with server signing = enabled. ksmbd-tools cp_get_group_kv_config_opt() maps "enabled" → KSMBD_CONFIG_OPT_ENABLED. Default in tools is auto (already correct). "enabled" is still a parsed, distinct value (Samba-style configs often use it). Man page documents disabled/auto/mandatory; userspace still accepts enabled.
**Step 8.2 — Trigger**
Record: Client sets NEGOTIATE SMB2_NEGOTIATE_SIGNING_REQUIRED while server mode is ENABLED. Common for Windows/Linux clients that require signing. Unprivileged remote clients can send that bit.
**Step 8.3 — Failure mode**
Record: Protocol MUST missed; Connection.ShouldSign stays false.
Severity: **MEDIUM–HIGH** (integrity of SMB traffic / spec security negotiation), not a panic. Mitigated if SESSION_SETUP also carries SIGNING_REQUIRED.
**Step 8.4 — Risk vs benefit**
Record: Benefit: honor client-required signing in the one broken mode; matches spec and maintainer intent. Risk: very low (4-line boolean, no locks/APIs/new features). Ratio: favorable.
## Phase 9: Synthesis
**For backporting**
- Real MS-SMB2 MUST violation in existing 6.12 code
- Security-related signing negotiation on a network file server
- Tiny, obviously correct, applies cleanly
- Maintainer-authored; 7.3-rc1 pull grouped it with protocol/security fixes
- server signing = enabled is a real userspace mapping
**Against**
- Default auto already sets conn->sign
- SESSION_SETUP fallback for compliant clients
- No crash/syzbot/CVE
- Does not fully enforce unsigned-request rejection (is_sign_req still flag-based)
**Unresolved**
- Full lore review thread (lore 403 / b4 failed)
- No stable@ discussion retrieved
**Stable rules**
1. Obviously correct and tested? **PASS** (logic vs spec; maintainer- committed)
2. Real bug affecting users? **PASS** (ENABLED mode + client SIGNING_REQUIRED)
3. Important (security/protocol integrity)? **PASS** (signing-required handling; not a panic)
4. Small and contained? **PASS** (+2/−4, one function)
5. No new features/APIs? **PASS**
6. Applies to this tree? **PASS** (clean apply)
No exception category (not a device ID/quirk/DT/build/docs-only change). It is a normal small protocol fix.
The ENABLED hole is the mode where admins reasonably expect signing to work, and it is the only mode that ignored a client REQUIRED bit. Cost of backporting to 6.12.y is negligible.
Verification:
- [Phase 1] Parsed message/tags: only Namjae SOB; no Fixes/Reported-by
- [Phase 2] Diff: smb2_handle_negotiate() condition; ENABLED was skipped
- [Phase 3] git blame / -L: introduced in e2f34481b24db (v5.15-era cifsd)
- [Phase 3] git merge-base --is-ancestor e2f34481b24db HEAD: yes
- [Phase 3] git merge-base --is-ancestor bc2f3f3dd694 HEAD: no (not in this tree)
- [Phase 3] git apply --check: clean on 6.12 smb2pdu.c
- [Phase 4] GitHub API: upstream bc2f3f3dd69424f76e2ed3dc53d29bfd6c9966d4
- [Phase 4] b4 dig -c bc2f3f3dd694: lore errors, no thread
- [Phase 4] 7.3-rc1 GIT PULL: “signing-required handling” under protocol/security
- [Phase 5] Caller: smb_common.c SMB2 NEGOTIATE; conn->sign → sess->sign in session setup
- [Phase 5] smb2_is_sign_req() does not use conn->sign (verified)
- [Phase 6] git describe HEAD: p-6.12-3-gc504cf0baa3d8; make kernelversion: 6.12.111; buggy if present at 1255–1263
- [Phase 8] ksmbd-tools config_parser.c: "enabled" → KSMBD_CONFIG_OPT_ENABLED; default "server signing = auto"
- UNVERIFIED: mailing-list NAKs/Cc: stable (lore unavailable)
This is a small, contained protocol-security fix that already matches this tree’s ksmbd negotiate path and should be backported.
**YES**
fs/smb/server/smb2pdu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/smb/server/smb2pdu.c +2 -4
@@ -1253,11 +1253,9 @@ int smb2_handle_negotiate(struct ksmbd_work *work) rsp->SecurityMode =SMB2_NEGOTIATE_SIGNING_ENABLED_LE ; conn->use_spnego = true; -if ((server_conf.signing ==KSMBD_CONFIG_OPT_AUTO || - server_conf.signing ==KSMBD_CONFIG_OPT_DISABLED ) && - req->SecurityMode &SMB2_NEGOTIATE_SIGNING_REQUIRED_LE ) +if (req->SecurityMode &SMB2_NEGOTIATE_SIGNING_REQUIRED_LE ) conn->sign = true; -else if (server_conf.signing ==KSMBD_CONFIG_OPT_MANDATORY ) { +if (server_conf.signing ==KSMBD_CONFIG_OPT_MANDATORY ) { server_conf.enforced_signing = true; rsp->SecurityMode |=SMB2_NEGOTIATE_SIGNING_REQUIRED_LE ; conn->sign = true;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/rockchip: dw_hdmi: Use resume_early pm ops for system suspend
In reply to Sasha LevinFrom: Jonas Karlman <[email protected]>
[ Upstream commit af3a9eadc11896f6677bcb7102bfb7c84be48d2d ]
rockchip_drm_sys_resume()/drm_mode_config_helper_resume() is called before the resume pm ops of dw-hdmi. This result in an atomic_enable() before dw_hdmi_rockchip_resume()/dw_hdmi_resume() is called.
Resume (without changes):
- rockchip_drm_sys_resume()
- drm_mode_config_helper_resume()
- atomic_enable()
- dw_hdmi_rockchip_resume()
- dw_hdmi_resume()
- dw_hdmi_init_hw()
Change to use resume_early pm ops for system suspend to ensure pm ops for dw-hdmi is run before rockchip-drm pm ops. Also fix a possible NULL pointer dereference timing issue while at it.
Resume (with changes):
- dw_hdmi_rockchip_resume_early()
- dw_hdmi_resume()
- dw_hdmi_init_hw()
- rockchip_drm_sys_resume()
- drm_mode_config_helper_resume()
- atomic_enable()
---
LLM Generated explanations, may be completely bogus:
I have the 6.18.y picture: the buggy resume path is in v6.18.53, the patch is self-contained, and the DSI sibling already uses the same late/early PM ordering. Compiling the full nine-phase verdict next.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [drm/rockchip: dw_hdmi] [Use] [switch HDMI system-resume callback to resume_early so dw-hdmi re-inits before rockchip-drm atomic_enable]
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Tested-by: Heiko Stuebner <[email protected]> #rk3328 (Rockchip DRM maintainer; hardware-tested)
- Signed-off-by: Jonas Karlman <[email protected]> (author)
- Signed-off-by: Heiko Stuebner <[email protected]> (subsystem maintainer applied it)
- Link:
https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by, Reviewed-by, Acked-by, or Cc: stable (absence expected)
- Ignore pipeline tags: [Upstream commit af3a9eadc11896f6677bcb7102bfb7c84be48d2d], Signed-off-by: Sasha Levin
Notable: maintainer Tested-by on real RK3328 hardware.
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: on system resume, rockchip_drm_sys_resume() → drm_mode_config_helper_resume() → atomic enable runs before dw_hdmi_resume() → dw_hdmi_init_hw().
- Symptom: HDMI hardware (DDC I2C, HPD, interrupt mutes) is restored after DRM has already tried to re-enable the display pipeline.
- Secondary: “possible NULL pointer dereference timing issue” — resume can run with NULL drvdata.
- No stack trace, syzbot report, or CVE. Author gave simulated-suspend (pm_test) and rtcwake test steps in the mailing-list version.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not disguised. It is an explicit PM-ordering fix plus a NULL check. It was patch 11/11 of a series titled “Misc cleanup and propagate bus format”, and was added in v2; the other patches are unrelated cleanups/prep. This hunk is a standalone bug fix.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c (+4/-3, 7 lines)
- Functions: dw_hdmi_rockchip_resume renamed to dw_hdmi_rockchip_resume_early; dw_hdmi_rockchip_pm table
- Scope: single-file surgical PM-ops change
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: .resume (normal phase) unconditionally calls dw_hdmi_resume(hdmi->hdmi).
- After: .resume_early (early phase) calls it only if dev_get_drvdata() is non-NULL.
- SET_SYSTEM_SLEEP_PM_OPS(NULL, resume) → SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, resume_early).
- Suspend remains NULL. Hibernation thaw/restore move from thaw/restore to thaw_early/restore_early, matching the same ordering intent.
Resume phase order is resume_noirq → resume_early → resume. HDMI therefore always re-inits before rockchip-drm’s .resume.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Primary: logic/correctness + hardware resume ordering. Sibling dw- mipi-dsi-rockchip.c already uses SET_LATE_SYSTEM_SLEEP_PM_OPS with the comment that it must run before rockchip_drm_drv re-enables panels.
- Secondary: memory safety — NULL check before hdmi->hdmi dereference when the platform device has probed (component_add) but not bound (platform_set_drvdata is in bind, not probe).
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct: Linux PM runs all resume_early callbacks before any .resume. That is the standard way to order a component ahead of the DRM master.
- Minimal; no API or data-structure change.
- Regression risk low: same pattern as the in-tree DSI sibling; only resume is registered; dw_hdmi_init_hw() only re-inits mutes, DDC I2C, and HPD.
- NULL check does not cover hdmi->hdmi being ERR_PTR after a failed bind; that is a leftover hole, not a regression from this patch.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Buggy resume path introduced by 27c9130baef543 (“drm/rockchip:
dw_hdmi: Handle suspend/resume”, Douglas Anderson, 2019-06-04), first in v5.3-rc1.
- That commit is an ancestor of this tree.
- That commit already documented the failure on rk3288 Chromebooks (HDMI HPD and DDC I2C stop working after suspend) and that Chrome OS 3.14 used late/early PM ops because VOP sometimes resumed before dw-hdmi. Mainline used normal .resume because the author could not reproduce it then. This patch is the proper late/early fix for that known issue.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. The introducing commit is 27c9130baef543, present here.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record:
- Only two resume-related commits on this file: 27c9130baef543 (add resume) and this one.
- Recent 6.18.y file history is unrelated (SCLIN mask, FIELD_PREP, whitespace).
- Series-local neighbors (output_port, whitespace, empty helpers) are not functional prerequisites of this hunk.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Jonas Karlman is a regular Rockchip HDMI/dw-hdmi contributor. Heiko Stuebner (maintainer) applied the series and tested it on rk3328.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record:
- Series v2 11/11; cover letter says patches 1–10 are cleanup / YCbCr- Deep Color prep. Patch 11 only changes PM ops.
- SET_LATE_SYSTEM_SLEEP_PM_OPS exists in this tree’s include/linux/pm.h.
- dw_hdmi_resume() exists in drivers/gpu/drm/bridge/synopsys/dw- hdmi.c.
- Applies standalone. No missing helpers.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig:
https://patch.msgid.link/[email protected]
- v1 (2026-05-10): 10 patches, no resume_early change
- v2 (2026-05-18): this patch added (“v2: New patch”)
- Applied by Heiko 2026-06-02 as af3a9eadc11896f6677bcb7102bfb7c84be48d2d
- No NAK. No reviewer asked for further revisions of this hunk.
- Author included CONFIG_PM_DEBUG / rtcwake test instructions and noted a separate RK356x EHCI/OHCI clock issue, not this bug.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: Recipients included Heiko Stuebner, Sandy Huang, Andy Yan, DRM maintainers, dri-devel, linux-rockchip. Heiko tested and applied. No other Acked-by/Reviewed-by on this patch.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No syzbot/bugzilla link. Real-world grounding is the 2019 Chromebook report in 27c9130baef543 plus Heiko’s rk3328 Tested-by.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Standalone vs the rest of the v2 series. DSI sibling e584cdc154993 (“drm/rockchip: dsi: Reconfigure hardware on resume()”) used the same late PM ops and had Cc: stable.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: UNVERIFIED. lore.kernel.org/stable returned an Anubis bot-check page; WebFetch to lore returned 403.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: dw_hdmi_rockchip_resume_early (was dw_hdmi_rockchip_resume); dw_hdmi_rockchip_pm.
Step 5.2: TRACE CALLERS
Record: Invoked by the PM core as dev_pm_ops.resume_early on the dwhdmi-rockchip platform driver. Triggered by system suspend/resume (and freeze/thaw/restore via LATE_SYSTEM_SLEEP_PM_OPS). Not a syscall hot path; it is the Chromebook/SBC sleep path.
Step 5.3: TRACE CALLEES
Record: dev_get_drvdata → dw_hdmi_resume → dw_hdmi_init_hw → initialize_hdmi_ih_mutes, dw_hdmi_i2c_init, optional phy.ops->setup_hpd.
Step 5.4: FOLLOW THE CALL CHAIN
Record:
- Userspace: echo mem > /sys/power/state / rtcwake / systemd suspend.
- DRM side: rockchip_drm_sys_resume → drm_mode_config_helper_resume → drm_atomic_helper_resume (atomic commit / enable).
- HDMI platform device is a component, not a child of the DRM device; sibling .resume order is not guaranteed. platform_set_drvdata is in dw_hdmi_rockchip_bind, while probe only does component_add, so resume-before-bind can see NULL drvdata.
- Reachable on any Rockchip board with this HDMI IP and CONFIG_PM_SLEEP (RK3288/RK3328/RK3399/RK3568, including Chromebooks).
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record:
- dw-mipi-dsi-rockchip.c already uses SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) in this tree for the same reason.
- dw_hdmi_qp-rockchip.c still uses SET_SYSTEM_SLEEP_PM_OPS (different HDMI QP IP, not this patch).
- imx8mp and meson dw-hdmi glue still use normal SYSTEM_SLEEP PM ops.
===============================================================
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 = v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion = 6.18.53 (6.18.y).
- v6.18.53 still has:
SET_SYSTEM_SLEEP_PM_OPS(NULL, dw_hdmi_rockchip_resume) and dw_hdmi_resume(hdmi->hdmi) with no NULL check
at drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c.
- Bug present since v5.3 (2019), long before 6.18 branched.
- Upstream commit af3a9eadc11896 is not an ancestor of HEAD (git merge-base --is-ancestor failed); this is a backport candidate, not already in 6.18.y proper.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Clean apply. The resume function in v6.18.53 is identical to the parent of this change. SET_LATE_SYSTEM_SLEEP_PM_OPS and dw_hdmi_resume() already exist here. Surrounding unbind/bridge-ref changes from later series patches are not required.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: No other resume-ordering fix on this file. DSI already has the analogous LATE PM ops. No earlier version of this HDMI fix in 6.18.53.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: DRM Rockchip HDMI glue (drivers/gpu/drm/rockchip/). IMPORTANT (common SoC display, not core mm/fs). Affects RK3288/RK3328/RK3399/RK356x HDMI (Chromebooks, SBCs, TV boxes).
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Mature driver (HDMI glue since ~2015). Resume path untouched from 2019 until this patch. Low churn on the PM ops themselves.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Driver-specific / platform-specific. Users of Rockchip dw-hdmi who suspend the system. CONFIG_PM_SLEEP. Not universal, but a well-used platform class in Android, Chromebook, and ARM SBCs.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record:
- Trigger: system suspend/resume with this HDMI driver bound (and the NULL path if probed but unbound).
- Common on laptops/Chromebooks; less so on always-on appliances.
- Unprivileged users typically cannot suspend; the HPD/I2C break is still a real admin/user-visible failure after lid-close/sleep.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record:
- Primary: HDMI HPD and DDC I2C not restored before DRM atomic enable → hotplug/EDID/output broken after resume. HIGH for affected hardware (display not coming back is a serious functional bug), not a kernel panic.
- Secondary: NULL deref if resume runs before bind → oops. Less common. HIGH if hit, MEDIUM likelihood.
- Overall: HIGH (suspend/resume display breakage on real hardware).
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: high for Rockchip HDMI suspend users; restores the ordering Chrome OS already needed.
- Risk: very low (7 lines, established LATE PM pattern already in the same DRM driver).
- Ratio: favor backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real resume-ordering bug: DRM atomic enable before dw_hdmi_init_hw().
- User-visible: HDMI HPD/DDC broken after sleep (documented on rk3288 Chromebooks in 2019; re-tested on rk3328 in 2026).
- Same fix already used by dw-mipi-dsi-rockchip in this tree, and that DSI change went to stable with Cc: stable.
- Possible NULL deref on resume before bind.
- 7-line surgical change; applies cleanly to v6.18.53.
- Maintainer Tested-by and Signed-off-by.
- Buggy code has been in this tree since v5.3; no missing prerequisites.
AGAINST:
- No Fixes:/Cc: stable (expected for this pipeline; not a negative).
- Buried as 11/11 in a cleanup series (but the hunk is independent and was added specifically in v2).
- Not a panic/corruption/CVE; display-after-suspend rather than a crash.
- No extra Reviewed-by besides maintainer apply/test.
- UNVERIFIED whether stable@ already discussed rejecting it.
UNRESOLVED:
- lore.kernel.org/stable search blocked (Anubis/403).
- Incomplete NULL check if bind failed and left hdmi->hdmi as ERR_PTR (pre-existing).
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? PASS — PM phase ordering is well- defined; Heiko tested on rk3328.
2. Fixes a real bug that affects users? PASS — HDMI not correctly re- inited before DRM resume; Chromebook-class hardware.
3. Important issue (crash, security, corruption, deadlock)? PASS — suspend/resume display breakage plus a possible oops; hardware resume workaround, same class as the DSI stable fix.
4. Small and contained? PASS — 7 lines, one file.
5. No new features or APIs? PASS.
6. Can apply to the local tree? PASS — v6.18.53 has the old resume function and the LATE PM macro.
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: Hardware suspend/resume workaround on an existing driver (quirk- class). Not a new driver, ID, or API.
Step 9.4: MAKE YOUR DECISION
This belongs on 6.18.y. The buggy .resume path is in this checkout, the switch to resume_early is the same proven pattern as the in-tree DSI sibling, and the patch is tiny with maintainer hardware testing.
What it solves for stable users: after system sleep on Rockchip dw-hdmi boards, DRM can re-enable the pipeline before HDMI DDC/HPD/init, so hotplug and HDMI output fail. Moving the callback to resume_early forces dw_hdmi_init_hw() first, and skips a NULL drvdata deref if the component never bound.
Risk is low; benefit is a real resume fix on shipping SoCs. No series dependencies are required for this hunk.
Verification:
- [Phase 1] Parsed tags: Tested-by Heiko (rk3328), SOB Jonas + Heiko, Link msgid ...-12; no Fixes/Reported-by/Cc:stable
- [Phase 1] Cover letter via b4 mbox: patch 11/11 of v2 “Misc cleanup”; “v2: New patch”; Heiko “Series: Tested-by” and Applied
- [Phase 2] Diff: rename resume→resume_early, add if (hdmi), SET_SYSTEM_SLEEP→SET_LATE_SYSTEM_SLEEP; +4/-3
- [Phase 2] Confirmed LATE_SYSTEM_SLEEP_PM_OPS maps resume_fn to .resume_early in include/linux/pm.h:321-327,350-351
- [Phase 2] Confirmed rockchip_drm_drv.c:260-262 still uses SET_SYSTEM_SLEEP_PM_OPS for sys_resume
- [Phase 2] drm_mode_config_helper_resume() calls drm_atomic_helper_resume() (drm_modeset_helper.c:250)
- [Phase 3] git blame parent: resume added in 27c9130baef543 (Douglas Anderson, 2019)
- [Phase 3] git show 27c9130baef543: documented Chromebook HPD/I2C break and Chrome OS late/early PM ops
- [Phase 3] git describe --contains 27c9130baef543 → v5.3-rc1; git merge-base --is-ancestor 27c9130baef543 HEAD → yes
- [Phase 3] git log --oneline --grep resume_early -- drivers/gpu/drm/rockchip/ → only this commit
- [Phase 4] b4 dig -c af3a9eadc11896: lore thread found; v1 had no this patch; v2 added it; applied as af3a9eadc11896
- [Phase 4] b4 dig -a: v1 2026-05-10, v2 2026-05-18
- [Phase 4] b4 dig -w: Heiko, dri-devel, linux-rockchip CC’d
- [Phase 4] b4 dig -m /tmp/thread.mbox: no NAKs; Heiko tested+applied
- [Phase 4] lore.kernel.org WebFetch 403; stable search Anubis-blocked → UNVERIFIED stable@ discussion
- [Phase 5] Callers: PM core resume_early on dwhdmi-rockchip; callees dw_hdmi_resume→dw_hdmi_init_hw
- [Phase 5] platform_set_drvdata in bind (line 580), probe only component_add — NULL drvdata on unbound resume is real
- [Phase 5] Sibling dw-mipi-dsi-rockchip.c:1346 already SET_LATE_SYSTEM_SLEEP_PM_OPS in this tree; introduced by e584cdc154993 with Cc: stable
- [Phase 6] git describe HEAD: v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion 6.18.53
- [Phase 6] git show v6.18.53:dw_hdmi-rockchip.c has SET_SYSTEM_SLEEP_PM_OPS + unchecked dw_hdmi_resume
- [Phase 6] git merge-base --is-ancestor af3a9eadc11896 HEAD → no (not in 6.18.y proper)
- [Phase 6] Resume hunk in v6.18.53 identical to parent of this change; SET_LATE and dw_hdmi_resume exist in v6.18.53
- [Phase 8] Failure mode: HDMI broken after suspend (HIGH); possible NULL oops (HIGH if hit)
- UNVERIFIED: whether stable@ previously rejected this patch (lore blocked)
**YES**
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +4 -3
@@ -635,17 +635,18 @@ static void dw_hdmi_rockchip_remove(struct platform_device *pdev)component_del (&pdev->dev, &dw_hdmi_rockchip_ops); } -static int __maybe_unused dw_hdmi_rockchip_resume (struct device *dev) +static int __maybe_unused dw_hdmi_rockchip_resume_early (struct device *dev) {struct rockchip_hdmi *hdmi =dev_get_drvdata (dev); -dw_hdmi_resume (hdmi->hdmi); +if (hdmi) +dw_hdmi_resume (hdmi->hdmi);return 0 ; }static const struct dev_pm_ops dw_hdmi_rockchip_pm = { -SET_SYSTEM_SLEEP_PM_OPS (NULL , dw_hdmi_rockchip_resume) +SET_LATE_SYSTEM_SLEEP_PM_OPS (NULL , dw_hdmi_rockchip_resume_early) };struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] drm/rockchip: dw_hdmi: Use resume_early pm ops for system suspend
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/rockchip: dw_hdmi: UAF in dw_hdmi_rockchip_resume_early() on stale drvdata --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/rockchip: dw_hdmi: UAF in dw_hdmi_rockchip_resume_early() on stale drvdata --
commit c6209b9cde57945de5a9c2033ae8339d9c3026b8
Author: Jonas Karlman <[email protected]>
drm/rockchip: dw_hdmi: Use resume_early pm ops for system suspend
This commit switches the dw-hdmi Rockchip glue driver to use the resume_early PM callback so that dw_hdmi_resume() runs before rockchip_drm_sys_resume() during system resume. It also adds a NULL check on the driver data pointer in dw_hdmi_rockchip_resume_early().
Quoted 6 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +0
-0@@ -635,17 +635,18 @@ static void dw_hdmi_rockchip_remove(struct platform_device *pdev)component_del (&pdev->dev, &dw_hdmi_rockchip_ops);
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c static void dw_hdmi_rockchip_remove(struct platform_device *pdev) · line 643
Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +3
-2} -static int __maybe_unused dw_hdmi_rockchip_resume (struct device *dev) +static int __maybe_unused dw_hdmi_rockchip_resume_early (struct device *dev) {struct rockchip_hdmi *hdmi =dev_get_drvdata (dev); -dw_hdmi_resume (hdmi->hdmi); +if (hdmi) +dw_hdmi_resume (hdmi->hdmi);
[Severity: High]
Is checking if (hdmi) sufficient to guarantee that hdmi and hdmi->hdmi are valid here?
In drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c, hdmi is allocated with devm_kzalloc() inside dw_hdmi_rockchip_bind(), which runs inside the component devres group opened by component_bind().
dw_hdmi_rockchip_bind() sets the driver data before calling dw_hdmi_bind(), and does not clear it on failure:
platform_set_drvdata(pdev, hdmi);
hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data);
if (IS_ERR(hdmi->hdmi)) {
ret = PTR_ERR(hdmi->hdmi);
goto err_bind;
}
return 0;err_bind:
drm_encoder_cleanup(encoder); return ret;
When dw_hdmi_bind() fails (for example with -EPROBE_DEFER when the DDC I2C adapter is not ready), component_bind() calls devres_release_group(), which frees hdmi and disables the devm-managed clocks and regulators while leaving dev->driver_data as a non-NULL dangling pointer.
Similarly, dw_hdmi_rockchip_unbind() does not clear dev->driver_data before component_unbind() calls devres_release_group():
static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
void *data)
{
struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
dw_hdmi_unbind(hdmi->hdmi);
drm_encoder_cleanup(&hdmi->encoder.encoder);
}If a system suspend/resume occurs after a failed bind or after component unbind, wouldn't dev_get_drvdata(dev) in dw_hdmi_rockchip_resume_early() return a non-NULL dangling pointer and pass a freed or ERR_PTR hdmi->hdmi to dw_hdmi_resume() while the HDMI clocks and regulators are disabled?
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c static void dw_hdmi_rockchip_remove(struct platform_device *pdev) · line 652
Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +1
-1return 0 ; }static const struct dev_pm_ops dw_hdmi_rockchip_pm = { -SET_SYSTEM_SLEEP_PM_OPS (NULL , dw_hdmi_rockchip_resume) +SET_LATE_SYSTEM_SLEEP_PM_OPS (NULL , dw_hdmi_rockchip_resume_early) };struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
നേരിട്ട്
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 platform/x86: asus-nb-wmi: map ProArt key (0x8b) to KEY_PROG3
In reply to Sasha LevinFrom: Nizar Al-Kabbani <[email protected]>
[ Upstream commit 6303451189a6d8f304221065c44ccd597e0acbe5 ]
The dedicated "ProArt" key on the ASUS ProArt PX13 (HN7306) emits ASUS WMI event code 0x8b. This code is absent from the asus-nb-wmi sparse keymap, so pressing the key only produces a "Unknown key code 0x8b" message and does nothing in userspace.
On this model the key is exposed solely through the WMI interface and has no HID scancode, so it can only be handled inside asus-nb-wmi. Map 0x8b to KEY_PROG3 so the key emits a bindable event, consistent with the existing KEY_PROG3 mapping used for the ASUS programmable/Armoury key.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject**
Record: **[platform/x86: asus-nb-wmi:] [map] dedicated ProArt WMI event 0x8b to KEY_PROG3**
Subsystem: platform/x86 (asus-nb-wmi). Verb: **map** — hardware-key enablement, not a refactor.
**Step 1.2 — Tags** (ignoring pipeline Signed-off-by: Sasha Levin / [Upstream commit …] as instructed)
- **Fixes:** none (expected)
- **Reported-by:** none
- **Tested-by:** none in the commit; the lore From host is proart- px13.tail9ecfc0.ts.net, so the author submitted from the affected machine
- **Reviewed-by:** Denis Benato <[email protected]>; Ilpo Järvinen <[email protected]> (platform/x86 maintainer)
- **Acked-by:** none
- **Link:** https://patch.msgid.link/20260719090843.66777-1- [email protected]
- **Cc: stable:** none (expected)
- **Signed-off-by:** Nizar Al-Kabbani (author); Ilpo Järvinen (maintainer application)
Record: Maintainer + ASUS-WMI reviewer sign-off. No syzbot, no crash report.
**Step 1.3 — Body**
Record: **Bug:** ASUS ProArt PX13 (HN7306) ProArt key emits WMI 0x8b, which is missing from asus_nb_wmi_keymap[].
**Symptom:** pr_info("Unknown key code 0x8b") and no EV_KEY in userspace.
**Root cause:** key is WMI-only on this model (no HID scancode), so only this driver can report it.
**Fix:** map 0x8b → KEY_PROG3, matching Armoury/programmable-key practice.
**Version info:** none in the message.
**Step 1.4 — Hidden bug fix?**
Record: **No disguise.** This is an explicit missing-keymap fix / hardware enablement, not cleanup dressed as a fix.
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record: **1 file**, drivers/platform/x86/asus-nb-wmi.c, **+1 / −0**. Function/object: static table asus_nb_wmi_keymap[]. **Single-file surgical table insertion.**
**Step 2.2 — Flow**
Record: **Before:** WMI notify → sparse_keymap_report_event() misses 0x8b → log + drop.
**After:** same path reports KEY_PROG3 (code 202) as a bindable key.
Path: firmware WMI event on key press (normal input path, not error/init).
**Step 2.3 — Bug mechanism**
Record: **Hardware workaround / keymap gap** (same family as device-ID / input quirk table rows). Not UAF, leak, race, or crash. Unmapped sparse- keymap code is ignored.
**Step 2.4 — Fix quality**
Record: **Obviously correct** for a static key_entry. Minimal. No API, lock, or alloc change.
**Regression risk:** low. Theoretical: some other ASUS model could emit WMI 0x8b for a different function. 0x8b sat in a hole between 0x8A (2012) and 0x8C (2012) with no mapping for ~14 years, so that is unlikely.
**Note (not a blocker):** hid-asus.c maps HID usage 0x8b to KEY_PROG1 (“ProArt Creator Hub”). This commit uses KEY_PROG3 and states PX13 has no HID scancode, so this model should not double-report.
---
## Phase 3: Git history
**Step 3.1 — Blame**
Record: Neighbor entries 0x8A / 0x8C from **a935eaecef2b20 / 24c8a4c4ba6cfe (2012)**. Driver table since **b229ece9911cc (2011)**. The 0x8b row is **6303451189a6d** (this commit, 2026-07-19). KEY_PROG3 for Armoury: **f56e676a7f1ca** (v5.19-rc7~…).
**Step 3.2 — Fixes: tag**
Record: **N/A** — no Fixes:. This fills a table gap for hardware, not a regression from a prior commit.
**Step 3.3 — File history**
Record: Recent related work: DMI quirks, display-toggle keymap (e521dc1687834), ExpertBook keys (3c75dc44ad11c). Pattern of one- line keymap rows is established. **Standalone**, not N/M.
**Step 3.4 — Author**
Record: Nizar Al-Kabbani’s only hit under drivers/platform/x86/ here is this commit (hardware owner, not maintainer). Weight comes from **Denis Benato** and **Ilpo Järvinen**.
**Step 3.5 — Dependencies**
Record: **None.** Needs existing asus_nb_wmi_keymap[], KEY_PROG3, and sparse_keymap_setup(). All present. **Applies standalone.**
Commit **6303451189a6d** is an ancestor of HEAD (git merge-base --is- ancestor succeeded). First contained in **v7.3-rc1** (v7.3-rc1~63^2~75). **Not in v7.2.** Merged via platform- drivers-x86-v7.3-1.
---
## Phase 4: Mailing list / external
**Step 4.1 — b4 dig**
Record: Lore: https://patch.msgid.link/20260719090843.66777-1- [email protected]
**v1 only** (single [PATCH], applied as submitted).
Denis: Reviewed-by only, no NAK.
Ilpo: applied to review-ilpo-next; noted for-next routing (not a same- cycle regression). **No Cc: stable in review.**
**Step 4.2 — Recipients (b4 dig -w)**
Record: Corentin Chary, Luke D. Jones, Denis Benato, Hans de Goede, Ilpo Järvinen, platform-driver-x86@, linux-kernel@. Right maintainers.
**Step 4.3 — Bug report**
Record: No bugzilla/syzbot. Author describes the unknown-key log from the PX13. WebFetch of lore URLs returned **403**; thread recovered via b4 dig -m.
**Step 4.4 — Series**
Record: **Standalone v1.** No companion patches.
**Step 4.5 — stable@**
Record: No stable-list discussion found for this subject.
---
## Phase 5: Semantic / call graph
**Step 5.1 — Functions**
Record: Table asus_nb_wmi_keymap[] only (not a function body).
**Step 5.2 — Callers**
Record: .keymap = asus_nb_wmi_keymap on asus_nb_wmi_driver. asus_wmi_input_init() → sparse_keymap_setup(..., keymap). asus_wmi_notify() → sparse_keymap_report_event(); miss → "Unknown key code 0x%x".
**Step 5.3 — Callees**
Record: sparse_keymap_report_event / sparse_keymap_setup only. No alloc/lock/I/O in the new row.
**Step 5.4 — Reachability**
Record: Firmware WMI interrupt/notify on physical ProArt key. Userspace sees an evdev event after the fix. Not a syscall bug. Unprivileged user with the laptop can press the key.
**Step 5.5 — Similar patterns**
Record: Same driver: 0x86 KEY_PROG1 (MyASUS), 0x38 / ASUS_WMI_KEY_ARMOURY KEY_PROG3, many other KE_KEY rows. hid-asus HID 0x8b → KEY_PROG1 for PX Creator Hub (different transport).
---
## Phase 6: This checkout
**Step 6.1 — Local tree**
Record: git describe HEAD = **v7.3-rc4-27-gf0100363d8c37**. make kernelversion = **7.3.0-rc4**. Makefile VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4.
Driver and keymap **exist**. Line 635 already has { KE_KEY, 0x8B, { KEY_PROG3 } }. The pre-fix gap (0x8A then 0x8C) exists in **v7.2**; this 7.3-rc tree already includes the row because the commit landed in **v7.3-rc1**. That is mainline history, not a “already selected for stable” marker.
**Step 6.2 — Backport difficulty**
Record: **Clean apply** on a tree with this keymap (context around 0x8A/0x8C is the same as v7.2). One-line insert.
**Step 6.3 — Related fixes here**
Record: No alternate fix. This is the mapping. No other 0x8b WMI handling in asus-nb-wmi.c.
---
## Phase 7: Subsystem
**Step 7.1**
Record: **platform/x86 laptop hotkeys**. **PERIPHERAL / vendor-driver**, but CONFIG_ASUS_NB_WMI is common on ASUS x86 notebooks.
**Step 7.2**
Record: **Active** (recent DMI quirks and keymap rows through 2026). Table format itself is mature (2011).
---
## Phase 8: Impact and risk
**Step 8.1 — Who**
Record: **Driver-specific / hardware-specific:** ASUS notebooks that emit WMI 0x8b (documented: ProArt PX13 HN7306). Harmless no-op elsewhere (code never generated).
**Step 8.2 — Trigger**
Record: Press the ProArt key. Common for owners of that model; **not** a race. Physical access only.
**Step 8.3 — Failure mode**
Record: **Dead key + pr_info**. No oops, hang, corruption, or UAF. **Severity: LOW** as a crash class; **real functional hardware miss** for that laptop.
**Step 8.4 — Ratio**
Record: **Benefit: moderate for those users** (key becomes bindable; only kernel path that can do it). **Risk: very low** (1 line, static table). **Ratio: favorable**, same as device-ID / keymap rows stable already takes.
---
## Phase 9: Synthesis
**For backporting**
- One-line keymap row; reviewed by pdx86 maintainer and ASUS-WMI reviewer; v1 applied unchanged
- Real user-visible miss: unknown WMI code, key does nothing; WMI-only on this model
- Same shape as device IDs / input quirks / historical asus-nb-wmi keymap additions (33e21e56243eb MyASUS, e521dc1687834 display toggle, f56e676a7f1ca Armoury KEY_PROG3)
- Documentation/process/stable-kernel-rules.rst: hardware quirk / “oh, that’s not good”, and device-ID-class table additions
- No new API (KEY_PROG3 already in uapi); no series dependency
- Surrounding driver/keymap exist in this tree; patch applies cleanly
**Against**
- Not a crash, security hole, deadlock, or data corruption
- Enablement for one model, not a regression
- Ilpo took it via for-next, not as an urgent regression
- hid-asus uses KEY_PROG1 for HID 0x8b ProArt Creator Hub (userspace binding may differ across models; reviewers accepted KEY_PROG3)
**Unresolved**
- Lore HTML 403; mbox contents were used instead
- Cannot prove no other ASUS SKU uses WMI 0x8b for something else (long- standing hole makes that unlikely)
- No stable@ thread
**Stable rules checklist**
1. Obviously correct and tested? **PASS** — one table row; maintainer review; author on PX13
2. Real bug that affects users? **PASS** — dedicated key dead without the mapping
3. Important (crash/security/corruption/deadlock)? **PASS as hardware quirk / device-ID-class**, not as a panic
4. Small and contained? **PASS** — +1 line, one file
5. No new features/APIs? **PASS** — existing KEY_PROG3; no new syscall/sysfs
6. Can apply to this tree? **PASS** — keymap context matches; no extra commits needed
**Exception:** hardware keymap / input quirk table entry (device-ID analogue).
This tree is **7.3-rc4**, which already contains the row via v7.3-rc1. That does not change technical merit: the driver is here, the change is a one-line hardware table fix, and it is the kind of addition stable accepts. It is not a new driver, not an API, and not a refactor.
### What it solves for stable users
ProArt PX13 owners on a stable kernel with asus-nb-wmi get a working, bindable ProArt key instead of a dmesg-only unknown code. Risk is a single unused WMI code gaining KEY_PROG3 globally in this driver.
### Verification
- **[Phase 1]** Parsed commit 6303451189a6d; tags as above; no Fixes/stable/syzbot
- **[Phase 2]** git show: +1 line in asus_nb_wmi_keymap[]
- **[Phase 3]** blame 0x8A/0x8C = 2012; git merge-base --is-ancestor 6303451189a6d HEAD = yes; git describe --contains = v7.3-rc1~63^2~75; not in v7.2
- **[Phase 3]** git log --oneline --author='Nizar Al-Kabbani' -- drivers/platform/x86/ = this commit only
- **[Phase 4]** b4 dig -c/-a/-w/-m: v1, lore msgid above, recipients listed, mbox has Denis Rb and Ilpo apply mail
- **[Phase 4]** WebFetch lore = 403; stable search = no thread for this patch
- **[Phase 5]** keymap used in asus_nb_wmi_driver; report path asus_wmi_notify @ asus-wmi.c:4692; unknown log @ 4694
- **[Phase 5]** hid-asus case 0x8b → KEY_PROG1 (Amit Chaudhari, 831f70a5b93bd)
- **[Phase 6]** git describe HEAD = v7.3-rc4-27-gf0100363d8c37; line 635 already has the mapping; v7.2 file has 0x8A then 0x8C, no 0x8B
- **[Phase 7]** CONFIG_ASUS_NB_WMI in drivers/platform/x86/Kconfig
- **[Phase 8]** Failure = unknown key log + no evdev; severity LOW as crash, real as hardware enablement
- **UNVERIFIED:** whether any other ASUS model emits WMI 0x8b; lore HTML
(403)
The change meets stable rules as a small, reviewed hardware keymap/quirk, not as a crash fix.
**YES**
drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -622,6 +622,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0x86, { KEY_PROG1 } }, /* MyASUS Key */ { KE_KEY, 0x88, { KEY_RFKILL } }, /* Radio Toggle Key */ { KE_KEY, 0x8A, { KEY_PROG1 } }, /* Color enhancement mode */ + { KE_KEY, 0x8B, { KEY_PROG3 } }, /* ProArt key (PX13/HN7306) */ { KE_KEY, 0x8C, { KEY_SWITCHVIDEOMODE } }, /* SDSP DVI only */ { KE_KEY, 0x8D, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + DVI */ { KE_KEY, 0x8E, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + DVI */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: Gate debugfs MMIO access on kernel lockdown
In reply to Sasha LevinFrom: Asad Kamal <[email protected]>
[ Upstream commit 17ac73b24006700f50972d37e297dec1f523c14a ]
amdgpu_regs, amdgpu_regs2, and related debugfs nodes allow arbitrary MMIO read/write via RREG32/WREG32 without checking security_locked_down(). On kernel_lockdown=integrity systems this bypasses the same restrictions as /dev/mem and PCI config space sysfs.
Check LOCKDOWN_PCI_ACCESS (matching pci-sysfs) at the entry of every debugfs handler that performs direct register access.
v2: Use consistent check as per previous check to use LOCKDOWN_DEBUGFS(Lijo)
v3: Do not create any entry from amdgpu_debugfs_regs_init() if LOCKDOWN_PCI_ACCESS is active and log once. (Lijo)
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit message forensics
**Step 1.1 — Subject line**
Record: [drm/amdgpu] [Gate] Restrict debugfs MMIO register nodes when kernel lockdown is active
**Step 1.2 — Tags**
Record:
- Reviewed-by: Lijo Lazar <[email protected]> (AMD drm/amdgpu reviewer)
- Signed-off-by: Asad Kamal <[email protected]> (author)
- Signed-off-by: Alex Deucher <[email protected]> (amdgpu maintainer)
- No Fixes:, no Reported-by:, no Cc: stable (absence expected)
- No syzbot / CVE / bugzilla link
- Changelog notes: v2 suggested LOCKDOWN_DEBUGFS; v3 switched to skipping node creation under LOCKDOWN_PCI_ACCESS
**Step 1.3 — Body**
Record:
- **Bug:** amdgpu_regs, amdgpu_regs2, and related debugfs nodes allow arbitrary GPU MMIO via RREG32/WREG32 with no security_locked_down() check.
- **Symptom:** On lockdown=integrity (Secure Boot distros), this bypasses the same class of restriction as /dev/mem and PCI BAR sysfs.
- **Claimed fix:** Check LOCKDOWN_PCI_ACCESS on every MMIO debugfs handler.
- **Actual v3:** Do not create those nodes at init if lockdown is already active; log once.
- Body still describes v1 (per-handler checks). That is stale vs the committed patch.
**Step 1.4 — Hidden bug fix?**
Record: Not hidden. It is an explicit security-policy fix (lockdown bypass). The “gate/do not create” wording is the fix, not cleanup.
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record:
- File: drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
- +7 lines (include + 5-line early return)
- Function: amdgpu_debugfs_regs_init()
- Scope: single-file surgical change
**Step 2.2 — Code flow**
Record:
- **Before:** Probe always creates amdgpu_regs, amdgpu_regs2, amdgpu_regs_{didt,pcie,smc}, amdgpu_gprwave, amdgpu_wave, amdgpu_gpr, amdgpu_gca_config, amdgpu_sensors, amdgpu_gfxoff* under the DRM debugfs root, mode 0400.
- **After:** If security_locked_down(LOCKDOWN_PCI_ACCESS) is true at init, skip creation, log, return 0.
- Path: driver probe / debugfs init, not a hot path.
**Step 2.3 — Bug mechanism**
Record: **Security / lockdown bypass**, not UAF/leak/race.
Verified in fs/debugfs/file.c debugfs_locked_down():
- Files whose mode has only read bits (0400/0444), opened O_RDONLY, with no ioctl/mmap, are **allowed even under lockdown**.
- amdgpu_debugfs_regs_fops (and didt/pcie/smc) have .read/.write but **no** ioctl/mmap, so a read open is allowed.
- The read handler then does RREG32(). With bit 62/61 in the offset it also calls amdgpu_gfx_select_se_sh() / amdgpu_gfx_select_me_pipe_q(), which **write GPU index registers** as a side effect of a read.
- Writes through debugfs are already blocked: FMODE_WRITE fails the heuristic and LOCKDOWN_DEBUGFS denies the open.
- amdgpu_regs2 / amdgpu_gprwave have .unlocked_ioctl, so generic debugfs lockdown already blocks those; the hole is the plain MMIO read files.
This matches PCI BAR mmap (pci_mmap_resource() checks LOCKDOWN_PCI_ACCESS) and /dev/mem (LOCKDOWN_DEV_MEM). PCI config **reads** are not blocked; BAR/MMIO is.
**Step 2.4 — Fix quality**
Record:
- Obviously correct for the boot-time Secure Boot case (lockdown is already on before amdgpu probes).
- Incomplete if lockdown is raised later via /sys/kernel/security/lockdown after the driver loaded (init-time only). Lockdown is one-way and Secure Boot enables it at boot, so the common case is covered.
- Slightly broad: also skips sensors/gfxoff/gca_config, not only MMIO.
- Regression risk is low: only locked-down systems lose debugfs register nodes. UMR already warns when lockdown is not none.
- No new APIs or data structures.
---
## Phase 3: Git history
**Step 3.1 — Blame**
Record:
- amdgpu_debugfs_regs_init() introduced in 75758255dc0fae (Alex Deucher, 2017-12-14, “move debugfs functions to their own file”).
- Mode 0444 → 0400 in c0cfd2e652553 (2024-10-23); that only dropped world-read. 0400 still passes the debugfs lockdown read heuristic.
- The missing lockdown check is as old as the interface itself.
**Step 3.2 — Fixes: tag**
Record: None. Not applicable.
**Step 3.3 — Related file history**
Record: Recent debugfs work is additive (gfxoff, pagetable, sched masks). No prerequisite refactor. Standalone. v1 was per-handler checks; v3 is self-contained.
**Step 3.4 — Author**
Record: Asad Kamal is an AMD contributor (other amdgpu/pm fixes in this tree). Reviewed by Lijo Lazar; merged by Alex Deucher.
**Step 3.5 — Dependencies**
Record: Needs security_locked_down(), LOCKDOWN_PCI_ACCESS, drm_info(), amdgpu_debugfs_regs_init(). All exist in this tree. linux/security.h stub returns 0 when CONFIG_SECURITY is off. Can apply standalone.
---
## Phase 4: Mailing list / external
**Step 4.1 — Original discussion**
Record:
- b4 dig -c 17ac73b24006700f50972d37e297dec1f523c14a →
https://patch.msgid.link/[email protected]
- v1 2026-05-29 (per-handler LOCKDOWN_PCI_ACCESS)
- v2 2026-06-03 (Lijo: LOCKDOWN_DEBUGFS)
- v3 2026-06-03 (Lijo: skip creating nodes; log once) — this is what landed
- lore.kernel.org fetch returned 403; discussion read via mail- archive/search
**Step 4.2 — Recipients (b4 dig -w)**
Record: [email protected], Lijo Lazar, Hawking Zhang, Le Ma, Shiwu Zhang, Alex Deucher, Kevin Yang Wang, Tom StDenis. Right maintainers.
**Step 4.3 — Bug report**
Record: No external reporter/CVE. Author analysis plus list review. Nicolas Bouchinet (lockdown LSM, ANSSI) confirmed the read-path gap vs debugfs_locked_down(), then argued reads belong at **confidentiality**, not LOCKDOWN_PCI_ACCESS. Asad kept PCI_ACCESS by analogy to pci_mmap_resource() and /dev/mem. Patch still merged.
**Step 4.4 — Series**
Record: Standalone, not patch N/M. No follow-up on this file except unrelated gfxoff message IDs.
**Step 4.5 — Stable list**
Record: No lore.kernel.org/stable discussion found for this subject.
---
## Phase 5: Semantic / call graph
**Step 5.1 — Functions**
Record: amdgpu_debugfs_regs_init() only.
**Step 5.2 — Callers**
Record: amdgpu_debugfs_init() → amdgpu_debugfs_init() in amdgpu_drv.c (~2477) during device init. One probe-time path.
**Step 5.3 — Callees**
Record: security_locked_down(LOCKDOWN_PCI_ACCESS), drm_info(), then (if allowed) debugfs_create_file().
**Step 5.4 — Reachability**
Record: Needs CONFIG_DEBUG_FS, mounted debugfs, and a privileged open of 0400 nodes. Lockdown’s model is uid-0 vs ring-0, so root-only is the intended attacker. Distro Secure Boot kernels enable lockdown=integrity at boot.
**Step 5.5 — Similar patterns**
Record: Same hook in drivers/pci/pci-sysfs.c (mmap/write), drivers/pci/proc.c, drivers/cxl/core/mbox.c. No other drm driver in this tree uses it.
---
## Phase 6: This tree (6.18.y)
**Step 6.1 — Buggy code present?**
Record: **Yes.** This checkout is **6.18.53** (git describe HEAD → v6.18.53-5049-g0f0bdc2b0dffb, VERSION=6 PATCHLEVEL=18 SUBLEVEL=53).
- amdgpu_debugfs_regs_init() exists and (without this patch) creates MMIO nodes with no lockdown check.
- LOCKDOWN_PCI_ACCESS is in include/linux/security.h.
- Generic debugfs lockdown is in fs/debugfs/file.c.
- The hole is not something introduced after 6.18 branched.
**Step 6.2 — Backport difficulty**
Record: **Clean apply.** Parent context matches: no linux/security.h, same for loop and S_IFREG | 0400. User-supplied mainline context mentioned amdgpu_userq.h; that header is **not** required here.
**Step 6.3 — Related fixes already here?**
Record: No other lockdown check on these nodes besides this change. Generic debugfs lockdown does **not** cover amdgpu_regs reads.
---
## Phase 7: Subsystem context
**Step 7.1**
Record: drivers/gpu/drm/amd/amdgpu — **IMPORTANT** (very common GPU driver). Security impact is lockdown policy, not all users of amdgpu.
**Step 7.2**
Record: Actively developed, but this function dates to 2017. Mature interface, late lockdown hole.
---
## Phase 8: Impact and risk
**Step 8.1 — Who**
Record: AMD GPU systems with CONFIG_DEBUG_FS, debugfs mounted, and kernel lockdown (Secure Boot integrity is the usual distro case).
**Step 8.2 — Trigger**
Record: Root reads /sys/kernel/debug/dri/0/amdgpu_regs (or siblings) while lockdown=integrity. Not unprivileged. Timing-independent.
**Step 8.3 — Failure mode**
Record: **HIGH** security-policy bypass (not a panic). Arbitrary GPU MMIO read; bank-select path writes GRBM/SRBM. Same class of access lockdown blocks for PCI BAR mmap and /dev/mem.
**Step 8.4 — Risk/benefit**
Record:
- **Benefit:** Closes a real uid-0 lockdown hole on common Secure Boot + amdgpu boxes.
- **Risk:** Very low (7 lines, probe-only, no-op without lockdown). Worst case: debug/UMR register nodes missing under lockdown, which is intended.
- **Ratio:** Favorable.
---
## Phase 9: Synthesis
**Step 9.1 — Evidence**
**For:**
- Real lockdown bypass: debugfs heuristic allows read of 0400 MMIO files; handlers then RREG32 and can write index registers.
- Same restriction as PCI BAR mmap / /dev/mem.
- Small, obviously correct, maintainer-reviewed (Lijo + Alex).
- All symbols exist in 6.18.53; applies cleanly.
- Lockdown is an important production security feature (Secure Boot distros).
**Against:**
- Not a crash/UAF/corruption.
- debugfs + root.
- Init-time check misses lockdown enabled after probe.
- Disables some non-MMIO nodes in the same array.
- LSM reviewer preferred confidentiality-level for pure reads; commit message still describes v1.
- No CVE / no in-the-wild report.
**Unresolved:** Full last Nicolas reply after Asad kept PCI_ACCESS was not fetched (403 on lore). Does not change the code or that it was merged.
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — 7-line early return; UMR impact acked on list.
2. Real bug affecting users? **PASS** — lockdown bypass on Secure Boot + amdgpu + debugfs.
3. Important (crash/security/corruption/deadlock)? **PASS** — security policy hole (HIGH, not panic).
4. Small and contained? **PASS** — one file, +7.
5. No new features/APIs? **PASS** — restricts existing debugfs under existing lockdown.
6. Applies to this tree? **PASS** — 6.18.53 has the nodes, APIs, and matching context.
**Step 9.3 — Exception category**
Record: None (not a device ID/quirk/DT/build/docs fix). Qualifies as a security bug fix.
**Step 9.4 — Decision**
This should be backported to **this** 6.18.53 tree. The hole is in code that has been here for years, the APIs are present, and the patch is a minimal lockdown check at the existing init site. Residual limits (init- time vs open-time; slightly wide node list) are not reasons to keep the bypass on locked-down production kernels.
---
## What the commit solves for stable users
On kernels with lockdown=integrity (typical Secure Boot), generic debugfs still allows reading amdgpu_regs because mode 0400 looks “read-only.” That file is not a log; it is unmediated GPU BAR MMIO, including index-register writes on crafted reads. Stable users on locked-down distro kernels should not have that path.
## Risk vs benefit
Benefit is closing a lockdown hole for a widely used GPU driver. Risk is a probe-time skip of debugfs register nodes only when lockdown is already on.
## Concerns
- Does not re-check on each open if lockdown is enabled after probe.
- Commit text still talks about per-handler checks.
- Those do not block a clean backport to this tree.
---
## Verification
- [Phase 1] Parsed tags: Reviewed-by Lijo Lazar; SOB Asad Kamal + Alex Deucher; no Fixes/Reported-by/Cc:stable
- [Phase 1] Body vs v3: claimed per-handler checks; committed code is init-time skip
- [Phase 2] Diff: +#include <linux/security.h> and 5-line LOCKDOWN_PCI_ACCESS guard in amdgpu_debugfs_regs_init()
- [Phase 2] debugfs_locked_down() in fs/debugfs/file.c:267-283:
0400 + O_RDONLY + no ioctl allows open; writes blocked via FMODE_WRITE
- [Phase 2] amdgpu_debugfs_regs_fops has read/write, no ioctl; regs2/gprwave have unlocked_ioctl
- [Phase 2] Read path amdgpu_debugfs_process_reg_op(): RREG32; bank/ring bits call amdgpu_gfx_select_se_sh / amdgpu_gfx_select_me_pipe_q
- [Phase 2] pci_mmap_resource() and pci_write_resource_io() use LOCKDOWN_PCI_ACCESS; pci_read_config does not
- [Phase 3] git blame: amdgpu_debugfs_regs_init from 75758255dc0fae (2017); mode 0400 from c0cfd2e652553 (2024)
- [Phase 3] No Fixes: tag
- [Phase 3] Author has other amdgpu commits; no series dependency
- [Phase 4] b4 dig -c 17ac73b240067…: v1/v2/v3; landed v3 msgid [email protected]
- [Phase 4] b4 dig -w: amd-gfx + Deucher/Lijo/StDenis
- [Phase 4] mail-archive: Lijo R-b; StDenis UMR OK; Bouchinet read-path analysis + confidentiality debate
- [Phase 4] lore.kernel.org WebFetch: 403; stable search: no hits
- [Phase 5] Caller: amdgpu_debugfs_init() ← amdgpu_drv.c:2477 probe
- [Phase 6] git describe HEAD: v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion: 6.18.53
- [Phase 6] Parent of the change has the same loop/0400 and no security.h — clean apply
- [Phase 6] security_locked_down / LOCKDOWN_PCI_ACCESS / drm_info present; stub returns 0 without CONFIG_SECURITY
- [Phase 8] Failure: lockdown bypass, severity HIGH (security), not crash
- UNVERIFIED: complete last Bouchinet mail after Asad’s “keep PCI_ACCESS” reply (lore 403)
The fix is small, surgical, applies to this 6.18 tree, and closes a real kernel-lockdown bypass.
**YES**
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +7 -0
@@ -26,6 +26,7 @@#include <linux/kthread.h> #include <linux/pci.h> #include <linux/uaccess.h> +#include <linux/security.h> #include <linux/pm_runtime.h> #include "amdgpu.h"
@@ -1661,6 +1662,12 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)struct dentry *ent, *root = minor->debugfs_root;unsigned int i; +if (security_locked_down (LOCKDOWN_PCI_ACCESS )) { +drm_info (adev_to_drm (adev), +"amdgpu: HW debugfs nodes disabled (kernel lockdown)\n" ); +return 0 ; + } +for (i =0 ; i <ARRAY_SIZE (debugfs_regs); i++) { ent = debugfs_create_file(debugfs_regs_names[i], S_IFREG | 0400, root,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] drm/amdgpu: Gate debugfs MMIO access on kernel lockdown
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/amdgpu: init-only lockdown check in amdgpu_debugfs_regs_init() bypassed --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/amdgpu: init-only lockdown check in amdgpu_debugfs_regs_init() bypassed --
commit d191beaf95739f7c453353f0fddff9c76024a56e
Author: Asad Kamal <[email protected]>
drm/amdgpu: Gate debugfs MMIO access on kernel lockdown
This commit skips creating hardware register debugfs nodes in amdgpu_debugfs_regs_init() when kernel lockdown (LOCKDOWN_PCI_ACCESS) is active during initialization.
Quoted 28 lines
drm/amdgpu: Gate debugfs MMIO access on kernel lockdown
[ Upstream commit
17ac73b24006700f50972d37e297dec1f523c14a]
amdgpu_regs,amdgpu_regs2, and related debugfs nodes allow arbitrary MMIO read/write via RREG32/WREG32 without checkingsecurity_locked_down(). On kernel_lockdown=integrity systems this bypasses the same restrictions as/dev/memand PCI config space sysfs.Check
LOCKDOWN_PCI_ACCESS(matching pci-sysfs) at the entry of every debugfs handler that performs direct register access.v2: Use consistent check as per previous check to use
LOCKDOWN_DEBUGFS(Lijo)v3: Do not create any entry from
amdgpu_debugfs_regs_init()ifLOCKDOWN_PCI_ACCESSis active and log once. (Lijo)Signed-off-by Asad Kamal <[email protected]>Reviewed-by Lijo Lazar <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0
-0
[ ... ]
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) · line 1658
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +6
-0@@ -1646,6 +1647,12 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)struct dentry *ent, *root = minor->debugfs_root;unsigned int i; +if (security_locked_down (LOCKDOWN_PCI_ACCESS )) { +drm_info (adev_to_drm (adev), +"amdgpu: HW debugfs nodes disabled (kernel lockdown)\n" ); +return 0 ; + } +for (i =0 ; i <ARRAY_SIZE (debugfs_regs); i++) { ent = debugfs_create_file(debugfs_regs_names[i], S_IFREG | 0400, root,
[Severity: Medium]
Can this lockdown check be bypassed when kernel lockdown is enabled at runtime after the driver has already probed?
If amdgpu initializes before lockdown is enabled (for example, when built-in or loaded from initramfs) and userspace later enables integrity or confidentiality lockdown by writing to /sys/kernel/security/lockdown via lockdown_write() -> lock_kernel_down(), amdgpu_debugfs_regs_init() has already created the debugfs_regs files with mode 0400:
security/lockdown/lockdown.c:lockdown_write() {
...
if (label && !strcmp(state, label))
err = lock_kernel_down("securityfs", level);
...
}Because amdgpu_regs, amdgpu_regs_didt, amdgpu_regs_pcie, amdgpu_regs_smc, amdgpu_wave, and amdgpu_gpr have mode 0400 and their file_operations structs do not define .unlocked_ioctl, .compat_ioctl, or .mmap, opening them with O_RDONLY is permitted by debugfs_locked_down() without consulting security_locked_down(LOCKDOWN_DEBUGFS):
fs/debugfs/file.c:debugfs_locked_down() {
if ((inode->i_mode & 07777 & ~0444) == 0 &&
!(filp->f_mode & FMODE_WRITE) &&
(!real_fops ||
(!real_fops->unlocked_ioctl &&
!real_fops->compat_ioctl &&
!real_fops->mmap)))
return 0;
if (security_locked_down(LOCKDOWN_DEBUGFS))
return -EPERM;
return 0;
}Subsequent read() calls then reach amdgpu_debugfs_process_reg_op() and its sibling handlers with no security_locked_down(LOCKDOWN_PCI_ACCESS) check, allowing arbitrary RREG32() reads as well as MMIO writes to bank and index selection registers such as GRBM_GFX_INDEX via amdgpu_gfx_select_se_sh() and SRBM_GFX_CNTL via amdgpu_gfx_select_me_pipe_q(). In addition, any file descriptor opened O_RDWR before lockdown was activated retains unrestricted MMIO write and ioctl access (WREG32() / amdgpu_mm_wreg_mmio_rlc()) after lockdown is enabled.
Also, the commit message body still states:
"Check LOCKDOWN_PCI_ACCESS (matching pci-sysfs) at the entry of every
debugfs handler that performs direct register access."
Should security_locked_down(LOCKDOWN_PCI_ACCESS) also be checked in the debugfs file operations handlers (or should the commit message be updated to match the v3 implementation)?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 HID: quirks: Add ALWAYS_POLL quirk for Beitong BTP-KP20D dongle
In reply to Sasha LevinFrom: Aaron Ma <[email protected]>
[ Upstream commit bfff246b3a31cb45ec297ca5e2a77c1410b207ac ]
The BTP-KP20D dongle in Direct/HID mode (20dd:5159) re-enumerates every few seconds because usbhid never submits its interrupt-IN URB: no HID driver binds to the vendor-specific report descriptor, so the device is never opened, and the firmware treats the idle endpoint as a lost link.
Add HID_QUIRK_ALWAYS_POLL to keep the interrupt-IN URB submitted from probe time.
---
LLM Generated explanations, may be completely bogus:
This is a device-specific HID quirk for a gamepad dongle that constantly re-enumerates. The local tree is **5.15.221** (pending-5.15); HID_QUIRK_ALWAYS_POLL and the quirk table already exist here.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [HID] [Add] Add ALWAYS_POLL quirk for Beitong BTP-KP20D dongle (20dd:5159)
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Aaron Ma <[email protected]> (author)
- Signed-off-by: Jiri Kosina <[email protected]> (HID maintainer)
- 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
- Ignore any pipeline-added Sasha Levin SOB / Upstream commit markers
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: BTP-KP20D in Direct/HID mode (20dd:5159) re-enumerates every few seconds
- Symptom: USB disconnect/reconnect loop; the dongle is unusable
- Root cause: usbhid does not submit the interrupt-IN URB until the HID device is opened. Vendor-specific report descriptors do not produce a bound/opened input client, so the firmware treats the idle endpoint as a lost link
- Fix: HID_QUIRK_ALWAYS_POLL so the interrupt-IN URB is submitted from probe/start time
- No kernel-version range stated; this is hardware firmware behavior, not a regression in a specific kernel commit
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not a disguised cleanup. It is an explicit hardware quirk. The word “Add” is the normal form for quirk/ID table entries that still fix real devices.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- drivers/hid/hid-ids.h: +3 (USB_VENDOR_ID_BEITONG 0x20dd, USB_DEVICE_ID_BEITONG_KP20D 0x5159)
- drivers/hid/hid-quirks.c: +1 (hid_quirks[] entry with HID_QUIRK_ALWAYS_POLL)
- Functions: none; data-table only
- Scope: single-purpose, two-file, 4-line surgical addition
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: 20dd:5159 is a generic USB HID device with no special quirk. usbhid_start() does not submit urbin unless a client opens the device (usbhid_open)
- After: hid_lookup_quirk() returns HID_QUIRK_ALWAYS_POLL. usbhid_start() (called from hid_hw_start() during hid-generic probe) calls hid_start_in() immediately and leaves HID_IN_POLLING set so usbhid_close() does not kill the URB
- Path: probe/start of this one VID:PID, not a global HID change
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: Hardware workaround. Category (h). Firmware requires interrupt- IN polling to keep the USB link; the kernel only polls after open. ALWAYS_POLL is the existing mechanism for that class of devices (mice/keyboards/dongles that disconnect if not polled).
Step 2.4: ASSESS THE FIX QUALITY
Record: Obviously correct. Same pattern as many ALWAYS_POLL entries already in this tree (8BitDo Pro 3, Edifier QR30, Cooler Master MM712, ADATA XPG, PixArt mice, etc.). Regression risk is limited to VID 0x20dd / PID 0x5159: extra interrupt polling and remote-wakeup flag. That is the intended tradeoff and is cheaper than a reconnect loop. No API, locking, or structural change.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Insertion in hid-ids.h is between BAANTO (9ed326951806c4, 2012) and BELKIN (a11b3fab94d4fb, 2010)
- Insertion in hid-quirks.c is between ATEN_UC100KM and CHICONY_MULTI_TOUCH (d5d3e202753cc0, 2017)
- HID_QUIRK_ALWAYS_POLL is BIT(10) in include/linux/hid.h, present since 0b750b3baa2d6 (“HID: usbhid: add always-poll quirk”, 2014-09-08)
- usbhid_start()/usbhid_open()/usbhid_close() already implement ALWAYS_POLL in this checkout
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Not a regression in a specific commit; the device’s firmware misbehaves on the long-standing “poll only when opened” policy. The policy itself dates to 2014 and is in this 5.15 tree.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: This tree already contains many ALWAYS_POLL quirk backports, including:
- f9ad98cff302c HID: quirks: add HID_QUIRK_ALWAYS_POLL for 8BitDo Pro 3 (identical 4-line pattern)
- 16c2ca35257ed Edifier QR30
- 9727b5dc98c33 Cooler Master MM712 dongle
- 5c46ec760d3be ADATA XPG wireless mouse
No Beitong/BTP-KP20D/20dd:5159 history. Standalone, not patch N/M.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Aaron Ma has prior HID work in this tree (i2c-hid Raydium resume/IRQ, hid_report_len, LG MELF0410). HID maintainer Jiri Kosina applied the patch. Not a drive-by unknown-subsystem change.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: Depends only on HID_QUIRK_ALWAYS_POLL, hid_quirks[], hid_lookup_quirk(), and usbhid ALWAYS_POLL handling — all present. Can apply standalone.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- Message-ID: [email protected]
- b4 mbox retrieved a 2-message thread (lore.kernel.org HTTP 403, so b4 was used instead of WebFetch)
- v1 only; no v2/v3
- Recipients: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel
- Jiri Kosina: “Applied, thanks.” (2026-08-03). No NAK, no requested changes, no stable discussion in-thread
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: Sent to both HID maintainers (Jiri Kosina, Benjamin Tissoires). Applied by Jiri Kosina. No extra Reviewed-by tags; maintainer apply is the review signal.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No syzbot/bugzilla link. Description is a concrete hardware failure (re-enumerate every few seconds). No public multi-user bugzilla thread found.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Standalone [PATCH], not part of a series. No other Beitong HID patches in this tree.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable WebFetch returned 403. Web search found no stable-list discussion of this patch. That is consistent with a newly applied mainline quirk awaiting stable evaluation.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: No functions modified. Data consumed by hid_gets_squirk() / hid_lookup_quirk().
Step 5.2: TRACE CALLERS
Record:
- hid_lookup_quirk() is called from usbhid_parse() and hid_device_probe()
- hid-generic matches HID_ANY_ID and hid_generic_probe() calls hid_hw_start()
- hid_hw_start() -> usbhid_start() -> if ALWAYS_POLL: hid_start_in()
- usbhid_open()/usbhid_close() skip starting/stopping the in-URB when ALWAYS_POLL is set
- Context: USB device enumeration / HID probe, not a hot syscall path for other devices
Step 5.3: TRACE CALLEES
Record: The new table entry does not call anything. ALWAYS_POLL path uses usb_autopm_get_interface, hid_start_in, and sets needs_remote_wakeup — existing usbhid code.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Plugging in 20dd:5159 -> usbhid_probe -> hid_add_device -> hid- generic probe -> hid_hw_start -> usbhid_start. Userspace-reachable by inserting the dongle. Without the quirk the device resets every few seconds even if nothing opens it.
Note: the commit text says “no HID driver binds.” hid-generic still matches HID_ANY_ID; the precise failure is that the device is never opened, so urbin is never submitted. ALWAYS_POLL is still the correct existing fix for that.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Dozens of HID_QUIRK_ALWAYS_POLL entries already in drivers/hid/hid-quirks.c in this tree. Same bug class (dongle/mouse disconnects if interrupt-IN is idle).
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. usbhid still starts interrupt-IN only on open unless ALWAYS_POLL is set. 20dd:5159 is not in hid-ids.h or hid-quirks.c. USB vendor 0x20dd is not used as a HID ID here (only unrelated 0x20dd hits in qla2xxx debug ids, ralink USB product 0x0471:0x20dd, GPU register offsets). The firmware bug is independent of kernel version; 5.15 users with this dongle hit it.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Clean apply. Local hid-ids.h has BAANTO then BELKIN; local hid- quirks.c has ATEN_UC100KM then CHICONY_MULTI_TOUCH. No BEITONG symbols to conflict with. Expected difficulty: clean apply.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: No Beitong fix present. Generic ALWAYS_POLL infrastructure is present. No alternate workaround for 20dd:5159.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: HID / USB HID (drivers/hid). IMPORTANT for users of this controller; PERIPHERAL in the sense that only one VID:PID is affected. Not staging.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Mature and actively backported here (recent HID race/overflow fixes, plus ongoing quirk-ID additions). HID CORE maintainers: Jiri Kosina, Benjamin Tissoires.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Driver-specific / device-specific. Only USB 20dd:5159 (Beitong BTP-KP20D Direct/HID mode). No effect on other HID devices.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Trigger is plugging in the dongle in Direct/HID mode. Common for owners of that hardware; not a rare race. Unprivileged user can trigger it by using the device. Happens every few seconds until unplugged.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record: Repeated USB re-enumeration; device unusable; USB reconnect noise. Not a kernel oops/UAF. Severity MEDIUM-HIGH for affected users (hardware does not work), LOW blast radius.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: makes this dongle usable on 5.15; same class of quirks already shipped in this tree
- Risk: very low (4 lines, one VID:PID, existing quirk bit)
- Ratio: strongly favorable
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real hardware failure: reconnect loop every few seconds
- Established HID_QUIRK_ALWAYS_POLL mechanism, present since 2014 in this tree
- Textbook stable exception: hardware quirk / device ID on an existing driver
- 4-line table addition, no APIs, no refactor
- Applies cleanly to 5.15.221
- HID maintainer applied it
- Identical ALWAYS_POLL ID additions (e.g. 8BitDo Pro 3) already live in this tree
AGAINST:
- Affects one gamepad dongle, not a core crash
- No syzbot/CVE/multi-user bugzilla trail
- Commit message slightly overstates “no HID driver binds”
UNRESOLVED:
- Could not HTTP-fetch lore.kernel.org (403); thread recovered via b4 mbox
- Could not query lore.kernel.org/stable (403); no evidence of an explicit stable NAK
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? PASS — table entry using existing quirk; maintainer applied
2. Fixes a real bug that affects users? PASS — dongle re-enumerates and is unusable
3. Important issue? PASS — hardware-unusable reconnect loop (quirk exception; not a kernel panic)
4. Small and contained? PASS — 4 lines, two files
5. No new features or APIs? PASS — no new Kconfig, sysfs, or userspace ABI; quirk bit already exists
6. Can apply to the local tree? PASS — insertion context present; ALWAYS_POLL implemented
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: Hardware quirk/workaround plus device ID addition to an existing driver. Both are automatic-qualify exceptions in the stable rules given above.
Step 9.4: MAKE YOUR DECISION
Backport. The local 5.15 tree already has the ALWAYS_POLL machinery and routinely takes this exact class of HID quirk. The patch is the minimal, device-scoped fix for a dongle that otherwise cannot stay on the bus.
===============================================================
What the commit solves for stable users
===============================================================
On 5.15, usbhid still submits the interrupt-IN URB only when a HID client opens the device. The BTP-KP20D firmware treats an idle interrupt endpoint as a lost link and resets, so Direct/HID mode never stays enumerated. HID_QUIRK_ALWAYS_POLL already starts that URB in usbhid_start(); this commit only names 20dd:5159 so that path runs. That is the same fix already used here for 8BitDo, Edifier, Cooler Master, and many PixArt mice.
Risk vs benefit: benefit is a working controller for anyone on this LTS tree with that dongle; risk is polling one extra interrupt endpoint on that VID:PID only.
Concerns: none material. No missing prerequisites. No backport rewrite needed.
===============================================================
Verification
===============================================================
- [Phase 1] Parsed subject/tags: Add ALWAYS_POLL; SOBs Aaron Ma + Jiri Kosina; no Fixes/Reported-by/Cc: stable
- [Phase 2] Diff: +3 hid-ids.h, +1 hid-quirks.c; no function bodies
- [Phase 2] Local usbhid_start() at hid-core.c:1183 already implements ALWAYS_POLL via hid_start_in()
- [Phase 3] git describe HEAD / make kernelversion:
p-5.15-2-g9a29d9b0f9507, 5.15.221, branch pending-5.15
- [Phase 3] git blame include/linux/hid.h:373: HID_QUIRK_ALWAYS_POLL BIT(10) present
- [Phase 3] git log -S HID_QUIRK_ALWAYS_POLL -- drivers/hid/usbhid/hid- core.c include/linux/hid.h: introduced by 0b750b3baa2d6 (2014)
- [Phase 3] git grep USB_VENDOR_ID_BEITONG / BTP-KP20D: absent in this tree
- [Phase 3] git grep 0x20dd: no HID vendor collision
- [Phase 3] Precedent already in this tree: f9ad98cff302c (8BitDo ALWAYS_POLL, same 4-line shape)
- [Phase 4] b4 mbox [email protected]: 2 messages, v1 only, Jiri “Applied, thanks.”
- [Phase 4] WebFetch lore.kernel.org: 403; used b4 instead
- [Phase 5] Call chain: hid_lookup_quirk -> hid-generic_probe -> hid_hw_start -> usbhid_start
- [Phase 6] Insertion points exist: hid-ids.h BAANTO then BELKIN; hid- quirks.c ATEN_UC100KM then CHICONY_MULTI_TOUCH
- [Phase 7] MAINTAINERS: HID CORE LAYER, Jiri Kosina / Benjamin Tissoires
- [Phase 8] Failure mode: USB re-enumeration loop, device-specific, severity MEDIUM-HIGH for that hardware
- UNVERIFIED: stable@ mailing-list archive (lore 403); no evidence this was rejected for stable
**YES**
drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -262,6 +262,9 @@#define USB_VENDOR_ID_BAANTO 0x2453#define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 +#define USB_VENDOR_ID_BEITONG 0x20dd +#define USB_DEVICE_ID_BEITONG_KP20D 0x5159 +#define USB_VENDOR_ID_BELKIN 0x050d#define USB_DEVICE_ID_FLIP_KVM 0x3201
drivers/hid/hid-quirks.c +1 -0
@@ -45,6 +45,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_BEITONG, USB_DEVICE_ID_BEITONG_KP20D), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL },
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 usb: misc: cypress_cy7c63: check result of IO
In reply to Sasha LevinFrom: Oliver Neukum <[email protected]>
[ Upstream commit 0673b919e0933541ae56bb3f0253853f696d3773 ]
If the device returns a bogus short read, treat it as EIO. Actually check for IO errors.
---
LLM Generated explanations, may be completely bogus:
The local tree is mainline **7.3.0-rc4** (v7.3-rc4-27-gf0100363d8c37). The Cypress driver and the incomplete short-transfer check are present here; the follow-up I/O-error handling is a real, small correctness fix.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: **[usb/misc/cypress_cy7c63] [check] check result of IO**
- Subsystem: usb: misc: cypress_cy7c63
- Verb: “check” — correctness / missing return-value handling, not a refactor
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Oliver Neukum <[email protected]> (author; known USB developer)
- `Link:
https://patch.msgid.link/[email protected]`
- Signed-off-by: Greg Kroah-Hartman <[email protected]> (USB maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: stable (absence of the last two is expected for this review)
- Not syzbot, not a user crash report
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: a short USB control read is not treated as failure; I/O errors are not checked on the sysfs read path
- Symptom: userspace can see a successful sysfs write, or a stale port value on sysfs read, after a failed/short transfer
- Root cause: usb_control_msg() may return 0/1 (short success) or a negative errno; vendor_command() used to return those short lengths as success, and read_port() never tested the result
- No version range given
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not hidden. The subject and body state the bug. It completes the earlier short-transfer check (49cd2f4d747ee, which *was* `CC:
stable`).
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: drivers/usb/misc/cypress_cy7c63.c — **+6 / −2** (8 lines in the diff)
- Functions: vendor_command(), read_port()
- Scope: single-file surgical fix
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
1. vendor_command(): after usb_control_msg(), if (retval < 2) goto err_buf already skipped storing iobuf[1], but still returned 0 or 1. Now a non-negative short result becomes -EIO.
2. read_port(): used to sprintf() cyp->port[port_num] even when vendor_command() failed. Now result < 0 is returned to sysfs.
write_port() already did return result < 0 ? result : count, so the -EIO conversion is what makes short writes fail instead of reporting count.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record:
- Category: **logic / correctness** (USB I/O result handling; short transfer → -EIO)
- Mechanism: usb_control_msg() returns transferred byte count on success (kernel-doc in drivers/usb/core/message.c). A 0- or 1-byte IN was treated as success. read_port() ignored errors and returned the last cached port byte (or 0).
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct and the usual USB pattern (same shape as other short-control-msg fixes)
- Minimal; no API/lock/structure changes
- Regression risk: **very low** (error path only; successful ≥2-byte transfers unchanged)
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Driver added **2006-06-22**, 9189bfc2df0fd (Oliver Bock)
- Short-transfer skip: **2024-09-12**, 49cd2f4d747ee (Oliver Neukum), contained in v6.12-rc1, **CC: [email protected]**
- read_port() never checked result from 2006 until this commit
- This follow-up: 0673b919e0933 (2026-07-10 / applied 2026-07-17)
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. Related buggy/incomplete commit is 49cd2f4d747ee, which **is** an ancestor of this HEAD (git merge-base --is-ancestor exit 0). That patch stopped using a short buffer but still returned a positive short length.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record: Recent file history is this I/O-check pair plus unrelated alloc/ref cleanups. Standalone follow-up to 49cd2f4d747ee, not patch 2/N of a larger series. No later commits on this file after 0673b919e0933.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: Oliver Neukum is a regular USB contributor; he wrote both Cypress I/O checks. Other drivers/usb/misc/ work is race/error handling in iowarrior/yurex/chaoskey. USB subsystem maintainer who applied this is Greg Kroah-Hartman.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record: Depends on the if (retval < 2) goto err_buf block from 49cd2f4d747ee. That commit is in this tree. The patch applies as a small edit of that check plus two lines in read_port(). Standalone on this tree.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c 0673b919e0933 →
https://patch.msgid.link/[email protected]
- b4 dig -a: single **v1**, 2026-07-10; no v2/v3
- Saved mbox: **one message** (the patch). No replies, no NAK, no reviewer Cc: stable
- Direct lore fetch returned HTTP 403; discussion is from the mbox instead
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record (b4 dig -w): To/Cc included Greg Kroah-Hartman, linux-usb, Johan Hovold ([email protected]), Kees Cook, original driver contacts. No on-list review comments; Greg applied it.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No Reported-by / bugzilla / syzbot. Author-driven completeness of the 2024 short-transfer fix.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Same-week USB work by the author is unrelated (`USB: core:
ratelimit cabling message). Related historical patch is 49cd2f4d747ee` only.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable search was not readable (403). Unverified whether stable@ already discussed this SHA. The 2024 sibling *was* explicitly nominated for stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS
Record: vendor_command(), read_port() (callers of the latter:port0_show / port1_show). write_port() is not edited but consumes the new -EIO.
Step 5.2: TRACE CALLERS
Record:
- vendor_command() ← write_port() (sysfs store port0/port1), read_port() (sysfs show)
- read_port() ← port0_show, port1_show
- Context: process / sysfs, not IRQ. Reachable from userspace on a bound device.
Step 5.3: TRACE CALLEES
Record: kzalloc, usb_rcvctrlpipe, usb_control_msg, kfree; read_port also sprintf. Control pipeline 0, vendor IN, 8-byte max.
Step 5.4: FOLLOW THE CALL CHAIN
Record: userspace cat/echo on sysfs port0/port1 → show/store → vendor_command → usb_control_msg. Yes, userspace-reachable. Requires CONFIG_USB_CYPRESS_CY7C63 and device 0x0a2c:0x0008.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Same short-read → -EIO pattern used elsewhere in USB (e.g. historical legousbtower get-version check). This driver had the length check without converting short success to an error.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record: Yes. File and functions exist; driver since 2006. Incomplete retval < 2 path from 49cd2f4d747ee is an ancestor. git merge-base --is-ancestor 0673b919e0933 HEAD is true (the candidate is already in this mainline checkout). Pre-fix behavior is confirmed via git show 0673b919e0933^:drivers/usb/misc/cypress_cy7c63.c.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: **Clean apply** on this tree (already applied). Context matches a typical stable driver file aside from unrelated later kzalloc_obj in probe.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: 49cd2f4d747ee is here; it is incomplete without this commit. No other equivalent error-propagation fix.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: **USB misc driver** (drivers/usb/misc/cypress_cy7c63.c), CONFIG_USB_CYPRESS_CY7C63. Criticality: **PERIPHERAL** (AK Modul-Bus CY7C63xxx I/O). USB core is not changed.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: File is mature/low-churn (2006 driver; occasional USB-wide cleanups). USB misc as a whole is actively maintained by Greg KH.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: **Driver-specific / config-specific** — only users of this Cypress device with the driver enabled.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Trigger is a failed or short vendor control IN while reading/writing sysfs ports (disconnect, stall, timeout, non-compliant firmware). Unprivileged users who can open the sysfs attrs of that device can hit it. Not a boot-critical path.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record:
- Failure: sysfs read returns stale/zero port data; sysfs write can return success on a short IN
- Not oops/UAF/deadlock
- Severity: **MEDIUM** — wrong userspace-visible I/O / false success, not kernel memory unsafety (buffer is kzalloc’d; 49cd2f4d747ee already skipped storing a short payload)
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: medium for this hardware (correct errors instead of silent wrong GPIO-like values); low globally
- Risk: **very low** (6 lines, error paths only)
- Ratio: favorable — small completion of a prior stable-nominated fix
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real I/O-error bug: short usb_control_msg success (0/1) and ignored negative results on read
- write_port() already treats any non-negative result as success — without -EIO, a short transfer is a false success
- Completes 49cd2f4d747ee, which went to stable with CC: stable
- Tiny (+6/−2), obviously correct, standard USB pattern
- Code has existed since 2006; prerequisite is in this tree
- Authored by a USB regular, applied by the USB maintainer
AGAINST:
- Niche driver, no user/syzbot report
- Not a crash, UAF, or security hole
- Author did not Cc: stable this time (not a veto per the rules above)
UNRESOLVED:
- lore HTTP 403; no on-list review text beyond the v1 patch
- Whether stable@ already queued this SHA
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — matches usb_control_msg semantics; applied by Greg KH
2. Fixes a real bug that affects users? **PASS** — sysfs can report success/stale port data after failed USB I/O
3. Important issue? **PASS** (medium) — incorrect device I/O / false success, in the “oh, that's not good” class; not a panic
4. Small and contained? **PASS** — 6 insertions, one file
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — prerequisite and target code are here
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: None (not an ID/quirk/DT/build/docs exception). It is a normal small driver bugfix.
Step 9.4: MAKE YOUR DECISION
This should be backported. The 2024 short-transfer patch left callers treating a short IN as success and left read_port() returning cached data on any error. That is user-visible wrong I/O on a long-lived driver, the fix is six lines, and the only dependency is already in this tree.
What it solves for stable users: failed or truncated vendor control transfers no longer look like a successful port read/write.
Risk vs benefit: very low risk, clear correctness gain on the error path.
Concerns: niche hardware; no crash. That does not outweigh completing an incomplete stable fix with a trivial, standard -EIO conversion.
Verification:
- [Phase 1] Parsed tags: Oliver Neukum SOB, Greg KH SOB, msgid Link; no Fixes/Reported-by/Cc:stable
- [Phase 1] Body: short read → EIO; actually check I/O errors
- [Phase 2] Diff: vendor_command maps 0 <= retval < 2 to -EIO; read_port returns result if < 0
- [Phase 2] Confirmed write_port uses result < 0 ? result : count (pre-patch parent file)
- [Phase 3] git describe HEAD / make kernelversion: **v7.3-rc4 / 7.3.0-rc4**
- [Phase 3] git merge-base --is-ancestor 0673b919e0933 HEAD: yes (commit already in this tree)
- [Phase 3] blame: driver 2006 (9189bfc2df0fd); short check 2024 (49cd2f4d747ee, CC:stable, v6.12-rc1)
- [Phase 3] git show 49cd2f4d747ee: added if (retval < 2) goto err_buf without -EIO
- [Phase 3] git merge-base --is-ancestor 49cd2f4d747ee HEAD: yes
- [Phase 3] git log --oneline -20 -- drivers/usb/misc/cypress_cy7c63.c: this commit is latest on the file
- [Phase 4] b4 dig -c/-a/-w/-m: v1 only; recipients gregkh, linux-usb, johan, kees; mbox has no replies
- [Phase 4] WebFetch lore/msgid: 403 — discussion taken from b4 mbox
- [Phase 5] Callers: only write_port/read_port sysfs paths in this file (rg vendor_command)
- [Phase 5] usb_control_msg kernel-doc: success = byte count, else negative errno
- [Phase 6] Pre-image of 0673b919e0933^ matches the submitted hunk context
- [Phase 7] Kconfig USB_CYPRESS_CY7C63; MAINTAINERS USB SUBSYSTEM → Greg KH
- [Phase 8] Failure mode: stale sysfs port value / false write success, not oops
- UNVERIFIED: stable@ mailing-list archive (HTTP 403)
**YES**
drivers/usb/misc/cypress_cy7c63.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/misc/cypress_cy7c63.c +6 -2
@@ -89,8 +89,11 @@ static int vendor_command(struct cypress *dev, unsigned char request, address, data, iobuf,CYPRESS_MAX_REQSIZE , USB_CTRL_GET_TIMEOUT);/* we must not process garbage */ -if (retval <2 ) +if (retval <2 ) { +if (retval >=0 ) + retval = -EIO ; goto err_buf; + }/* store returned data (more READs to be added) */ switch (request) {
@@ -175,8 +178,9 @@ static ssize_t read_port(struct device *dev, struct device_attribute *attr,dev_dbg (&cyp->udev->dev,"READ_PORT%d called\n" , port_num); result =vendor_command (cyp,CYPRESS_READ_PORT , read_id,0 ); -dev_dbg (&cyp->udev->dev,"Result of vendor_command: %d\n\n" , result); +if (result <0 ) +return result;return sprintf (buf,"%d" , cyp->port[port_num]); }
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] usb: misc: cypress_cy7c63: check result of IO
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines
From: Oliver Neukum <[email protected]>
[ Upstream commit
0673b919e0933541ae56bb3f0253853f696d3773]If the device returns a bogus short read, treat it as EIO. Actually check for IO errors.
Signed-off-by Oliver Neukum <[email protected]>Signed-off-by Greg Kroah-Hartman <[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 media: v4l2-tpg: reduce stack usage for kasan builds
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c49cdaafa443ccf861a72d3191121294742c28c7 ]
tpg_fill_plane_buffer() is a rather complex function. While there is nothing wrong with it per se, I have run into corner cases with clang-22 on s390 using KASAN that makes it run out of registers and blow the stack warning limit from excessive spills:
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2629:6: error: stack frame size (1560) exceeds limit (1536)
in 'tpg_fill_plane_buffer' [-Werror,-Wframe-larger-than]
2629 | void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
Forcing the two largest callees out of line completely avoids the problem and prevents all the register spills, with the stack usage for each function going down to a few bytes for the local variables.
Arguably this is a problem caused by clang rather than the code, but a noinline_for_stack annotation is an easy workaround.
---
LLM Generated explanations, may be completely bogus:
I have enough history, diff, and mailing-list evidence to walk through all nine phases and decide for this 7.3-rc4 tree.
## Phase 1: Commit message forensics
**Step 1.1: Subject line**
- Record: [media/v4l2-tpg] [reduce] Reduce stack usage of tpg_fill_plane_buffer() for clang+KASAN builds so -Wframe-larger-than does not fail the build.
**Step 1.2: Tags**
- Record:
- Signed-off-by: Arnd Bergmann <[email protected]> (author)
- Signed-off-by: Hans Verkuil <[email protected]> (media maintainer)
- No Fixes:
- No Reported-by: / Tested-by: / Reviewed-by: / Acked-by: /
`Link:` / `Cc: stable`
- Absence of Fixes: / Cc: stable is expected for this pipeline and is not a negative signal
- Notable: author is Arnd Bergmann (kbuild/clang/stack-usage); applied by Hans Verkuil (V4L2 maintainer). No syzbot, no user crash reports.
**Step 1.3: Body**
- Record:
- **Bug:** tpg_fill_plane_buffer() is large; clang-22 on s390 with KASAN spills so many temporaries that the compile-time stack-frame warning fires as an error.
- **Symptom:** error: stack frame size (1560) exceeds limit (1536) in 'tpg_fill_plane_buffer' [-Werror,-Wframe-larger-than]
- **Root cause:** clang register allocator + KASAN instrumentation, not incorrect C logic. Author: “nothing wrong with it per se” / “a problem caused by clang rather than the code”.
- **Fix:** noinline_for_stack on the two largest callees so they are not inlined into the parent; per-function stack then drops to a few bytes.
- **Version info:** clang-22, s390, KASAN. No kernel-version range given.
**Step 1.4: Hidden bug fix?**
- Record: Not a disguised UAF/leak/race. It is a **build-failure workaround**. Cover letter in the mbox also offers an LLVM bug if reviewers want one. Not a hidden runtime fix.
## Phase 2: Diff analysis
**Step 2.1: Inventory**
- Record:
- File: drivers/media/common/v4l2-tpg/v4l2-tpg-core.c — 8 insertions, 6 deletions (net +2)
- Functions: tpg_fill_plane_extras(), tpg_fill_plane_pattern() — declaration only
- Scope: single-file surgical annotation change; no logic, locking, or API change
**Step 2.2: Code flow**
- Record:
- **Before:** both helpers are static void, so the compiler may inline them into tpg_fill_plane_buffer().
- **After:** both are static noinline_for_stack void; they remain callable from the same loop in tpg_fill_plane_buffer() (lines 2707–2710) but cannot be inlined.
- Path affected: compile-time inlining of the per-line fill helpers. Runtime control flow is unchanged.
**Step 2.3: Bug mechanism**
- Record: **Build / compiler-workaround (hardware-workaround analogue).** Not UAF, leak, race, NULL deref, or overflow. noinline_for_stack is noinline in include/linux/compiler_types.h “to prevent stack consumption”.
**Step 2.4: Fix quality**
- Record: Obviously correct and minimal. Regression risk is very low:
extra calls in a test-pattern generator, not a production hot path. Arnd reports stack usage of each function drops. No public API / struct / locking change.
## Phase 3: Git history
**Step 3.1: Blame**
- Record: The two functions date to Hans Verkuil’s vivid TPG (2015), exported as drivers/media/common/v4l2-tpg/v4l2-tpg-core.c in e07d46e7e0da8 (2016). The noinline_for_stack lines are this commit (c49cdaafa443c, 2026-06-18 / applied 2026-07-10). Long-lived code; the warning is from clang-22+KASAN inlining, not a new logic bug.
**Step 3.2: Fixes: tag**
- Record: None. Not applicable.
**Step 3.3: File history**
- Record: Recent TPG work is formats/patterns (5a3757801e58a, 5a531791edb24), a div-by-zero fix, memleak fix. No prerequisite refactor. Standalone, not N/M.
**Step 3.4: Author**
- Record: Arnd Bergmann; many similar media stack-usage fixes (c03b7dec3c4dd rkvdec, 1a03f91c2c241 vivid clang stack, ad4729225d93f mxl5005s, etc.). This is the established noinline_for_stack pattern. Hans Verkuil applied it.
**Step 3.5: Dependencies**
- Record: Only noinline_for_stack, present in this tree as #define noinline_for_stack noinline. Applies standalone.
## Phase 4: Mailing list / external
**Step 4.1: Original discussion**
- Record:
- b4 dig -c c49cdaafa443c →
https://patch.msgid.link/[email protected] - `b4 dig -a`: **v1 only**, 2026-06-18. No later revision. - mbox is the patch plus: “If anyone thinks we should track this as an llvm bug, I can help come up with a reproducer”. **No replies, no NAK, no Cc: stable suggestion.** - lore.kernel.org WebFetch returned 403; thread recovered via `b4 dig -m`.
**Step 4.2: Recipients (b4 dig -w)**
- Record: Mauro Chehab, Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt, linux-media, LKML, [email protected]. Right maintainers and LLVM list. No review tags in-tree beyond Hans’s SOB on apply.
**Step 4.3: Bug report**
- Record: No syzbot/bugzilla. The “report” is Arnd’s own clang-22 s390 KASAN build. Severity: compile error under -Werror, not a runtime crash.
**Step 4.4: Series**
- Record: Standalone v1. Not part of a multi-patch series.
**Step 4.5: Stable list**
- Record: lore.kernel.org/stable WebFetch 403. **UNVERIFIED:** whether this was discussed on stable@. Nothing in the mbox nominates it.
## Phase 5: Semantic / call graph
**Step 5.1: Functions**
- Record: tpg_fill_plane_extras, tpg_fill_plane_pattern (annotations). Indirectly tpg_fill_plane_buffer (the function named in the warning).
**Step 5.2: Callers**
- Record: Both helpers are static and only called from tpg_fill_plane_buffer(). That function is EXPORT_SYMBOL_GPL and called from:
- tpg_fillbuffer() (same file)
- drivers/media/test-drivers/vivid/vivid-kthread-cap.c
- drivers/media/test-drivers/vimc/vimc-sensor.c
- drivers/media/test-drivers/visl/visl-dec.c
- Userspace-reachable only if a **virtual V4L2 test driver** (vivid/vimc/visl) is loaded. Not IRQ/core.
**Step 5.3: Callees**
- Record: memcpy of pattern lines, rectangle/pillar drawing, pixel- format switches. No locks, no alloc in the changed signatures.
**Step 5.4: Reachability**
- Record: Yes from userspace via vivid/vimc/visl, but those Kconfigs say “When in doubt, say N.” The failure being fixed is **compile-time**, so it hits anyone who *builds* VIDEO_V4L2_TPG (selected by those drivers; allmodconfig will build it).
**Step 5.5: Similar patterns**
- Record: Same noinline_for_stack workaround exists elsewhere in media (vivid 2019, rkvdec 2026). This instance is the TPG core helper, not a duplicate of those.
## Phase 6: This checkout
**Step 6.1: Local tree and buggy code**
- Record:
- git describe HEAD → v7.3-rc4-27-gf0100363d8c37
- make kernelversion → 7.3.0-rc4
- Makefile: VERSION=7 PATCHLEVEL=3 SUBLEVEL=0 EXTRAVERSION=-rc4
- File and functions exist. Pre-patch form was `static void
tpg_fill_plane_*`. TPG present since 2016 (`e07d46e7e0da8` is an
ancestor). - git merge-base --is-ancestor c49cdaafa443c HEAD is true (commit is in this development tree). That is **not** treated as “already selected for stable”.
**Step 6.2: Backport difficulty**
- Record: Clean apply on this tree. Only the two static void prototypes change. noinline_for_stack exists.
**Step 6.3: Related fixes already here**
- Record: No earlier equivalent TPG stack workaround. 1a03f91c2c241 is a similar vivid kthread workaround from 2019, different file/function.
## Phase 7: Subsystem context
**Step 7.1**
- Record: Subsystem drivers/media/common/v4l2-tpg (V4L2 test pattern generator). **PERIPHERAL** — only vivid/vimc/visl test drivers. Not mm/fs/net core.
**Step 7.2**
- Record: Mature (2015–2016), occasional format additions. Not a high- churn core path.
## Phase 8: Impact and risk
**Step 8.1: Who is affected**
- Record: Config-specific: CONFIG_VIDEO_V4L2_TPG via vivid/vimc/visl, plus clang-22, KASAN, -Werror, and CONFIG_FRAME_WARN=1536 (error text). Default 64-bit FRAME_WARN is **2048** (lib/Kconfig.debug); 1560 < 2048, so **default s390 64-bit allmodconfig would not fail**. 1536 is the 32-bit Xtensa default, or a non-default int in randconfig/custom CI.
**Step 8.2: Trigger**
- Record: Building that file with that toolchain/config. Not a runtime trigger. Unprivileged users cannot “hit” it except as a failed kernel build.
**Step 8.3: Failure mode**
- Record: Compile error under -Werror (WERROR defaults to COMPILE_TEST). Runtime stack on s390 is 16KiB, 64KiB with KASAN (arch/s390/Makefile); 1560 bytes is not a runtime overflow.
Severity: **MEDIUM for CI/debug builds with a lowered FRAME_WARN; LOW for production stable users.**
**Step 8.4: Risk-benefit**
- Record:
- Benefit: unblocks clang+KASAN+Werror builds of TPG/vivid; tiny annotation.
- Risk: very low (2 annotations, no behavior change).
- Ratio: favorable **if** treated as a build fix; modest user benefit because the default 64-bit limit is 2048.
## Phase 9: Synthesis
**Step 9.1: Evidence**
FOR:
- Official stable-kernel-rules.rst lists **build error** (not CONFIG_BROKEN).
- Build-fix exception in the evaluation rubric.
- 8/6-line, obviously correct noinline_for_stack — the kernel’s standard answer to clang+KASAN frame-size errors.
- Author Arnd Bergmann; applied by Hans Verkuil; LLVM Linux people on Cc.
- Helpers and macro exist in this 7.3-rc4 tree; applies cleanly; no series deps.
- Similar media workarounds have been used for years.
AGAINST:
- Not a crash, UAF, deadlock, corruption, or security bug.
- Author: clang problem, not a logic bug.
- Only vivid/vimc/visl (test drivers, “When in doubt, say N”).
- Reproduced with FRAME_WARN **1536**; 64-bit default is **2048**, so typical s390 KASAN allmodconfig may not fail.
- clang-22 + s390 + KASAN is a narrow toolchain.
- No stable nomination, no user reports, v1 with no review discussion.
UNRESOLVED:
- Whether default FRAME_WARN=2048 allmodconfig on this tree fails with clang-22+KASAN (reported size 1560 suggests no).
- Whether 32-bit clang+KASAN exceeds the 1280 default (not claimed; unverified).
- Whether stable@ ever discussed this (lore 403).
**Step 9.2: Stable rules checklist**
1. Obviously correct and tested? **PASS** — two noinline_for_stack marks; Arnd built it; maintainer applied v1.
2. Real bug that affects users? **PASS** as a **build error** for the configs that hit it; **weak** for production runtime users.
3. Important (crash/security/corruption/deadlock)? **PASS only via the documented build-error clause**, not via runtime severity. Frame 1560 vs 1536 is a warning-as-error, not an oops.
4. Small and contained? **PASS** — one file, ~14-line diff, well under 100 lines.
5. No new features/APIs? **PASS**
6. Can apply to this tree? **PASS** — file, functions, and noinline_for_stack are all here.
**Step 9.3: Exception category**
- Record: **Build fix** (compilation error/warning under -Werror). Not a device-ID, quirk, DT, or docs exception.
**Step 9.4: Decision**
This tree is **Linux 7.3-rc4** (mainline). The TPG helpers are present; the patch is self-contained and matches the code here.
It is not a runtime stability fix. It is the documented class of **build error** that stable rules allow: clang-22 + KASAN inlines two large static helpers into tpg_fill_plane_buffer() until -Wframe-larger- than fails with -Werror. The change is two noinline_for_stack annotations, no semantic change, negligible regression risk.
That is enough for this tree: the affected code exists, the workaround is the usual one, and blocking KASAN/clang builds of VIDEO_V4L2_TPG is a real compile failure even though vivid is a test driver.
## What the commit solves for this tree
tpg_fill_plane_buffer() grows a 1560-byte frame when clang-22+KASAN inlines tpg_fill_plane_extras() and tpg_fill_plane_pattern(). With CONFIG_FRAME_WARN=1536 and CONFIG_WERROR, the build dies. Forcing those callees out of line removes the spill storm. Stable users who build this kernel with clang+KASAN+Werror (CI, debug kernels) need that to compile; production runtime behavior is unchanged.
## Risk vs benefit
Benefit is restoring those builds; risk is two extra calls in a test- pattern path. The FRAME_WARN=1536 vs default 2048 gap means default 64-bit configs may already pass, but the official build-error rule still covers the failure Arnd hit, and the patch is too small to justify withholding it.
## Verification
- [Phase 1] Parsed message/tags: Arnd + Hans SOB only; no Fixes/Reported-by/Link/Cc:stable
- [Phase 2] git show c49cdaafa443c --stat: 1 file, +8/-6; only two function signatures
- [Phase 2] Read v4l2-tpg-core.c ~2350–2712: loop still calls both helpers; no logic change
- [Phase 2] noinline_for_stack is #define noinline in include/linux/compiler_types.h:264
- [Phase 3] git blame on the annotations: c49cdaafa443c; older static void from 2015 vivid TPG
- [Phase 3] Origin e07d46e7e0da8 (2016) is an ancestor of HEAD
- [Phase 3] No Fixes: tag to follow
- [Phase 3] git log --oneline -20 -- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c: no prerequisite series
- [Phase 4] b4 dig -c c49cdaafa443c: lore msgid [email protected]
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] b4 dig -w: media + LLVM maintainers Cc’d
- [Phase 4] b4 dig -m /tmp/tpg-thread.mbox: patch + LLVM-bug offer; no replies
- [Phase 4] WebFetch lore/stable: 403 — UNVERIFIED stable-list history
- [Phase 5] git grep tpg_fill_plane_buffer: vivid, vimc, visl only
- [Phase 5] No semcode MCP; used grep/read
- [Phase 6] git describe HEAD / make kernelversion: v7.3-rc4 / 7.3.0-rc4
- [Phase 6] git merge-base --is-ancestor c49cdaafa443c HEAD: yes (original commit in this tree; not used as circular “already selected”)
- [Phase 6] Parent blobs still have static void tpg_fill_plane_extras/pattern
- [Phase 7] Kconfig: VIDEO_V4L2_TPG tristate selected by vivid/vimc/visl test drivers
- [Phase 8] lib/Kconfig.debug: FRAME_WARN default 2048 if 64BIT, 1536 only if !64BIT && XTENSA; s390 STACK_SIZE 16K/64K with KASAN
- [Phase 8] init/Kconfig: WERROR default COMPILE_TEST
- UNVERIFIED: allmodconfig with default FRAME_WARN=2048 on clang-22 s390 KASAN (1560 suggests it would pass)
- UNVERIFIED: 32-bit clang KASAN frame size vs 1280 default
**YES**
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +8 -6
@@ -2346,9 +2346,11 @@ static void tpg_fill_params_extras(const struct tpg_data *tpg, (params->is_60hz ?V4L2_FIELD_TOP :V4L2_FIELD_BOTTOM ); } -static void tpg_fill_plane_extras (const struct tpg_data *tpg, -const struct tpg_draw_params *params, -unsigned p,unsigned h,u8 *vbuf) +/* noinline to work around clang KASAN issues */ +static noinline_for_stack void +tpg_fill_plane_extras (const struct tpg_data *tpg, +const struct tpg_draw_params *params, +unsigned p,unsigned h,u8 *vbuf) {unsigned twopixsize = params->twopixsize;unsigned img_width = params->img_width;
@@ -2483,9 +2485,9 @@ static void tpg_fill_plane_extras(const struct tpg_data *tpg, } } -static void tpg_fill_plane_pattern (const struct tpg_data *tpg, -const struct tpg_draw_params *params, -unsigned p,unsigned h,u8 *vbuf) +static noinline_for_stack void +tpg_fill_plane_pattern (const struct tpg_data *tpg,const struct tpg_draw_params *params, +unsigned p,unsigned h,u8 *vbuf) {unsigned twopixsize = params->twopixsize;unsigned img_width = params->img_width;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: ath12k: avoid setting 320MHz support on non 6GHz band
In reply to Sasha LevinFrom: Nicolas Escande <[email protected]>
[ Upstream commit eaf478b3ea68e1b5df659acd24c4df5850e12325 ]
On a split phy qcn9274 (2.4GHz + 5GHz low), "iw phy" reports 320MHz related features on the 5GHz band while it should not:
Wiphy phy1
[...]
Band 2:
[...]
EHT Iftypes: managed
[...]
EHT PHY Capabilities: (0xe2ffdbe018778000):
320MHz in 6GHz Supported
[...]
Beamformee SS (320MHz): 7
[...]
Number Of Sounding Dimensions (320MHz): 3
[...]
EHT MCS/NSS: (0x22222222222222222200000000):This is also reflected in the beacons sent by a mesh interface started on that band. They erroneously advertise 320MHz support too.
This should not happen as IEEE Std 802.11-2024, subclause 9.4.2.323.3 says we should not set the 320MHz related fields when not operating on a 6GHz band. For example it says about Bit 0 "Support For 320 MHz In 6 GHz"
"Reserved if the EHT Capabilities element is indicating capabilities for
the 2.4 GHz or 5 GHz bands."
Fix this by clearing the related bits when converting from WMI eht phy capabilities to mac80211 phy capabilities, for bands other than 6GHz.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00218-QCAHKSWPL_SILICONZ-1
---
LLM Generated explanations, may be completely bogus:
This is a 6.18.y tree (v6.18.53). The patch is a small ath12k firmware-workaround that stops 5 GHz/2.4 GHz from advertising 6 GHz-only 320 MHz EHT bits, including in mesh beacons.
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
- Record: [ath12k / wifi] [avoid] [do not advertise 320 MHz EHT capabilities on non-6 GHz bands]
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Record:
- No Fixes: tag (expected for this review; Qualcomm review of v2 asked for one because the bug is user-visible, and v3 still omitted it)
- No Reported-by:, Tested-by:, Cc: stable
- Reviewed-by: Baochen Qiang <[email protected]>
- Reviewed-by: Rameshkumar Sundaram <[email protected]>
- `Link: https://patch.msgid.link/20260623151613.72113-1-
[email protected]`
- Signed-off-by: Nicolas Escande (author)
- Signed-off-by: Jeff Johnson (ath maintainer; applied to ath-next)
- Tested-on: QCN9274 hw2.0 PCI ... (hardware test, not a tag)
- Ignore [Upstream commit eaf478b3ea68...] and Signed-off-by: Sasha Levin (pipeline)
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
- Record: On split-phy QCN9274 (2.4 GHz + 5 GHz low), firmware-reported EHT PHY caps are copied onto the 5 GHz band, so iw phy shows “320MHz in 6GHz Supported”, beamformee SS 320 MHz, and 320 MHz sounding dimensions. Mesh beacons on that band advertise the same. IEEE 802.11-2024 9.4.2.323.3 marks those fields reserved off 6 GHz.
- Symptom: wrong userspace capability dump and wrong over-the-air EHT Capabilities IE.
- Root cause: WMI EHT PHY caps are copied as-is; 320 MHz/6 GHz bits are not cleared for 2.4/5 GHz.
- Version info: none beyond QCN9274 test hardware.
**Step 1.4: DETECT HIDDEN BUG FIXES**
- Record: Not a disguised cleanup. It is an explicit correctness/spec fix (firmware workaround). “Avoid setting” here means “stop advertising reserved bits.”
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
- Record: Single file drivers/net/wireless/ath/ath12k/wmi.c, +16/−1.
Function: ath12k_wmi_eht_caps_parse(). Surgical, one-driver.
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
- Before: after le32_to_cpu() of firmware PHY caps, only the 6 GHz path ORs back a saved 320 MHz bit. 2.4/5 GHz keep whatever firmware sent, including 320 MHz/6 GHz bits.
- After: 6 GHz path unchanged; non-6 GHz path clears eight reserved 320 MHz/6 GHz fields in the byte view of eht_cap_phy_info[].
- Path: capability parse at firmware ready / MAC-PHY caps-ext, not a hot datapath.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
- Record: Category (h) firmware workaround + (g) protocol correctness.
- Mechanism: firmware reports 6 GHz/320 MHz caps on the 5 GHz WMI blob. Those bits are memcpy’d into mac80211 ieee80211_sta_eht_cap (ath12k_mac_copy_eht_cap()). ieee80211_eht_mcs_nss_size() adds 3 MCS/NSS bytes when IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ is set, so 5 GHz beacons can carry a longer EHT Capabilities IE than a spec- compliant peer expects. cfg80211 still refuses 320 MHz off 6 GHz (net/wireless/chan.c), so the kernel will not actually operate at 320 MHz on 5 GHz.
**Step 2.4: ASSESS THE FIX QUALITY**
- Record: Obviously correct. Masks match include/linux/ieee80211-eht.h. WMI_MAX_EHTCAP_PHY_SIZE is 3 u32s (12 bytes); phy_cap[7] is in range. u8 overlay of a host-endian u32 array matches existing ath12k memcpy of the same array into phy_cap_info[] (little-endian hosts, which is where QCN9274 runs). No API/lock/alloc change. Regression risk is low: only reserved bits on non-6 GHz are cleared. Review expanded v1’s incomplete mask set; v3 clears the full set Qualcomm asked for.
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
- Record: Function added in 1476014fadb662 (“wifi: ath12k: WMI support to process EHT capabilities”), contained in v6.6-rc1. 320 MHz preserve/OR logic added in d4e244c85e45df (“enable 320 MHz bandwidth for 6 GHz… WCN7850”), in v6.7. Buggy “copy firmware bits onto 5 GHz unchanged” behavior is as old as EHT parse in this driver (~v6.6). Present throughout 6.18.
**Step 3.2: FOLLOW THE FIXES: TAG**
- Record: No Fixes: tag. Closest introducing commits are 1476014fadb662 and d4e244c85e45df; both are ancestors of v6.18. No later follow-up on this file after the upstream commit.
**Step 3.3: CHECK FILE HISTORY**
- Record: Nearby wmi.c work is unrelated (endianness, TLV length, scan). Standalone; not patch X/Y.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
- Record: Nicolas Escande is a regular ath11k/ath12k contributor (Freebox/Iliad), not the subsystem maintainer. Jeff Johnson applied it. Qualcomm (Baochen Qiang, Rameshkumar Sundaram) reviewed.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
- Record: None. Uses existing NL80211_BAND_* and IEEE80211_EHT_PHY_CAP* symbols already in this tree. Applies standalone.
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
- Record: b4 dig -c eaf478b3ea68 →
https://patch.msgid.link/[email protected]
- Series: v1 (2026-01-23) → v2 (2026-06-11) → v3 (2026-06-23, applied). v1 incomplete masks; v2/v3 clear remaining 320 MHz/6 GHz fields after Qualcomm/Pablo feedback. v3 vs v2 is comment/typo/spec-citation cleanup.
- No NAKs. Jeff Johnson: “Applied, thanks!”
- No reviewer Cc: stable on v3.
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
- Record (b4 dig -w): To/Cc [email protected], linux- [email protected]. Reviewers: Rameshkumar Sundaram, Baochen Qiang (Qualcomm). Johannes Berg (mac80211) on v1: this is a firmware workaround and belongs in the driver, not mac80211. Pablo MARTIN-GOMEZ (Freebox) pointed out missing CAP7 bits.
**Step 4.3: SEARCH FOR THE BUG REPORT**
- Record: No syzbot/bugzilla. Author reproduced on QCN9274 split-phy; iw phy dump and mesh beacons in the message. Real hardware, not theoretical.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
- Record: Single-patch series. v1→v3 only refined which reserved bits to clear. No hidden dependency.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
- Record: No useful stable-list discussion of this subject. WebSearch of lore stable did not turn up this patch. UNVERIFIED beyond that (lore HTTP 403 on direct fetch; thread recovered via b4).
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
- Record: ath12k_wmi_eht_caps_parse() only.
**Step 5.2: TRACE CALLERS**
- Record: Only from ath12k_wmi_tlv_mac_phy_caps_ext_parse() for 2.4 / 5 / 6 GHz. That is called from ath12k_wmi_tlv_mac_phy_caps_ext(), registered as the WMI TLV parser for WMI_TAG_MAC_PHY_CAPABILITIES_EXT during service-ready. Device bring- up, not IRQ/hot path.
**Step 5.3: TRACE CALLEES**
- Record: le32_to_cpu() and bit clears only. No alloc/lock/IO.
**Step 5.4: FOLLOW THE CALL CHAIN**
- Record: firmware ready → WMI caps-ext → ath12k_mac_copy_eht_cap() → mac80211 sband iftype data → iw phy, association, and beacon IEs. Reachable for any ath12k user with 11be firmware (QCN9274, WCN7850, etc.). Unprivileged users cannot trigger a crash; they do see/advertise wrong caps. Mesh/AP beacons go over the air.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
- Record: rtw89 and mt76 only *set* 320 MHz bits when band == NL80211_BAND_6GHZ. mac80211 strips 320 MHz bits when bw_limit < 320. ath12k was the outlier that trusted firmware on 5 GHz.
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
- Record: Yes. Tree is v6.18.53 (VERSION=6 PATCHLEVEL=18 SUBLEVEL=53). git merge-base --is-ancestor eaf478b3ea68 v6.18.53 is false — the fix is not in 6.18.53. Parent of the candidate still has the old if-only-6 GHz OR. 1476014fadb662 and d4e244c85e45df *are* in v6.18. Bug exists here.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
- Record: Clean apply. Context in this tree matches (function at ~4937). All masks exist in include/linux/ieee80211-eht.h. Expected
difficulty: clean apply.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
- Record: No other commit in this tree clears these bits in ath12k_wmi_eht_caps_parse(). ath12k_mac_filter_eht_cap_mesh() only strips some CAP7 bits for mesh iftypes, not CAP0 320 MHz-in-6 GHz, so it does not replace this fix.
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM AND CRITICALITY**
- Record: drivers/net/wireless/ath/ath12k — Qualcomm Wi-Fi 7.
Criticality: IMPORTANT (production Wi-Fi 7, not core mm/net). CONFIG_ATH12K.
**Step 7.2: SUBSYSTEM ACTIVITY**
- Record: Active (many 2026 ath12k WMI commits). This bug is old (v6.6), not a regression from brand-new code.
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
- Record: ath12k users, especially split-phy QCN9274 5 GHz (author’s case) and any firmware that sets 320 MHz bits in the 2.4/5 GHz WMI blob. Not universal.
**Step 8.2: TRIGGER CONDITIONS**
- Record: Device probe / cap parse whenever firmware reports those bits. Common on affected SKUs. Unprivileged users do not get a kernel exploit; they get wrong iw output and wrong beacon IEs. Not a race.
**Step 8.3: FAILURE MODE SEVERITY**
- Record: Not a panic/UAF/deadlock. Kernel will not run 320 MHz on 5 GHz (chan.c requires 6 GHz; MLME 320 MHz limit is is_6ghz && cap bit). User impact is (1) wrong iw phy, (2) reserved bits in beacons, (3) extra 3-byte 320 MHz MCS/NSS field in the EHT Capabilities IE, which can confuse spec-compliant peers. Severity: MEDIUM (protocol/interop), not CRITICAL.
**Step 8.4: RISK-BENEFIT RATIO**
- Benefit: medium for QCN9274/mesh/AP users; stops malformed EHT IEs.
Risk: very low (~15 lines, reserved-bit clears, reviewed, tested).
Ratio: favorable.
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: EVIDENCE**
FOR:
- Real hardware bug (QCN9274), user-visible iw phy and mesh beacons
- Malformed EHT Capabilities IE (reserved bit + extra MCS/NSS bytes) — interoperability, not just cosmetics
- Small, obviously correct, constants and function exist in 6.18
- Reviewed by Qualcomm; applied by Jeff Johnson; Johannes agrees it is a driver firmware workaround
- No new API; no prerequisites missing in this tree
- Analogous to a hardware/firmware quirk
AGAINST:
- Not a crash, leak, UAF, deadlock, or CVE
- Johannes noted most extra 320 MHz bits are unused at runtime; cfg80211 already blocks 320 MHz off 6 GHz
- Author never added Fixes: even after Rameshkumar asked
- Affects one driver / specific firmware behavior
UNRESOLVED:
- Direct lore.kernel.org HTTP fetch returned 403; discussion recovered via b4 mbox
- No stable-list thread found
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — masks match the spec; Tested-on QCN9274; two Qualcomm Reviewed-by
2. Fixes a real bug that affects users? **PASS** — observed wrong caps and wrong beacons
3. Important issue? **PASS** (medium) — OTA IE malformation/interop on Wi-Fi 7 APs/mesh, not a crash. Within “etc.” for driver protocol bugs / firmware quirks
4. Small and contained? **PASS** — 16 insertions, one function
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — code and symbols present; clean apply
**Step 9.3: EXCEPTION CATEGORIES**
- Record: Firmware/hardware workaround (quirk-like). Not a new device ID, DT, or build fix.
**Step 9.4: DECISION**
Backport to this 6.18.y tree. The bug is in 6.18, the fix is surgical, and wrong EHT IEs on 5 GHz are a real user-visible protocol defect on shipping QCN9274 hardware.
---
Verification:
- [Phase 1] Parsed tags: Reviewed-by Baochen Qiang, Rameshkumar Sundaram; Link msgid; Tested-on QCN9274; no Fixes/Reported- by/Cc:stable
- [Phase 1] Body: split-phy QCN9274 iw phy + mesh beacons advertise 320 MHz on 5 GHz; IEEE 802.11-2024 9.4.2.323.3 reserved-bit citation
- [Phase 2] Diff: ath12k_wmi_eht_caps_parse() +16/−1; else-branch clears 8 reserved PHY bits
- [Phase 2] WMI_MAX_EHTCAP_PHY_SIZE == 3 (12 bytes); phy_cap[7] in bounds (wmi.h:2767)
- [Phase 2] Masks verified in include/linux/ieee80211-eht.h (CAP0 0x02, CAP1 0xe0, CAP2 0xc0, CAP3 0x01, CAP6 MCS15 0x40 / DUP 0x80, CAP7 0x08 / 0x40)
- [Phase 3] git blame: function 1476014fadb662 (v6.6-rc1); 320 MHz OR d4e244c85e45df (v6.7)
- [Phase 3] git merge-base --is-ancestor 1476014fadb662 v6.18 and d4e244c85e45df v6.18: both true
- [Phase 3] No Fixes: tag; no follow-up on wmi.c after upstream eaf478b3ea68
- [Phase 4] b4 dig -c eaf478b3ea68: lore URL; v1/v2/v3; v3 applied as eaf478b3ea68
- [Phase 4] b4 dig -w: ath12k + linux-wireless lists
- [Phase 4] v1 mbox: Johannes — firmware workaround, belongs in driver; Pablo — missing CAP7; Rameshkumar — also clear CAP3/CAP6 DUP/CAP7
- [Phase 4] v2 mbox: Rameshkumar asked for Fixes: because it is user- visible; author did not add it in v3
- [Phase 4] v3 mbox: both Qualcomm Reviewed-by; Jeff Johnson applied; no NAK; no Cc:stable
- [Phase 4] lore WebFetch 403; thread read from b4 dig -m / b4 mbox
- [Phase 5] Callers: only ath12k_wmi_tlv_mac_phy_caps_ext_parse → WMI service-ready. Impact via ath12k_mac_copy_eht_cap / ath12k_mac_copy_eht_mcs_nss (320 MHz MCS copy gated on CAP0 bit)
- [Phase 5] ieee80211_eht_mcs_nss_size() adds 3 bytes when CAP0 320 MHz bit is set — IE length bug on 5 GHz
- [Phase 5] net/wireless/chan.c: 320 MHz rejected unless band is 6 GHz — no local 320 MHz operation on 5 GHz
- [Phase 6] git describe HEAD: v6.18.53-5049-g0f0bdc2b0dffb; make kernelversion: 6.18.53
- [Phase 6] git merge-base --is-ancestor eaf478b3ea68 v6.18.53: false — fix not in 6.18.53
- [Phase 6] Parent of candidate still has old if-only-6 GHz code; constants present
- [Phase 7] Subsystem ath12k, CONFIG_ATH12K, important Wi-Fi 7 driver
- [Phase 8] Failure mode: wrong IEs / interop, not oops; severity MEDIUM; backport risk very low
- UNVERIFIED: no independent user bugzilla beyond the author’s QCN9274 report; stable@ lore search did not find this patch
The fix is small, already reviewed, and addresses a real over-the-air capability bug that exists in this 6.18 tree.
**YES**
drivers/net/wireless/ath/ath12k/wmi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/wmi.c +16 -1
@@ -4939,6 +4939,7 @@ static void ath12k_wmi_eht_caps_parse(struct ath12k_pdev *pdev, u32 band, __le32 cap_info_internal) {struct ath12k_band_cap *cap_band = &pdev->cap.band[band]; +u8 *phy_cap = (u8 *)&cap_band->eht_cap_phy_info[0 ];u32 support_320mhz;u8 i;
@@ -4952,8 +4953,22 @@ static void ath12k_wmi_eht_caps_parse(struct ath12k_pdev *pdev, u32 band,for (i =0 ; i <WMI_MAX_EHTCAP_PHY_SIZE ; i++) cap_band->eht_cap_phy_info[i] =le32_to_cpu (cap_phy_info[i]); -if (band ==NL80211_BAND_6GHZ ) +if (band ==NL80211_BAND_6GHZ ) { cap_band->eht_cap_phy_info[0 ] |= support_320mhz; + }else { +/* +* Firmware may report 6 GHz/320 MHz specific capabilities for +* non-6 GHz bands, so explicitly clear them. +*/ + phy_cap[0 ] &= ~IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ ; + phy_cap[1 ] &= ~IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK ; + phy_cap[2 ] &= ~IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK ; + phy_cap[3 ] &= ~IEEE80211_EHT_PHY_CAP3_SOUNDING_DIM_320MHZ_MASK ; + phy_cap[6 ] &= ~IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_320MHZ ; + phy_cap[6 ] &= ~IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP ; + phy_cap[7 ] &= ~IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ ; + phy_cap[7 ] &= ~IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ ; + } cap_band->eht_mcs_20_only =le32_to_cpu (supp_mcs[0 ]); cap_band->eht_mcs_80 =le32_to_cpu (supp_mcs[1 ]);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 virtio_balloon: warn on failed buffer add in tell_host()
In reply to Sasha LevinFrom: "Denis V. Lunev" <[email protected]>
[ Upstream commit 198eda395067b56ee605de076f0519620f4e5d90 ]
tell_host() ignores the return value of virtqueue_add_outbuf() and goes on to kick the queue and wait_event() for the host's ack. The comment claims "We should always be able to add one buffer to an empty queue", but that does not hold once the virtqueue has been broken (e.g. on device shutdown): the add then fails with -EIO and the following wait_event() would block forever on a buffer the host can never return.
Warn and bail out on failure, mirroring virtballoon_free_page_report().
Message-ID: <[email protected]>
---
LLM Generated explanations, may be completely bogus:
This tree is **6.12.111** (pending-6.12, git describe p-6.12-3-gc504cf0baa3d8). The verdict is only for this checkout.
The candidate is 198eda395067b (virtio_balloon: warn on failed buffer add in tell_host()). It is **not** an ancestor of HEAD. The buggy tell_host() is present and the patch applies cleanly.
---
## Phase 1: Commit message forensics
**Step 1.1 — Subject**
Record: **[virtio_balloon] [warn] Check virtqueue_add_outbuf() in tell_host() and return instead of waiting forever**
**Step 1.2 — Tags**
Record:
- Suggested-by: David Hildenbrand <[email protected]>
- Signed-off-by: Denis V. Lunev <[email protected]> (author)
- Signed-off-by: Michael S. Tsirkin <[email protected]> (virtio maintainer)
- Message-ID: <[email protected]> (v2 4/4)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Cc: stable, or
Link: on the committed message (absence is expected)
**Step 1.3 — Body**
Record:
- **Bug:** tell_host() ignores virtqueue_add_outbuf(). The comment assumes an empty queue can always take one buffer.
- **Symptom:** After a broken virtqueue (-EIO on device shutdown / already-broken vq), wait_event(vb->acked, virtqueue_get_buf(...)) waits forever because the host will never return a buffer that was never queued.
- **Root cause:** Broken-queue add failure is not treated as fatal; kick
+ wait still run.
- **Fix:** WARN_ON_ONCE(err) and return, same as virtballoon_free_page_report().
- **Version note:** Message cites “device shutdown”. That specific trigger is 8bd2fa086a04 (2025-02-24), which is **not** in this 6.12 tree. Other broken-queue triggers **are** in this tree (below).
**Step 1.4 — Hidden bug fix?**
Record: Not hidden. It is an explicit hang fix. It also finishes the 2014 change that removed BUG() on add failure but left the wait.
---
## Phase 2: Diff analysis
**Step 2.1 — Inventory**
Record:
- File: drivers/virtio/virtio_balloon.c only (~+4 / −2)
- Function: tell_host()
- Scope: single-function surgical check
**Step 2.2 — Flow**
Record:
- **Before:** virtqueue_add_outbuf(); ignore result; virtqueue_kick(); wait_event until virtqueue_get_buf() is non- NULL.
- **After:** same, but if add returns non-zero, warn once and return (no kick, no wait).
- Path: inflate/deflate notify to host (normal and remove/leak paths).
**Step 2.3 — Mechanism**
Record:
- **Category:** logic / correctness — ignored error leading to infinite wait
- **Broken:** add on vq->broken returns -EIO (virtqueue_add in virtio_ring.c). virtqueue_get_buf_* returns NULL on broken. wait_event never completes.
- **Fix:** abort when add fails.
**Step 2.4 — Quality**
Record:
- Obviously correct; same pattern already in virtballoon_free_page_report() in this file.
- Regression risk is low. Early return from fill_balloon() can leave pages ballooned without a host ack if add failed for a reason other than a dead device; on a broken vq that is the intended abort. leak_balloon() still runs release_pages_balloon() after tell_host(), so surprise-remove still returns pages.
- WARN_ON_ONCE + panic_on_warn could panic instead of hang. That is the existing reporting-path policy. In **this** tree, shutdown does not break virtio devices, so this does not add reboot-time WARNs.
---
## Phase 3: Git history investigation
**Step 3.1 — Blame**
Record:
- tell_host(): 6b35e40767c6c1 (2008, original balloon driver)
- Ignored add return: 4951cc90831470 (2014, Rusty Russell, “don't crash if virtqueue is broken”) — replaced if (add < 0) BUG() with an unchecked add. That avoided a crash and left a hang.
- Reporting-path WARN: b0c504f1547189 (2020)
**Step 3.2 — Fixes: tag**
Record: None. Natural parent is 4951cc90831470 (present in this tree).
**Step 3.3 — File history**
Record: Recent balloon work here is stats/wakeup/indirect-desc, not tell_host(). No competing fix for this hang. Not already applied.
**Step 3.4 — Author**
Record: Denis V. Lunev is a long-time balloon contributor (997e120843e82, etc.). Applied by MST. Suggested by David Hildenbrand.
**Step 3.5 — Dependencies**
Record: Standalone. v2 series is 4/4:
1. virtio_device_shutdown() helper — needs virtio_dev_shutdown() from 8bd2fa086a04 (not here)
2. virtballoon_quiesce() factor-out
3. .shutdown quiesce (Fixes: 8bd2fa086a04)
4. **This patch** — no new helpers, applies to current tell_host()
This commit does not need 1–3.
---
## Phase 4: Mailing list and external research
**Step 4.1 — Original thread**
Record:
- Lore: https://patch.msgid.link/[email protected]
- Cover: [PATCH v2 0/4] virtio_balloon: quiesce balloon work on device shutdown
- Cover URL: https://lore-
kernel.gnuweeb.org/lkml/[email protected]/
- v1 (2026-06-22) was 2 patches (quiesce only). v2 added this tell_host check (Hildenbrand) and kept it separate (Tsirkin).
- Field report in the cover: kexec/cluster upgrade + panic_on_warn on the **reporting** WARN after 8bd2fa086a04. That trigger is **not** in 6.12. Cover also states inflate/deflate wait_event would block forever on a broken queue.
**Step 4.2 — Recipients (b4 dig -w)**
Record: [email protected], [email protected], [email protected], [email protected]. Right maintainers.
**Step 4.3 — Review**
Record: David Hildenbrand asked about stats_handle_request() (no wait_event; sibling d62fb5cc8a432, not required). No NAK. No reviewer Cc: stable.
**Step 4.4 — Series**
Record: This hunk is independent. 1–3 fix post-6.12 shutdown-break. They cannot and need not go in with this one.
**Step 4.5 — Stable list**
Record: gnuweeb search for virtio_balloon tell_host stable found old balloon stable backports, not this patch. lore.kernel.org/stable returned 403.
---
## Phase 5: Code semantic analysis
**Step 5.1 — Functions**
Record: tell_host() only.
**Step 5.2 — Callers (this tree)**
Record:
- fill_balloon() → update_balloon_size_func() work; inflate
- leak_balloon() → size work, virtio_balloon_oom_notify(), **remove_common()**
- virtballoon_migratepage() (compaction)
- remove_common() ← virtballoon_remove(), virtballoon_freeze()
**Step 5.3 — Callees**
Record: sg_init_one, virtqueue_add_outbuf → -EIO if vq->broken, virtqueue_kick, wait_event + virtqueue_get_buf (NULL if broken).
**Step 5.4 — Reachability**
Record: Userspace/hypervisor: balloon size change, OOM deflate, compaction, unplug/freeze. Host/PCI/CCW can mark the device broken **before** remove_common():
```754:759:drivers/virtio/virtio_pci_common.c
- Device is marked broken on surprise removal so that virtio upper
- layers can abort any ongoing operation.
*/
if (!pci_device_is_present(pci_dev))
virtio_break_device(&vp_dev->vdev);
```Same idea on s390: virtio_ccw_remove / virtio_ccw_offline call virtio_break_device() when device_lost before unregister_virtio_device().
Then remove_common() → leak_balloon() → tell_host() on a broken deflate vq → infinite wait without this patch.
**Step 5.5 — Similar patterns**
Record: virtballoon_free_page_report() already WARNs and returns. stats_handle_request() still ignores add (no hang). 2014 commit removed BUG() in both tell_host and stats.
---
## Phase 6: Cross-referencing this tree
**Step 6.1 — Buggy code here?**
Record: Yes. tell_host() at drivers/virtio/virtio_balloon.c:184-198 still ignores add and waits. Bug since 2008/2014. 8bd2fa086a04 is **not** an ancestor of HEAD (git merge-base --is-ancestor = no). virtio_dev_shutdown / virtballoon_quiesce are absent. Surprise-break (43bb40c5b92659, 2021) **is** here.
**Step 6.2 — Backport difficulty**
Record: Clean apply. tell_host() matches the hunk. finish_wakeup_event is already adjacent context.
**Step 6.3 — Related fixes already here?**
Record: No tell_host add-check. Reporting path already has the WARN. No duplicate.
---
## Phase 7: Subsystem and maintainer context
**Step 7.1**
Record: **virtio balloon** (drivers/virtio/). **IMPORTANT** for VMs (KVM/QEMU, s390 ccw), not core mm/vfs.
**Step 7.2**
Record: Mature driver; balloon core is old. Recent 6.12 backports are stats/wakeup/indirect-desc, not a rewrite of tell_host().
---
## Phase 8: Impact and risk
**Step 8.1 — Who**
Record: Guests with CONFIG_VIRTIO_BALLOON (very common). Triggered when the vq is already broken, then inflate/deflate/remove_common runs.
**Step 8.2 — Trigger**
Record:
- **In this 6.12 tree:** surprise PCI remove (!pci_device_is_present) or ccw device_lost → break → leak_balloon/tell_host hang. Also any prior virtio_break_device() / vq->broken before the next tell_host().
- **Not in this tree:** device_shutdown() break/reset (8bd2fa086a04) — the series’ kexec/panic_on_warn story.
- Not a normal unprivileged syscall. Host/device loss or hot-unplug.
**Step 8.3 — Failure mode**
Record: Uninterruptible wait_event in balloon work or remove_common. Device unbind / unregister_virtio_device / cancel_work_sync can stick. **Severity: HIGH** (hang), not a UAF/corruption.
This patch does **not** unstick a wait that already started after a successful add (notify then fail / break while waiting). It stops the **next** tell_host() after the vq is already broken — the remove/leak path after surprise-break.
**Step 8.4 — Risk vs benefit**
Record:
- Benefit: high for the hang path; medium overall (surprise-loss is less common than the post-6.13 shutdown path, but the hang is real and the driver is supposed to abort).
- Risk: very low (4 lines, established pattern).
- Ratio: favor backport.
---
## Phase 9: Final synthesis
**Step 9.1 — Evidence**
For:
- Real infinite wait_event if add fails (verified: add -EIO, get_buf NULL on broken).
- remove_common() always leaks remaining pages via tell_host() after surprise-break in this tree.
- Completes 2014 “don’t BUG” change that left a hang.
- Tiny, obviously correct, same as existing reporting helper.
- Applies cleanly; no series 1–3 needed.
- Maintainer-applied; suggested by balloon reviewer.
Against:
- Main series story (8bd2fa086a04 kexec/panic_on_warn) is not in 6.12.
- No Fixes:/Cc: stable (not a negative per rules).
- Surprise-remove is less common than graceful unplug.
- WARN_ON_ONCE + panic_on_warn trades hang for panic if add fails; same as reporting path; shutdown in 6.12 does not break vqs, so no new reboot WARNs.
Unresolved: lore.kernel.org/stable HTTP 403. gnuweeb search did not show a prior rejection of this patch.
**Step 9.2 — Stable rules**
1. Obviously correct and tested? **PASS** — 4-line check; reviewed; MST applied; series tested for the later shutdown bug.
2. Real user-visible bug? **PASS** — hang on broken vq / surprise remove.
3. Important (hang/deadlock)? **PASS** — unbounded wait in remove/inflate/deflate.
4. Small and contained? **PASS**
5. No new features/APIs? **PASS**
6. Applies to this tree? **PASS**
**Step 9.3 — Exception category**
Record: None (not an ID/quirk/DT/build/doc exception). Qualifies as a hang fix.
**Step 9.4 — Decision**
The missing 8bd2fa086a04 path does not make this a no-op here. The unchecked add + wait_event is in this tree, and surprise PCI/CCW break-then-remove is the designed “upper layer must abort” path. Backporting this patch alone does not require the quiesce series and does not introduce shutdown WARNs on 6.12.
---
## What it solves for 6.12 users
On a broken balloon virtqueue, tell_host() currently kicks and waits for an ack that cannot arrive. After surprise PCI/CCW removal this tree already marks the device broken, then remove_common() → leak_balloon() → tell_host(), so unbind/remove can hang. The patch warns and returns, matching the reporting helper.
It meets stable rules: real hang, small, no new API, clean apply, no missing prerequisites in this tree.
Risk is low versus an unbounded wait.
---
## Verification
- **[Phase 1]** Parsed message/tags from the supplied commit and git log -1 of 198eda395067b on all-next.
- **[Phase 1]** Cover letter: kexec/panic_on_warn after 8bd2fa086a04; also documents inflate/deflate wait_event hang.
- **[Phase 2]** Diff: 4 lines in tell_host() only; local file matches.
- **[Phase 2]** virtqueue_add returns -EIO if vq->broken (virtio_ring.c:565-568). virtqueue_get_buf_* returns NULL if broken (834-836, 1684-1686).
- **[Phase 3]** Blame: tell_host 6b35e40767c6c1 (2008); unchecked add 4951cc90831470 (2014, removed BUG()).
- **[Phase 3]** git show 4951cc90831470: confirmed BUG → ignore.
- **[Phase 3]** git merge-base --is-ancestor 8bd2fa086a04 HEAD → **NO**. 198eda395067b → **NO**.
- **[Phase 3]** virtio_device_shutdown / virtballoon_quiesce not in this tree.
- **[Phase 4]** b4 dig -c 198eda395067b: msgid [email protected].
- **[Phase 4]** b4 dig -a: v1 quiesce-only; v2 added this patch.
- **[Phase 4]** b4 dig -w: MST + Hildenbrand + virtualization list.
- **[Phase 4]** Hildenbrand reply: asked about stats path; no NAK.
- **[Phase 4]** lore.kernel.org/stable: 403. gnuweeb: no discussion of this patch for stable.
- **[Phase 5]** Callers: fill_balloon, leak_balloon, migratepage; remove_common from remove/freeze.
- **[Phase 5]** virtio_pci_remove surprise-break: 43bb40c5b92659 (2021), present. virtio_ccw break on device_lost, present.
- **[Phase 6]** git describe HEAD → p-6.12-3-gc504cf0baa3d8; make kernelversion → 6.12.111.
- **[Phase 6]** Local tell_host() still unchecked; patch context present; not already patched.
- **[Phase 8]** Failure mode: infinite wait_event / stuck remove. Severity HIGH.
- **UNVERIFIED:** Whether any 6.12.y discussion already rejected this (stable list fetch failed). Not used to decide.
The hang is real in this tree, the fix is small and self-contained, and it should be backported.
**YES**
drivers/virtio/virtio_balloon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/virtio/virtio_balloon.c +4 -2
@@ -185,16 +185,18 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) {struct scatterlist sg;unsigned int len; +int err;sg_init_one (&sg, vb->pfns,sizeof (vb->pfns[0 ]) * vb->num_pfns);/* We should always be able to add one buffer to an empty queue. */ -virtqueue_add_outbuf (vq, &sg,1 , vb,GFP_KERNEL ); + err =virtqueue_add_outbuf (vq, &sg,1 , vb,GFP_KERNEL ); +if (WARN_ON_ONCE (err)) +return ;virtqueue_kick (vq);/* When host has read buffer, this completes via balloon_ack */ wait_event (vb->acked,virtqueue_get_buf (vq, &len)); - } static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_info,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] virtio_balloon: warn on failed buffer add in tell_host()
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines
From: "Denis V. Lunev" <[email protected]>
[ Upstream commit
198eda395067b56ee605de076f0519620f4e5d90]
tell_host()ignores the return value ofvirtqueue_add_outbuf()and goes on to kick the queue andwait_event()for the host's ack. The comment claims "We should always be able to add one buffer to an empty queue", but that does not hold once the virtqueue has been broken (e.g. on device shutdown): the add then fails with-EIOand the followingwait_event()would block forever on a buffer the host can never return.
Quoted 7 lines
Warn and bail out on failure, mirroring
virtballoon_free_page_report().Suggested-by David Hildenbrand <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-ID: <[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 regmap: Remove debugfs before cache teardown
In reply to Sasha LevinFrom: Michael Reeves <[email protected]>
[ Upstream commit 834035934cef9e60169de682f4dc9feafd49e51a ]
regmap_exit() and regmap_reinit_cache() destroy the register cache before removing debugfs. A concurrent debugfs cache operation can therefore access cache state after the backend exit callback starts freeing it.
Remove debugfs before cache teardown, and clear the debugfs pointer after removal. During cache reinitialization, recreate debugfs only after the new cache initializes successfully.
---
LLM Generated explanations, may be completely bogus:
The local tree is **6.18.57**. The buggy teardown order is present at v6.18.57; this commit is a small UAF-lifecycle fix that applies here and should be backported.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [regmap] [Remove] Remove debugfs before cache teardown
- Subsystem: regmap (drivers/base/regmap)
- Verb: “Remove” — here it is a lifecycle reorder, not a feature deletion
- Intent: tear down debugfs *before* the register cache so concurrent debugfs cache ops cannot touch freed cache state
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- Reviewed-by: Peng Fan <[email protected]> — NXP reviewer, active on regmap
- `Link: https://patch.msgid.link/20261006-regcache-lifecycle-
[email protected]`
- Signed-off-by: Michael Reeves <[email protected]> (author)
- Signed-off-by: Mark Brown <[email protected]> (regmap maintainer)
- No Fixes:, Reported-by:, Tested-by:, Acked-by:, or `Cc:
stable` (absence is expected for this review)
- Ignored pipeline markers: [Upstream commit 834035934cef…], `Signed-
off-by: Sasha Levin`
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** regmap_exit() and regmap_reinit_cache() call regcache_exit() *before* regmap_debugfs_exit(). A concurrent debugfs cache operation can then run after the backend exit callback has started freeing cache memory.
- **Symptom:** use-after-free / invalid cache access from debugfs (registers dump, rbtree dump, cache_only sync).
- **Root cause:** debugfs lifetime is not drained before cache teardown. debugfs_remove_recursive() is the drain point and must run first.
- **Fix:** remove debugfs first; NULL map->debugfs after removal; on reinit, recreate debugfs only after regcache_init() succeeds.
- **Versions:** none named. Blame shows this order has existed since 2011–2012.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not disguised. It is an explicit UAF/lifecycle fix. The reinit change also closes a second hole: old code recreated debugfs *before* the new cache existed, so cache_ops->debugfs_init / cache dumps could run against a destroyed cache.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- drivers/base/regmap/regmap-debugfs.c: +1 (map->debugfs = NULL)
- drivers/base/regmap/regmap.c: +9 / −6
- Functions: regmap_debugfs_exit(), regmap_reinit_cache(), regmap_exit()
- Scope: surgical, two files, net +4 lines in this tree (1/0 and 9/6)
Mainline context in the submission has debugfs_dummy_id / dummy_ida; this 6.18 tree does not. The functional hunks are the same and already applied as 944c051717d77.
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
Hunk 1 — regmap_debugfs_exit():
- Before: debugfs_remove_recursive(map->debugfs) left a stale dentry pointer.
- After: map->debugfs = NULL immediately after removal.
Hunk 2 — regmap_reinit_cache():
- Before: regcache_exit → regmap_debugfs_exit → regmap_debugfs_init → regcache_init.
- After: regmap_debugfs_exit → regcache_exit → regcache_init → on success regmap_debugfs_init. Failed cache init leaves debugfs down instead of exposing a dead cache.
Hunk 3 — regmap_exit():
- Before: regcache_exit then regmap_debugfs_exit.
- After: reverse that order.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **(d) Memory safety / UAF** plus **(g) lifecycle correctness**.
Verified mechanism:
- regcache_rbtree_exit() does kfree(map->cache); map->cache = NULL.
- rbtree_show() does rbtree_ctx = map->cache then walks rbtree_ctx->root under the map lock.
- regmap_read_debugfs() calls regmap_read(), which can hit regcache_read() / cache_ops.
- regmap_cache_only_write_file() can call regcache_sync() on a destroyed cache.
debugfs_remove_recursive() waits for in-flight file ops (debugfs_file_get / active_users_drained in fs/debugfs/file.c). Calling it *after* regcache_exit() is the wrong order: ops already in flight (or still open until remove starts) can touch freed cache. Calling it first drains those ops, then the cache can be freed.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct. Standard “remove debugfs, then free private data” pattern. No API/data-structure change. debugfs_remove_recursive() already sleeps, so moving it earlier does not add a new sleep-in-atomic constraint. Reinit already documents that callers must serialize against other *regmap* calls; this still serializes *userspace* debugfs, which the driver cannot.
Regression risk: **low**. Failed regcache_init() now skips debugfs recreate (debugfs stays gone). That is safer than the old “debugfs live, cache dead/uninitialized” window.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record (on parent of 944c051717d77):
- regcache_exit before debugfs in regmap_reinit_cache:
bf315173359b2 (Mark Brown, 2011-12-03)
- regmap_debugfs_exit added there: a24f64a6483767 (2012-01-26)
- regcache_exit before debugfs in regmap_exit: 5d1729e7f02f05 (2011-09-19) then 31244e396fa9e4 (2011-07-20)
- debugfs_remove_recursive without NULL: a52eaeb1898bc0 (2013-10-24)
The buggy order is ancient and is in this 6.18 tree.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag. Not applicable. Introduced with original regmap debugfs/cache teardown, not a recent regression.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- 530792efa6cb8 “regmap: Call regmap_debugfs_exit() prior to _init()” — same “debugfs off before reuse” idea.
- 9f711c9321cff “regmap: get rid of redundant debugfs_file_{get,put}()” — debugfs core now owns the drain; this patch is the remaining lifecycle piece.
- This is **patch 1/2** of “regmap: Fix cache lifecycle locking and teardown”. Patch 2 (“Drop map lock during cache init and exit”) is a **separate lockdep** fix (Fixes: fd4ebc07b4df). Patch 2’s upstream abff0a48b110 is **not** in this tree and is **not** a prerequisite for patch 1.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Only this commit by Michael Reeves under drivers/base/regmap/ in this tree. Not the subsystem maintainer. Applied by **Mark Brown**.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Standalone. Uses existing regmap_debugfs_exit / regcache_exit / regcache_init. Dummy-ida context from later mainline is absent here and is not required.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c 944c051717d77 →
https://patch.msgid.link/20261006-regcache-lifecycle-
[email protected]
- Revisions:
- v1 (2026-09-25): lockdep-only, no debugfs reorder
- v2 (2026-10-04): added this debugfs ordering fix
- v3 (2026-10-06): this version; maple irqsave helpers are **patch 2
only**
- Peng Fan: Reviewed-by on patch 1; no NAK
- Mark Brown applied both to broonie/regmap.git for-7.3 (834035934cef, abff0a48b110)
- No reviewer asked for Cc: stable
- Cover letter testing (Apple M3, lockdep, KUnit) is mainly for patch 2; patch 1 is justified by code inspection
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record (b4 dig -w): Mark Brown, Greg Kroah-Hartman, Rafael Wysocki, Danilo Krummrich, Liam Howlett; lists: linux-kernel, driver-core, maple- tree, asahi, linux-mm. Subsystem maintainer received and applied it.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot, bugzilla, or user crash report. Bug is from code analysis of teardown vs debugfs.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Series of 2. This patch does not depend on maple irqsave helpers or dropping the map lock. Patch 2 is a different bug (lockdep during Apple GPIO probe).
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: No stable-list discussion found (lore.kernel.org returned 403; searches did not hit this subject). UNVERIFIED beyond that negative search.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: regmap_debugfs_exit, regmap_reinit_cache, regmap_exit (callers of regcache_exit / debugfs init).
**Step 5.2: TRACE CALLERS**
Record:
- regmap_exit(): many drivers (ASoC via snd_soc_component_exit_regmap, HDA, MFD, media/DVB, IIO, input, USB, leds, syscon, kunit, devres cleanup). Common unbind/remove path.
- regmap_reinit_cache(): ASoC (mt8192/mt8183, tas2764/tas2770, da7219, ssm3515), MFD (wm8994, wm8400), IIO (kx022a, several light/pressure sensors), pinctrl-aw9523. Probe/runtime rediscovery.
- regmap_debugfs_exit() also from regmap_attach_dev() (already exit- then-init) and __regmap_init error paths.
**Step 5.3: TRACE CALLEES**
Record: debugfs_remove_recursive (sleeps until file ops drain), regmap_debugfs_free_dump_cache, regcache_exit → cache_ops->exit (rbtree/maple/flat free map->cache).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Reachable from userspace:
1. Open /sys/kernel/debug/regmap/<dev>/registers or rbtree
2. Concurrent unbind / module unload / regmap_reinit_cache()
3. Old order frees cache while the read can still run → UAF
Needs CONFIG_DEBUG_FS (stubs make this a no-op otherwise) and typically debugfs access (often root). Distro/Android kernels commonly enable debugfs.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Only rbtree implements cache_ops->debugfs_init here. Maple/flat have no extra debugfs file, but the shared registers / cache_only files still go through the cache. Same class of bug as other “remove debugfs before free private data” fixes.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **Yes.** git describe HEAD = v6.18.57-155-gcdf239ca885b2. make kernelversion = 6.18.57. At tag v6.18.57, regmap_exit/regmap_reinit_cache still call regcache_exit first. git merge-base --is-ancestor 944c051717d77 v6.18.57 is false — the fix is not in the 6.18.57 baseline.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** Candidate 944c051717d77 applied here with only missing dummy-ida context vs mainline. No refactor blocking it.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No other commit in this tree reorders cache vs debugfs teardown. Patch 2 is absent and not required.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: drivers/base/regmap — **IMPORTANT/CORE-adjacent**. Shared register cache for ASoC, MFD, IIO, pinctrl, regulators, etc.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Mature (2011+) and still actively maintained by Mark Brown. This is a long-standing lifecycle bug, not a brand-new subsystem.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Any user with CONFIG_REGMAP + CONFIG_DEBUG_FS and a cached regmap. Driver-specific devices, but the core path is widely used. No-op if debugfs is off.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Concurrent debugfs access during regmap_exit/regmap_reinit_cache. Timing-dependent. Typical trigger is root/debugfs; unprivileged access depends on debugfs mount mode. Unbind during a dump is realistic (USB audio, codec remove, module unload).
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Use-after-free of cache memory → oops or memory corruption. **HIGH** (UAF). Not a guaranteed panic on every unbind; still a real memory-safety bug.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** Prevents UAF on a common infrastructure path when debugfs is used around teardown/reinit.
- **Risk:** Very low — ~10 lines, order swap + NULL + delayed debugfs recreate.
- **Ratio:** Favor backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real UAF: cache freed while debugfs files can still run (rbtree_show, regmap_read_debugfs, regcache_sync from cache_only)
- debugfs_remove_recursive() is the documented drain; it must run before regcache_exit
- Bug present in this 6.18.57 tree since 2011–2012
- Small, obviously correct, reviewed, applied by the regmap maintainer
- Applies cleanly; no dependency on patch 2
- Hidden extra fix: do not recreate debugfs on a not-yet-initialized cache
AGAINST:
- No syzbot/user report
- Needs debugfs and concurrent teardown
- Series patch 1/2 (but self-contained)
- Maintainer queued it for 7.3, not as an emergency -fixes drop
- No Cc: stable (not a negative per these rules)
UNRESOLVED:
- lore.kernel.org HTTP 403; thread recovered via b4 dig + LKML mirrors
- No stable-list thread found
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — order is the documented debugfs lifetime rule; v3 reviewed; KUnit mentioned in the series; maintainer applied it
2. Fixes a real bug that affects users? **PASS** — UAF on debugfs vs cache teardown
3. Important issue? **PASS** — UAF/oops, HIGH; not a style change
4. Small and contained? **PASS** — 2 files, ~10 net lines
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — clean against 6.18.57
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: Not an ID/quirk/DT/build/docs exception. Ordinary memory-safety fix.
**Step 9.4: MAKE YOUR DECISION**
Backport. The bug exists in this tree, the fix is the correct lifecycle, and risk is minimal. Debugfs-only does not make a UAF incommensurate with stable: CONFIG_DEBUG_FS is common, and regmap_exit runs on ordinary unbind.
What it solves for stable users: a use-after-free if debugfs is used while a cached regmap is torn down or its cache is reinitialized. That is a crash/corruption class bug in widely used driver-core code.
Risk vs benefit: large benefit relative to a four-line-class reorder. No public API change. Patch 2 is not required.
===============================================================
Verification
===============================================================
- [Phase 1] Parsed tags: Reviewed-by Peng Fan; Link msgid; SOB Reeves + Mark Brown; no Fixes/Reported-by/Cc-stable
- [Phase 2] Diff: +NULL after debugfs_remove_recursive; swap regcache_exit/regmap_debugfs_exit in exit and reinit; delay regmap_debugfs_init until regcache_init succeeds
- [Phase 2] regcache_rbtree_exit kfree’s map->cache; rbtree_show dereferences it — UAF confirmed in this tree
- [Phase 2] fs/debugfs/file.c: debugfs_remove_recursive waits on debugfs_file_get / active_users_drained
- [Phase 3] Blame: teardown order from 2011–2012 (Brown/Papastamos)
- [Phase 3] git merge-base --is-ancestor 944c051717d77 v6.18.57 → not in 6.18.57 baseline
- [Phase 3] Patch 2 abff0a48b110 not an ancestor of HEAD; not a prerequisite
- [Phase 3] fd4ebc07b4df is in HEAD (only relevant to patch 2)
- [Phase 4] b4 dig -c 944c051717d77: lore msgid 20261006-regcache- lifecycle-submit-v3-1-…
- [Phase 4] b4 dig -a: v1 lockdep-only → v2 added this fix → v3 applied
- [Phase 4] b4 dig -w: Mark Brown, driver-core, Greg KH CC’d; Peng Fan Reviewed-by; Mark applied to for-7.3
- [Phase 4] lore.kernel.org WebFetch 403; used b4 mbox + lkml.iu.edu
- [Phase 5] Callers: many regmap_exit sites; regmap_reinit_cache in ASoC/MFD/IIO/pinctrl
- [Phase 6] git describe HEAD = v6.18.57-155-gcdf239ca885b2; make kernelversion = 6.18.57; buggy order present at v6.18.57
- [Phase 6] Candidate diff vs this tree is clean (no dummy_ida here)
- [Phase 8] Failure mode: UAF → oops/corruption, HIGH; trigger: debugfs
+ teardown
- UNVERIFIED: no stable@ thread located (search did not find this subject)
**YES**
drivers/base/regmap/regmap-debugfs.c | 1 + drivers/base/regmap/regmap.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/base/regmap/regmap-debugfs.c +1 -0
@@ -657,6 +657,7 @@ void regmap_debugfs_exit(struct regmap *map) {if (map->debugfs) {debugfs_remove_recursive (map->debugfs); + map->debugfs =NULL ;mutex_lock (&map->cache_lock);regmap_debugfs_free_dump_cache (map);mutex_unlock (&map->cache_lock);
drivers/base/regmap/regmap.c +9 -6
@@ -1424,8 +1424,8 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) {int ret; -regcache_exit (map);regmap_debugfs_exit (map); +regcache_exit (map); map->max_register = config->max_register; map->max_register_is_set = map->max_register ?: config->max_register_is_0;
@@ -1441,12 +1441,16 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)if (ret)return ret; -regmap_debugfs_init (map); - map->cache_bypass = false; map->cache_only = false; -return regcache_init (map, config); + ret =regcache_init (map, config); +if (ret) +return ret; + +regmap_debugfs_init (map); + +return 0 ; }EXPORT_SYMBOL_GPL (regmap_reinit_cache);
@@ -1460,9 +1464,8 @@ void regmap_exit(struct regmap *map)struct regmap_async *async;regmap_detach_dev (map->dev, map); -regcache_exit (map); -regmap_debugfs_exit (map); +regcache_exit (map);regmap_range_exit (map);if (map->bus && map->bus->free_context) map->bus->free_context (map->bus_context);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ksmbd: preserve access denied status for copychunk
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit f7c0366e0a80bf8cd5eacc5479927abb50958b5e ]
The copychunk error mapping handles -EACCES in an independent if statement. The following error chain therefore reaches its final else clause and overwrites STATUS_ACCESS_DENIED with STATUS_UNEXPECTED_IO_ERROR.
Join the -EACCES check to the remaining error chain so an access failure is returned as STATUS_ACCESS_DENIED.
---
LLM Generated explanations, may be completely bogus:
I have the full picture: the one-line if/else if bug is in this 6.12.111 tree, it applies cleanly, and the original submitter explicitly asked for stable. Writing up the nine-phase analysis.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[ksmbd]** **[preserve]** preserve access denied status for copychunk.
Subsystem is the in-kernel SMB3 server. “Preserve” here means “stop overwriting a correctly computed NTSTATUS,” which is a correctness fix, not a feature.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Mainline commit f7c0366e0a80bf8cd5eacc5479927abb50958b5e (author Namjae Jeon, AuthorDate 2026-07-07, CommitDate 2026-08-17):
- Signed-off-by: Namjae Jeon \<[email protected]\> (ksmbd maintainer; he both authored and committed it)
- No Fixes:, Reported-by, Tested-by, Reviewed-by, Acked-by, Link:, or
Cc: stable on the committed version
The absence of Fixes:/Cc: stable on the committed object is expected for this review pipeline and is not a negative signal.
An independent mailing-list submission of the **same one-line change** did carry those tags (see Phase 4):
- Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
- Cc: [email protected]
- Reviewed-by: ChenXiaoSong
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** In fsctl_copychunk(), -EACCES is handled by a standalone if. The next if (ret == -EAGAIN) / else if ... / else chain then runs anyway.
- **Symptom:** STATUS_ACCESS_DENIED is written, then immediately overwritten by STATUS_UNEXPECTED_IO_ERROR.
- **Failure mode:** SMB clients doing server-side copy (FSCTL_COPYCHUNK / FSCTL_COPYCHUNK_WRITE) see a generic I/O error instead of access denied. The copy is still rejected; the protocol status is wrong.
- **Version info:** none in the committed message. The UnionTech submission pins it to the original cifsd SMB3 engine commit.
- **Root cause:** missing else so -EACCES falls into the final else.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: Not hidden. The message describes a real control-flow bug. “Preserve” is the action verb for keeping the correct status.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
**Step 2.1: INVENTORY THE CHANGES**
Record:
- File: fs/smb/server/smb2pdu.c — 1 line changed (if → else if)
- Function: fsctl_copychunk()
- Scope: single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
This tree currently has:
```7988:8005:fs/smb/server/smb2pdu.c
if (ret < 0) {
if (ret == -EACCES)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
if (ret == -EAGAIN)
rsp->hdr.Status = STATUS_FILE_LOCK_CONFLICT;
else if (ret == -EBADF)
rsp->hdr.Status = STATUS_INVALID_HANDLE;
else if (ret == -EFBIG || ret == -ENOSPC)
rsp->hdr.Status = STATUS_DISK_FULL;
else if (ret == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
else if (ret == -EISDIR)
rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
else if (ret == -E2BIG)
rsp->hdr.Status = STATUS_INVALID_VIEW_SIZE;
else
rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR;
}
```Record: Before, -EACCES sets STATUS_ACCESS_DENIED, then misses -EAGAIN and every later else if, and the final else overwrites it with STATUS_UNEXPECTED_IO_ERROR. After, -EACCES is exclusive and the status sticks. Other errno mappings are unchanged. This is the ksmbd_vfs_copy_file_ranges() error path, not probe/init.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record: **Logic / correctness.** Missing else on an errno-to-NTSTATUS ladder. -EACCES is a real return from ksmbd_vfs_copy_file_ranges():
```1840:1847:fs/smb/server/vfs.c
if (!(src_fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE)))
{
pr_err("no right to read(%pD)\n", src_fp->filp);
return -EACCES;
}
if (!(dst_fp->daccess & (FILE_WRITE_DATA_LE |
FILE_APPEND_DATA_LE))) {
pr_err("no right to write(%pD)\n", dst_fp->filp);
return -EACCES;
}
```vfs_copy_file_range() can also return -EACCES. The access check still denies the copy; only the SMB status is wrong.
**Step 2.4: ASSESS THE FIX QUALITY**
Record: Obviously correct. One token. No API, locking, or allocation change. Regression risk is negligible: -EACCES already matched nothing else in the chain.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
**Step 3.1: BLAME THE CHANGED LINES**
Record: git blame -L 7988,8005 fs/smb/server/smb2pdu.c attributes the whole ladder to e2f34481b24db2 (“cifsd: add server-side procedures for SMB3”, Namjae Jeon, 2021-03-16). That is the original ksmbd/cifsd SMB3 engine, present since the server was merged (v5.15-era). The bug is old, not recent churn.
**Step 3.2: FOLLOW THE FIXES: TAG**
Committed object has no Fixes: tag. The equivalent linux-cifs patch tagged e2f34481b24d. git merge-base --is-ancestor e2f34481b24db2 HEAD succeeded — the introducing commit is in this tree. No later rewrite of this ladder was found in this checkout.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent smb2pdu.c work in this tree is unrelated (partial QUERY_INFO responses, compound errors, lease/durable-handle fixes). Neighboring mainline copychunk work from the same day (fd309860ef245 overlapping-copy data preservation, 8482150a0743c ADS copychunk) is **not** in HEAD and is **not** required: this change only joins two ifs in the error map. Standalone.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Namjae Jeon is the ksmbd maintainer (git log --author="Namjae Jeon" -- fs/smb/server/). He authored and committed this. Same-day mainline commits touch other copychunk behavior but do not alter this mapping.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: None. git show f7c0366e0a80b | git apply --check succeeded on this tree (hunk offset -764 lines). No new helpers or structs.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- b4 dig -c f7c0366e0a80b failed (lore returned an error to b4).
- Direct lore search found the same fix submitted independently:
https://lore.kernel.org/linux-
cifs/[email protected]/
Xu Rao (UnionTech), 2026-07-31, subject “ksmbd: preserve STATUS_ACCESS_DENIED for copychunk errors”. Same if → else if. Cites **MS-SMB2 3.3.5.15.6**: FSCTL_SRV_COPYCHUNK / COPYCHUNK_WRITE must fail with STATUS_ACCESS_DENIED when the source open lacks FILE_READ_DATA or the destination lacks FILE_WRITE_DATA/FILE_APPEND_DATA. **Fixes:** e2f34481b24d. **Cc: [email protected].** No NAK.
Namjae’s committed patch (author date 2026-07-07) is the same change, queued earlier in ksmbd-for-next and merged via ksmbd-for-7.3-rc1 (git describe --contains → v7.3-rc1~77^2~124).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: UnionTech patch To/Cc: Namjae Jeon, Steve French, Sergey Senozhatsky, Tom Talpey, linux-cifs, LKML, **[email protected]**. ChenXiaoSong replied with Reviewed-by.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No syzbot/bugzilla. Two independent authors (maintainer + UnionTech) found the same missing-else. Spec citation is MS-SMB2 3.3.5.15.6.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: Not a numbered series. Same-day copychunk patches are independent and not in this tree; this line does not need them.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search for this subject did not turn up a prior rejection. The UnionTech mail itself was Cced to stable. ChenXiaoSong noted the bug was already fixed in ksmbd-for-next-next (htt ps://github.com/smfrench/smb3- kernel/commit/35e11e324a2f97d2974ef08d308063c9c5f9e9d8) — that is the maintainer tree copy of this same fix, not a reason to skip stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: fsctl_copychunk() only.
**Step 5.2: TRACE CALLERS**
Record: Only caller is smb2_ioctl() for FSCTL_COPYCHUNK / FSCTL_COPYCHUNK_WRITE (fs/smb/server/smb2pdu.c around 8466–8495). smb2_ioctl is registered as SMB2_IOCTL_HE in fs/smb/server/smb2ops.c. Reachable from any authenticated SMB2/SMB3 client issuing a copychunk FSCTL (Windows Explorer / CopyFile server- side copy, robocopy, smbclient, etc.).
Important: fsctl_copychunk()’s return value is discarded. Status is taken from rsp->hdr.Status, then ksmbd_iov_pin_rsp() sends the ioctl response. The wrong status is what the client actually receives.
Tree-not-writable uses ret = -EACCES; goto out; in smb2_ioctl() and maps correctly. The broken path is the **file-handle** access check inside ksmbd_vfs_copy_file_ranges().
**Step 5.3: TRACE CALLEES**
Record: ksmbd_vfs_copy_file_ranges() → access checks, lock checks, vfs_copy_file_range(). -EACCES comes from the access checks (and potentially VFS).
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: SMB2 IOCTL (network) → smb2_ioctl → fsctl_copychunk → ksmbd_vfs_copy_file_ranges. Triggerable by a logged-in SMB user with opens that lack read-on-source or write-on-dest. Not a local unprivileged syscall, but a normal file-server path.
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: The only other if (ret == -EACCES) in fs/smb/server/smb2pdu.c is the outer smb2_ioctl() mapper, which **already** uses else if. This copychunk ladder is the broken instance.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: Yes. git describe HEAD = p-6.12-3-gc504cf0baa3d8; make kernelversion = **6.12.111**. Buggy ladder is at fs/smb/server/smb2pdu.c:7988-8005. git merge-base --is-ancestor f7c0366e0a80b HEAD failed — fix is **not** in this checkout. Introduced by e2f34481b24d (2021), which **is** an ancestor of HEAD.
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply.** git apply --check of the mainline diff succeeded (offset -764). Surrounding copychunk ioctl code matches aside from line numbers. Mainline context uses FSCTL_SRV_COPYCHUNK in a nearby (unchanged) check; this tree still uses FSCTL_COPYCHUNK. That is outside the changed line and did not block apply.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: git log --grep="preserve access denied" -- fs/smb/server has no hit. No alternate mapping fix in this tree.
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: fs/smb/server (ksmbd), CONFIG_SMB_SERVER. **IMPORTANT** for NAS/embedded/distros that ship ksmbd; not core mm/VFS for every box. Protocol status on copychunk is user-visible for those servers.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Actively maintained (many recent ksmbd commits on this branch). This particular ladder has been unchanged since 2021.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: Config-specific / server-specific: ksmbd users. Windows and other SMB clients using server-side copy against ksmbd.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record: Authenticated client issues FSCTL_COPYCHUNK[_WRITE] with a source handle lacking read/execute or a dest handle lacking write/append (or VFS returns -EACCES). Common for copy-offload when opens don’t carry the rights MS-SMB2 requires. Not a rare race.
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record: Wrong NTSTATUS (STATUS_UNEXPECTED_IO_ERROR instead of STATUS_ACCESS_DENIED). Copy is still denied — not a bypass, crash, or corruption. Clients/apps can surface “I/O device error”, retry, or mishandle a permission failure. **Severity: MEDIUM**, but it is a documented SMB protocol violation (MS-SMB2 3.3.5.15.6).
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** Correct access-denied reporting on a standard Windows copy-offload path; matches spec.
- **Risk:** Very low (one else, no behavioral change except the status for -EACCES).
- **Ratio:** Favorable. Independent submitter Cced stable for this exact change.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
**Step 9.1: COMPILE THE EVIDENCE**
FOR:
- Real, verified missing-else bug in this 6.12.111 tree
- -EACCES is a live return from ksmbd_vfs_copy_file_ranges()
- Client-visible SMB status is wrong; MS-SMB2 requires ACCESS_DENIED
- 1-line, obviously correct, applies cleanly
- Present since original cifsd merge; introducing commit is in HEAD
- Maintainer-authored; independently rediscovered; Reviewed-by ChenXiaoSong; **Cc: stable** on the public patch
- No prerequisites
AGAINST:
- Not a crash, UAF, deadlock, or data-corruption fix
- Committed object dropped Fixes:/Cc: stable
- Only affects CONFIG_SMB_SERVER
UNRESOLVED:
- b4 dig could not match Namjae’s committed subject (lore error). The UnionTech thread was recovered by direct lore search and is the same diff.
**Step 9.2: APPLY THE STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — control flow is unambiguous; maintainer committed it; Reviewed-by on the twin patch.
2. Fixes a real bug that affects users? **PASS** — wrong NTSTATUS on copychunk permission failure.
3. Important issue? **PASS** (medium, protocol) — spec-mandated ACCESS_DENIED becomes UNEXPECTED_IO_ERROR on a common Windows copy path; not a crash, but user-visible interoperability.
4. Small and contained? **PASS** — 1 line, one function.
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — git apply --check succeeded.
**Step 9.3: CHECK FOR EXCEPTION CATEGORIES**
Record: None (not a device ID/quirk/DT/build/docs exception). Qualifies as a normal small correctness fix.
**Step 9.4: MAKE YOUR DECISION**
This belongs in 6.12.y. The buggy ladder is here, the fix is one else, and it restores the NTSTATUS ksmbd already tried to set and that MS-SMB2 requires. Risk is essentially zero.
------------------------------------------------
What the commit solves for this tree
------------------------------------------------
On 6.12.111 ksmbd, fsctl_copychunk() maps -EACCES from ksmbd_vfs_copy_file_ranges() to STATUS_ACCESS_DENIED, then the next if/else chain overwrites it with STATUS_UNEXPECTED_IO_ERROR. SMB clients doing server-side copy therefore see a generic I/O error instead of access denied. The copy is still rejected; the protocol status is wrong. Joining the -EACCES arm with else if is the whole fix.
It meets the stable rules: obviously correct, real user-visible bug, tiny, no new API, applies cleanly here. Benefit is correct SMB semantics; regression risk is negligible.
Concerns: not a panic/UAF class bug; ksmbd-only. Those do not outweigh a one-line protocol-status fix that an independent submitter already nominated for stable.
Verification:
- [Phase 1] Parsed committed tags: only SOB Namjae Jeon on f7c0366e0a80b; no Fixes:/Cc: stable on the git object
- [Phase 1] UnionTech twin patch on lore has Fixes: e2f34481b24d and Cc:
[email protected]
- [Phase 2] Diff: 1 line in fsctl_copychunk(), if → else if on -EAGAIN
- [Phase 2] Confirmed -EACCES returns in ksmbd_vfs_copy_file_ranges() at vfs.c:1840-1847 in this tree
- [Phase 2] Confirmed overwrite path in smb2pdu.c:7988-8005 in this tree
- [Phase 3] git blame: ladder from e2f34481b24db2 (2021 cifsd SMB3 engine)
- [Phase 3] git merge-base --is-ancestor e2f34481b24db2 HEAD: yes
- [Phase 3] git merge-base --is-ancestor f7c0366e0a80b HEAD: no (fix not present)
- [Phase 3] Neighboring copychunk commits fd309860ef245 / 8482150a0743c:
not in HEAD, not required
- [Phase 3] git apply --check of mainline diff: succeeded at offset -764
- [Phase 4] b4 dig -c f7c0366e0a80b: lore error, no match
- [Phase 4] lore thread: https://lore.kernel.org/linux-
cifs/[email protected]/ — same diff, Cc: stable, MS-SMB2 3.3.5.15.6
- [Phase 4] ChenXiaoSong Reviewed-by; noted already in ksmbd-for-next- next
- [Phase 4] stable list: no prior rejection found
- [Phase 5] Only caller: smb2_ioctl FSCTL_COPYCHUNK/COPYCHUNK_WRITE; return value discarded; client sees rsp->hdr.Status
- [Phase 5] Only other -EACCES map in smb2pdu.c already uses else if
- [Phase 6] git describe HEAD: p-6.12-3-gc504cf0baa3d8; kernelversion 6.12.111
- [Phase 6] git describe --contains f7c0366e0a80b: v7.3-rc1~77^2~124 (merged in ksmbd-for-7.3-rc1)
- [Phase 8] Failure mode: wrong NTSTATUS on permission failure, MEDIUM, not a crash
- UNVERIFIED: Could not retrieve Namjae’s original mail (b4/lore subject mismatch); content confirmed via committed diff + UnionTech thread
**YES**
fs/smb/server/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/smb2pdu.c +1 -1
@@ -8068,7 +8068,7 @@ static int fsctl_copychunk(struct ksmbd_work *work,if (ret <0 ) {if (ret == -EACCES ) rsp->hdr.Status =STATUS_ACCESS_DENIED ; -if (ret == -EAGAIN ) +else if (ret == -EAGAIN ) rsp->hdr.Status =STATUS_FILE_LOCK_CONFLICT ;else if (ret == -EBADF ) rsp->hdr.Status =STATUS_INVALID_HANDLE ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: usb-audio: Skip mixer creation on M-Audio Venom
In reply to Sasha LevinFrom: Federico Valentín Andrade <[email protected]>
[ Upstream commit 4c0ec35e011309bd7091053ad5bbc01420967a66 ]
The M-Audio Venom (0763:2084) does not answer any GET_CUR request of its feature units, hanging up the USB microcontroller and "responding" with timeouts. So the mixer building lasts around 47 seconds, and the device does not stream at all.
The same GET_CUR requests issued through libusb (with no kernel driver bound) complete correctly and blazingly fast. So it seems to only happen during the initial probe.
I defined an explicit composite quirk to bypass the mixer creation, as it is not needed (the synth already comes with volume controls).
With both this and the device flag applied, the synth works flawlessly.
---
LLM Generated explanations, may be completely bogus:
I have enough to decide: this is a device-specific usb-audio quirk, the local 6.12 tree has the same table and macros, and the companion flag patch is independent.
===============================================================
PHASE 1: COMMIT MESSAGE FORENSICS
===============================================================
Step 1.1: PARSE THE SUBJECT LINE
Record: [ALSA usb-audio] [Skip] [Do not build the mixer for M-Audio Venom 0763:2084 because GET_CUR on feature units hangs the device]
Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
Record:
- Signed-off-by: Federico Valentín Andrade <[email protected]> (author)
- Link: https://patch.msgid.link/20260824140211.17003-3-
[email protected] (v3 series; msgid -3 is patch 2/2 after the cover)
- Signed-off-by: Takashi Iwai <[email protected]> (ALSA maintainer; applied)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable (absence expected)
- Ignore pipeline markers (Upstream commit / Sasha Levin) if present
Step 1.3: ANALYZE THE COMMIT BODY TEXT
Record:
- Bug: Venom does not answer GET_CUR on feature units during probe; the USB microcontroller hangs and later transfers time out.
- Symptom: mixer build ~47 seconds; device does not stream.
- Contrast: same GET_CUR via libusb with no kernel driver is fast — hang is probe-path specific.
- Fix: composite quirk ignores interface 0 (AudioControl/mixer); interfaces 1–2 stay standard audio; 3 stays standard MIDI. Hardware already has volume knobs.
- Author: “With both this and the device flag applied, the synth works flawlessly.”
- Cover letter (v1 0/2): device has never worked over USB on Linux; users reported the port useless for years. dmesg without quirks:
cannot get freq at ep 0x2, then many failed to get current value / cannot get min/max with -110 (ETIMEDOUT), then looping usb_set_interface failed (-110). Flags alone list the card but produce no sound. Mixer skip is what made audio work.
- Tested on 7.1.8-arch1-3 xHCI (Intel PCH); alsa-info linked from v1.
Step 1.4: DETECT HIDDEN BUG FIXES
Record: Not hidden. Explicit hardware workaround: skip mixer creation so probe does not issue the GET_CUR sequence that wedges the MCU.
===============================================================
PHASE 2: DIFF ANALYSIS - LINE BY LINE
===============================================================
Step 2.1: INVENTORY THE CHANGES
Record:
- File: sound/usb/quirks-table.h only (+22 lines, 0 removed)
- Function: none; one usb_device_id / snd_usb_audio_quirk table entry
- Scope: single-file surgical hardware quirk
Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Record:
- Before: 0763:2084 is not in the quirk table. Generic class match in usb_audio_ids (USB_CLASS_AUDIO / USB_SUBCLASS_AUDIOCONTROL, card.c 1171–1173) claims it. Probe calls snd_usb_create_streams() then snd_usb_create_mixer() (card.c 899–903). Mixer build issues GET_MIN/GET_MAX/GET_CUR (get_min_max_with_quirks, init_cur_mix_raw in mixer.c).
- After: USB_DEVICE_VENDOR_SPEC(0x0763, 0x2084) + composite:
QUIRK_DATA_IGNORE(0) → ignore_interface_quirk() returns 0 (no mixer); QUIRK_DATA_STANDARD_AUDIO(1/2) → create_standard_audio_quirk() → snd_usb_parse_audio_interface(); QUIRK_DATA_STANDARD_MIDI(3). Because snd_usb_create_quirk() returns 0, card.c does not take the generic snd_usb_create_mixer() path.
Step 2.3: IDENTIFY THE BUG MECHANISM
Record: [Hardware workaround] Feature-unit GET_CUR during mixer init hangs the device MCU; skipping AudioControl interface 0 avoids those control messages. Same pattern as existing M-Audio entries (e.g. Quattro QUIRK_DATA_IGNORE(0) at ~1496).
Step 2.4: ASSESS THE FIX QUALITY
Record:
- Obviously correct: VID/PID-scoped; uses macros already in this tree; ignore-iface-0 is a long-standing pattern.
- Minimal: one table entry, no API/data-structure change.
- Regression risk: very low — only 0763:2084. Worst case if matching were wrong: that one device stays broken (current behavior).
- Companion: patch 1/2 adds DEVICE_FLG(0x0763, 0x2084, QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_DISABLE_AUTOSUSPEND). Parse still calls snd_usb_init_sample_rate() (stream.c:1255 → set_sample_rate_v1 GET_CUR). Full device function needs both; this patch still compiles and is safe alone.
===============================================================
PHASE 3: GIT HISTORY INVESTIGATION
===============================================================
Step 3.1: BLAME THE CHANGED LINES
Record:
- Insertion is after M-Audio Fast Track Ultra 8R 0x2081 (Felix Homann, 2010, fca5bca48759c) and before Casio (2006).
- Buggy path is generic mixer creation, not a recent regression. Class match dates to e5779998bf8b70 (2010).
- Venom has been broken on Linux since USB support was expected; not a new-subsystem bug.
Step 3.2: FOLLOW THE FIXES: TAG
Record: No Fixes: tag. N/A. Bug is device firmware vs generic UAC mixer, not a specific introducing commit.
Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES
Record:
- Recent same-file quirks already in this tree: YAMAHA CDS3000, Novation Mininova, RME Digiface, Pioneer DDJ-800, M-Audio Micro, etc.
- This entry is not present (rg found no 0x2084 / Venom).
- Series is standalone 2/2: this file vs quirks.c flags. No refactor prerequisite.
- Macros (QUIRK_DATA_IGNORE, QUIRK_DATA_COMPOSITE, USB_DEVICE_VENDOR_SPEC) from 0c3ad39b791c2 / d79e13f8e8abb, already here.
Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Record: No Andrade commits in sound/ on this tree. First-time ALSA contributor (cover: “first ever patch”). Weight is the maintainer apply, not author history.
Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
Record:
- Code dependency: none. Applies without patch 1/2.
- Functional dependency: patch 1/2 recommended so sample-rate GET_CUR / autosuspend do not hang the device. Flags used there (QUIRK_FLAG_GET_SAMPLE_RATE, QUIRK_FLAG_DISABLE_AUTOSUSPEND) already exist in usbaudio.h on this tree. Nearby mainline context uses QUIRK_FLAG_MIXER_GET_CUR_BROKEN (not in 6.12) — that is only a context line for patch 1, not this patch.
- Can apply standalone: yes.
===============================================================
PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
===============================================================
Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Record:
- b4 dig -c not run: commit is not in this checkout (no SHA to give b4).
- Thread via msgid [email protected]:
- Cover: https://lists.openwall.net/linux-kernel/2026/08/24/1347
- 1/2 flags: https://lists.openwall.net/linux-kernel/2026/08/24/1354
- 2/2 this patch: https://lists.openwall.net/linux-
kernel/2026/08/24/1356
- v1 cover: https://lists.openwall.net/linux-kernel/2026/08/22/126
- Revisions: v1 (22 Aug) → v2 (23 Aug, extra SOB) → v3 (24 Aug, drop duplicate SOB). Diff of this hunk unchanged across versions.
- Takashi Iwai on v3 1/2 (25 Aug 2026): “Applied both patches now. Thanks.” (https://lkml.iu.edu/2608.3/02561.html)
- No NAK. v2 comment was only “a single Signed-off-by is enough.”
- No reviewer Cc: stable; hardware quirks are still the documented exception.
Step 4.2: CHECK WHO REVIEWED THE PATCH
Record: To/Cc: linux-sound, linux-kernel, [email protected], [email protected] (maintainer, applied), plus unrelated Ccs (kuba, deucher). No extra Reviewed-by; maintainer apply is the review.
Step 4.3: SEARCH FOR THE BUG REPORT
Record: No bugzilla/syzbot. Author is the reporter; cover cites years of “USB useless on Linux.” dmesg + USBPcap + pyusb repro. Severity from
reporter: device never streams.
Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
Record: Two-patch series, both hardware quirks, independent files. This commit is 2/2 (mixer). 1/2 is the flags entry. Both needed for a working synth; neither is a code prerequisite of the other.
Step 4.5: CHECK STABLE MAILING LIST HISTORY
Record: lore.kernel.org/stable search for this VID/subject returned no Venom discussion. Not previously rejected for stable.
===============================================================
PHASE 5: CODE SEMANTIC ANALYSIS
===============================================================
Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
Record: No function bodies edited. Runtime path uses create_composite_quirk, ignore_interface_quirk, create_standard_audio_quirk, create_any_midi_quirk (quirks.c).
Step 5.2: TRACE CALLERS
Record:
- usb_audio_ids[] includes quirks-table.h (card.c:1169–1170).
- Match → usb_audio_probe → snd_usb_create_quirk → composite walk.
- Context: USB enumeration / driver probe, not IRQ/hot path.
Step 5.3: TRACE CALLEES
Record: IGNORE: no I/O. STANDARD_AUDIO: snd_usb_parse_audio_interface (may snd_usb_init_sample_rate). STANDARD_MIDI:snd_usb_midi_v2_create. No new alloc/lock.
Step 5.4: FOLLOW THE CALL CHAIN
Record: Plug in Venom → snd-usb-audio probe. Userspace not required. Reachable on any machine with CONFIG_SND_USB_AUDIO and this hardware.
Step 5.5: SEARCH FOR SIMILAR PATTERNS
Record: Many QUIRK_DATA_IGNORE(0) entries (19+), including other M-Audio 0x0763 devices. Established, not a new mechanism.
===============================================================
PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
===============================================================
Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?
Record:
- Tree: p-6.12-3-gc504cf0baa3d8, make kernelversion = 6.12.111.
- Generic mixer/probe path is present (card.c, mixer.c).
- No Venom / 0x2084 entry (rg over sound/usb).
- Bug is the generic UAC path vs this firmware, present for many years.
Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
Record: Clean apply. Local quirks-table.h 1816–1818 is the same Fast Track Ultra 8R end / Casio start as the diff. All macros exist. Expected
difficulty: clean apply.
Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE
Record: No Venom mixer or flags entry. No alternate fix. QUIRK_FLAG_MIXER_GET_CUR_BROKEN is not in 6.12 (unused by this patch).
===============================================================
PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
===============================================================
Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
Record: [sound/usb / ALSA usb-audio] [IMPORTANT] — common USB audio stack; this change is one VID/PID.
Step 7.2: ASSESS SUBSYSTEM ACTIVITY
Record: Active (recent CDS3000/Mininova quirks, resume cleanup). Quirk- table additions are routine and already land in this 6.12 tree.
===============================================================
PHASE 8: IMPACT AND RISK ASSESSMENT
===============================================================
Step 8.1: DETERMINE WHO IS AFFECTED
Record: Driver-specific — M-Audio Venom (0763:2084) owners. CONFIG_SND_USB_AUDIO. No effect on other devices.
Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Record: Plug in / probe. Certain. Unprivileged user can trigger by attaching the USB synth. Not a race.
Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Record:
- Failure: MCU hang, ~47s probe, ETIMEDOUT, no PCM/MIDI stream, repeated usb_set_interface failures.
- Severity: HIGH for those users (device unusable). Not a kernel panic/UAF. USB control timeout is 5000 ms (USB_CTRL_GET_TIMEOUT); many GET_CUR/GET_MIN/GET_MAX calls match the ~47s story.
Step 8.4: CALCULATE RISK-BENEFIT RATIO
Record:
- Benefit: high for Venom owners (first working Linux USB audio/MIDI). Matches “hardware quirk” exception. Cover letter: flags alone were not enough; this skip is what produced sound.
- Risk: very low (22 lines, one ID, existing macros).
- Ratio: strongly favors backport.
===============================================================
PHASE 9: FINAL SYNTHESIS
===============================================================
Step 9.1: COMPILE THE EVIDENCE
FOR:
- Real hardware bug: GET_CUR during mixer init hangs the MCU; no streaming.
- Author dmesg, USBPcap, libusb/pyusb, and “works with both quirks.”
- Device never worked on Linux; users have asked for years.
- Small VID/PID table entry; same pattern as other M-Audio quirks already in this tree.
- Maintainer Takashi Iwai applied v3.
- All macros and insertion context exist in 6.12.111.
- Hardware quirks / workarounds are an explicit stable exception.
- Does not change APIs or other devices.
AGAINST:
- Part of a 2/2 series; sample-rate + autosuspend flags are also needed for a fully working device.
- Niche synth, not a core-path crash.
- First-time contributor (offset by maintainer apply).
UNRESOLVED:
- Could not run b4 dig -c (commit not in this repo). Threads recovered from msgid/openwall/lkml.
- Did not independently attach a Venom (author + maintainer evidence used).
Step 9.2: APPLY THE STABLE RULES CHECKLIST
1. Obviously correct and tested? PASS — table-only, existing macros, author tested, maintainer applied.
2. Fixes a real bug that affects users? PASS — probe hang and silent/broken USB audio.
3. Important issue? PASS — HIGH: device freeze and total loss of function (not panic).
4. Small and contained? PASS — +22 lines, one file, one ID.
5. No new features or APIs? PASS — quirk for existing snd-usb-audio.
6. Can apply to the local tree? PASS — clean apply on 6.12.111.
Step 9.3: CHECK FOR EXCEPTION CATEGORIES
Record: Hardware quirk/workaround (ALSA usb-audio quirk table). Qualifies on that exception alone.
Step 9.4: MAKE YOUR DECISION
This should be backported to this 6.12 tree. It is a contained, VID/PID- scoped workaround that stops mixer GET_CUR from wedging the Venom so the existing driver can stream. The companion flags patch is a separate two- line quirk and is not a apply/compile dependency.
What it solves for stable users: without it, plugging in 0763:2084 runs generic mixer init, burns ~47s of USB timeouts, hangs the MCU, and never streams. With it, AudioControl is ignored and standard PCM/MIDI interfaces are used — the path the author verified.
Risk vs benefit: benefit is a working device for Venom owners; risk is limited to that ID. 6.12 already has the same table style and macros, so no rework.
Concerns: take the sample-rate/autosuspend flags patch too for full function; this commit is still correct and safe on its own.
Verification:
- [Phase 1] Parsed subject/tags/body: Skip mixer; SOB Andrade + Iwai; msgid 17003-3; no Fixes/stable Cc
- [Phase 1] Cover letter: never worked on Linux; dmesg -110; flags insufficient; mixer skip enabled sound
- [Phase 2] Diff: +22 in sound/usb/quirks-table.h; IGNORE(0)+STANDARD_AUDIO(1,2)+STANDARD_MIDI(3)
- [Phase 2] card.c 899–903: generic path creates mixer; quirk return 0 skips it
- [Phase 2] mixer.c get_min_max_with_quirks / init_cur_mix_raw:
GET_CUR/GET_MIN/GET_MAX on probe
- [Phase 2] ignore_interface_quirk returns 0; create_standard_audio_quirk parses then returns 0
- [Phase 3] Blame: insert after 0x2081 (2010) / before Casio (2006)
- [Phase 3] rg 0x2084/Venom: absent in this tree
- [Phase 3] Macros present (quirks-table.h 20–81)
- [Phase 3] No Andrade history in sound/ here
- [Phase 3] Companion flags: GET_SAMPLE_RATE + DISABLE_AUTOSUSPEND exist; MIXER_GET_CUR_BROKEN does not (irrelevant to this hunk)
- [Phase 4] lore/openwall v1–v3; technical diff unchanged; Iwai “Applied both patches”
- [Phase 4] v2 feedback: duplicate SOB only
- [Phase 4] stable list: no prior Venom discussion found
- [Phase 4] UNVERIFIED: b4 dig -c (no local SHA)
- [Phase 5] Call chain: usb_audio_ids → probe → create_composite_quirk
- [Phase 5] stream.c:1255 snd_usb_init_sample_rate on parse (why flags patch also matters)
- [Phase 5] 19+ existing QUIRK_DATA_IGNORE(0) including M-Audio Quattro
- [Phase 6] git describe p-6.12-3-gc504cf0baa3d8; make kernelversion 6.12.111
- [Phase 6] Insertion context matches; clean apply
- [Phase 7] SOUND maintainers Iwai/Kysela; quirk additions already in this 6.12 tree
- [Phase 8] Trigger: USB plug-in; timeout 5000 ms; severity HIGH for that device
- UNVERIFIED: live Venom reproduce
This is a small, tested hardware quirk for existing snd-usb-audio. It belongs on this 6.12 tree.
**YES**
sound/usb/quirks-table.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
sound/usb/quirks-table.h +22 -0
@@ -1814,6 +1814,28 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ +/* +* M-Audio Venom +* +* The AudioControl interface times out on every GET_CUR request, +* which adds around 47 seconds to the card registration and +* freezes the device, blocking streaming. +* Using an explicit composite quirk to skip the mixer entirely. +*/ +USB_DEVICE_VENDOR_SPEC (0x0763 ,0x2084 ), + QUIRK_DRIVER_INFO { + .vendor_name ="M-Audio" , + .product_name = "Venom", + QUIRK_DATA_COMPOSITE { + { QUIRK_DATA_IGNORE(0) }, + { QUIRK_DATA_STANDARD_AUDIO(1) }, + { QUIRK_DATA_STANDARD_AUDIO(2) }, + { QUIRK_DATA_STANDARD_MIDI(3) }, + QUIRK_COMPOSITE_END + } + } +},/* Casio devices */ {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 USB: gadget: inode: fix mm lifetime handling
In reply to Sasha LevinFrom: Gabriel Prostitis <[email protected]>
[ Upstream commit a1c33c80e11ecd5c3310a38c4be324095dd85ac5 ]
priv stores a pointer to the submitting task's mm_struct, but does not currently hold a reference to it while async requests are pending.
This can result in a use-after-free if the task exits before completion handling finishes.
Take a reference with mmgrab() when queuing the read request and release it with mmdrop() on request completion.
---
LLM Generated explanations, may be completely bogus:
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: **[USB gadget / gadgetfs] [fix] [hold an mm_struct reference for pending async endpoint I/O so completion cannot use a freed mm]**
- Subsystem prefix: USB: gadget: inode:
- Action verb: **fix**
- Intent: correct mm lifetime in the legacy gadgetfs AIO path
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Reported-by:** Gabriel Prostitis (author reported it)
- **Signed-off-by:** Gabriel Prostitis (author)
- **Acked-by:** Alan Stern (USB gadget reviewer)
- **Link:** https://patch.msgid.link/20260601-mm-uaf-
[email protected]
- **Signed-off-by:** Greg Kroah-Hartman (USB maintainer; merged)
- **Fixes:** none (expected for this review path)
- **Cc: stable:** none (expected)
- Ignored pipeline markers: none in the real commit (a1c33c80e11ec)
Notable: single reporter (the author), but **Acked-by Alan Stern** and merge by Greg KH. Cover letter (v2 0/2) states KASAN confirmed the UAF.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** kiocb_priv stores current->mm while async USB requests are pending, with no mm_count pin.
- **Symptom / failure mode:** use-after-free if the submitting task exits before completion handling. Cover letter (lore): KASAN UAF in the workqueue path; possible **memory corruption in another process’s address space** if the freed mm_struct is reused. Trigger: async reads on OUT endpoints (io_uring called out for FunctionFS; gadgetfs has the same read_iter AIO path).
- **Version info:** none in the commit; buggy priv->mm = current->mm dates to 2013 (a80bf61ef36da4, contained in v3.10-rc1).
- **Root cause (author):** stored mm pointer without mmgrab(); completion uses it via kthread_use_mm().
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not hidden.** Subject and body are an explicit UAF/lifetime fix. The extra mmget_not_zero() around kthread_use_mm() matches the documented mmgrab() contract in include/linux/sched/mm.h.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **File:** drivers/usb/gadget/legacy/inode.c — **+13 / −4** (17 lines changed)
- **Functions:** ep_user_copy_worker(), ep_aio_complete(), ep_aio()
- **Scope:** single-file surgical fix
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
1. **ep_aio() (queue):** still stores priv->mm = current->mm; now **mmgrab(priv->mm)**. Fail path after that **mmdrop(priv->mm)**.
2. **ep_aio_complete() (USB complete, writes / zero-length reads):** completes immediately; now **mmdrop(priv->mm)** before freeing priv.
3. **ep_user_copy_worker() (async read copy):** previously kthread_use_mm(mm) on an unpinned pointer. Now mmget_not_zero(mm) → copy → mmput → always **mmdrop(mm)**. If the address space is already gone, return -EFAULT instead of touching a dying mm.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** use-after-free / reference counting (mm_struct.mm_count / mm_users)
- **Mechanism:** priv->mm was a raw pointer. kthread_use_mm() itself does mmgrab(mm) (kernel/kthread.c), which is a UAF if mm is already freed. Classic AIO exit_aio() does **not** cover io_uring. Cover letter: process exit while a request is pending frees mm while the worker still holds the pointer.
- **Fix:** pin with mmgrab() for the struct lifetime; mmget_not_zero() before using the address space, as documented.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** obviously correct and matches mmgrab()/mmget_not_zero() docs. Refcounts are balanced: grab on queue; drop on fail, immediate complete, and worker.
- **Minimal:** no unrelated edits.
- **Regression risk:** low. Worst case after process exit is -EFAULT instead of a copy into a dead mm. No new API, no lock-order change. mmgrab(NULL) is not a realistic syscall path (ep_read_iter/ep_write_iter from userspace).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record:
- Buggy store priv->mm = current->mm and worker: **a80bf61ef36da4** (“gadget: remove only user of aio retry”, Zach Brown, **2013-05-07**, **v3.10-rc1**).
- kthread_use_mm/kthread_unuse_mm: f5678e7f2ac31c (2020).
- Pattern has been in tree for many years, including this 7.3 checkout.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: **No Fixes: tag.** Not applicable. Introducer is a80bf61ef36da4, present in this tree (blame on the parent of the fix).
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record:
- Related: **5eb5c72c72fef** “USB: gadget: ffs: fix mm lifetime handling” (patch 1/2, parent of this commit). Different file (f_fs.c); **not a code dependency**.
- After this commit on inode.c: only dd0eed9e165b1 (unrelated ioctl NULL deref).
- **Standalone** for gadgetfs.
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: Gabriel Prostitis has these two USB gadget mm-lifetime commits. Not the subsystem maintainer. **Alan Stern Acked-by** on this inode patch; Greg KH merged both.
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: Uses mmgrab/mmdrop/mmget_not_zero/kthread_use_mm, all present here. No new helpers. Patch 1/2 is a sibling, not a prerequisite. **Applies standalone.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record:
- **b4 dig:** https://patch.msgid.link/20260601-mm-uaf-
[email protected]
- **Series:** v1 (2026-05-31), v2 (2026-06-01). v2 cover: “Fix swapped lines in inode.c”; v2 is what was merged.
- Cover letter: UAF in FunctionFS **and** gadgetfs; kthread_use_mm() in workqueue; KASAN; io_uring-style async read + exit; possible cross- process corruption.
- **No NAKs.** Ping 2026-06-30; Greg KH replied that the merge window delayed review, then merged 2026-07-10.
- **No explicit Cc: stable** in the thread (mbox).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: **b4 dig -w** recipients: author, Greg KH, linux-usb, linux- kernel, **Alan Stern**. Stern’s Acked-by is on the inode.c patch.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: Author is the reporter. Cover letter cites KASAN on the workqueue completion path. Direct lore HTTP fetches returned **403**; thread body recovered via **b4 dig -m**.
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: **v2 1/2** USB: gadget: ffs: fix mm lifetime handling (5eb5c72c72fef) is the FunctionFS analogue. Independent file. This 2/2 is self-contained for gadgetfs.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: lore.kernel.org/stable search returned **403**. **UNVERIFIED** whether stable@ discussed this. No Cc: stable on the patch itself (not a negative signal here).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
Record: ep_aio(), ep_aio_complete(), ep_user_copy_worker(). (semcode MCP not available.)
**Step 5.2: TRACE CALLERS**
Record:
- ep_aio() ← ep_read_iter() / ep_write_iter() when !is_sync_kiocb(iocb)
- Those are ep_io_operations.read_iter / .write_iter (gadgetfs endpoint files)
- ep_aio_complete() ← USB gadget usb_request.complete (often IRQ/softirq)
- ep_user_copy_worker() ← schedule_work() from that complete path
Reachable from **io_submit / io_uring** on gadgetfs endpoint fds, plus USB completion.
**Step 5.3: TRACE CALLEES**
Record: mmgrab/mmdrop/mmget_not_zero/mmput, kthread_use_mm/kthread_unuse_mm, copy_to_iter, usb_ep_queue/usb_ep_alloc_request/usb_ep_free_request, ki_complete.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: userspace AIO/io_uring on gadgetfs ep file → ep_aio stores mm → USB complete → worker kthread_use_mm + copy_to_iter. **Userspace- reachable** if gadgetfs is mounted and configured (typically privileged USB gadget role).
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: Same bug in drivers/usb/gadget/function/f_fs.c (io_data->mm), fixed by sibling 5eb5c72c72fef. Systematic copy of the 2013 “stash mm, copy in worker” 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 = **v7.3-rc4-27-gf0100363d8c37**; make kernelversion = **7.3.0-rc4**
- File and AIO path exist. Pre-fix code is in a1c33c80e11ec^. Introduced **v3.10** (a80bf61ef36da4). **Bug exists in this lineage.**
- git merge-base --is-ancestor a1c33c80e11ec HEAD → yes (used only to inspect the candidate, not as “already selected”).
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply on this tree.** Surrounding code matches the diff. mmgrab/mmdrop/mmget_not_zero/kthread_use_mm are present. inode.c does not include linux/sched/mm.h directly; mmgrab is visible via existing includes (e.g. pagemap.h → mmap_lock.h → sched/mm.h) in **this** tree.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: No earlier alternate gadgetfs mm-lifetime fix. Sibling FunctionFS fix is separate. No competing fix for this inode.c UAF.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM**
Record: **USB gadgetfs** (drivers/usb/gadget/legacy/). **IMPORTANT/PERIPHERAL:** not core mm/VFS, but a supported (non-staging) USB gadget userspace API. FunctionFS is more common; gadgetfs is still shipped and has the same UAF.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: File is mature (code from 2005–2013 with occasional fixes). Low churn. Long-lived bug, not a brand-new subsystem.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: WHO IS AFFECTED**
Record: **Config-specific / driver-specific:** CONFIG_USB_GADGETFS, async I/O on gadgetfs endpoints, process exit before USB complete. Not all machines, but real gadgetfs userspace drivers.
**Step 8.2: TRIGGER CONDITIONS**
Record: Async read (or write, for the pin) on a gadgetfs endpoint, then the submitting task exits before ep_aio_complete / worker. Cover
letter: io_uring-style async + exit. Timing-dependent but realistic. Typically needs gadgetfs access (usually privileged), **not** a random unprivileged syscall on a default desktop.
**Step 8.3: FAILURE MODE SEVERITY**
Record: **Use-after-free of mm_struct** → KASAN crash or **cross- process memory corruption**. **Severity: HIGH** (UAF / security-adjacent corruption). Not a log-only issue.
**Step 8.4: RISK-BENEFIT RATIO**
Record:
- **Benefit: HIGH** for gadgetfs AIO users — stops UAF/corruption.
- **Risk: LOW** — 13 insertions, 4 deletions, refcount pin matching documented API, Acked-by Stern.
- **Ratio:** benefit clearly outweighs risk.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR:**
- Real UAF of mm_struct when async gadgetfs I/O outlives the task
- Cover letter: KASAN; possible corruption of another process’s mm
- Small, contained, refcounts balanced
- Matches mmgrab() documentation
- Acked-by Alan Stern; merged by Greg KH
- Code and APIs exist in this v7.3-rc4 tree; bug dates to v3.10
- Standalone (patch 2/2 does not need 1/2)
**AGAINST:**
- Gadgetfs is a narrower, legacy userspace gadget API
- Trigger needs gadgetfs + async I/O + exit-before-complete
- No Fixes: / Cc: stable (not a negative for this process)
**UNRESOLVED:**
- lore.kernel.org HTTP 403; stable@ discussion not independently confirmed beyond the mbox from b4 dig
- No public syzbot hash in the commit (KASAN is from the cover letter)
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — API-correct pin; v2 after a v1 line-swap mistake; Stern ack
2. Fixes a real bug that affects users? **PASS** — UAF on gadgetfs async completion
3. Important (crash, security, corruption, deadlock)? **PASS** — UAF / possible cross-process corruption (**HIGH**)
4. Small and contained? **PASS** — one file, +13/−4
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — context and helpers exist here
**Step 9.3: EXCEPTION CATEGORIES**
Record: none (not a device ID / quirk / DT / build / docs exception). Qualifies as a normal important bugfix.
**Step 9.4: DECISION**
This is a small, reviewed UAF fix for code that exists in this tree. Process exit during gadgetfs AIO can free mm_struct while ep_user_copy_worker() still calls kthread_use_mm(). That is a real stability/security bug, not cleanup. Risk of the pin itself is low.
### What the commit solves for this tree
ep_aio() saved current->mm without an mm_count reference. Completion may run after the task is gone (especially io_uring, which is not exit_aio()). The worker then used a dangling mm_struct. Pinning with mmgrab() and using mmget_not_zero() before the copy closes that window.
### Risk vs benefit
Benefit is preventing kernel UAF/corruption on a reachable gadgetfs AIO path. Risk is a few refcount operations on a slow path. No structural or API change.
### Concerns
Patch 2/2 of a series, but independent of FunctionFS. v1 had swapped lines; merged v2 is the one to use. Direct lore HTTP was blocked; discussion was recovered with b4 dig -m.
---
### Verification
- **[Phase 1]** git log -1 a1c33c80e11ec: subject/tags as above; no Fixes/Cc:stable
- **[Phase 2]** git show a1c33c80e11ec: +13/−4 in inode.c; mmgrab on queue; mmdrop on fail, immediate complete, and worker; mmget_not_zero around copy
- **[Phase 2]** Read ep_aio/ep_aio_complete/ep_user_copy_worker in this tree: refcounts balanced
- **[Phase 2]** include/linux/sched/mm.h: mmgrab docs require mmget_not_zero before using the address space
- **[Phase 2]** kernel/kthread.c kthread_use_mm(): mmgrab on the passed mm — UAF if mm already freed
- **[Phase 3]** git blame on parent: priv->mm from a80bf61ef36da4 (v3.10-rc1, 2013)
- **[Phase 3]** git describe --contains a80bf61ef36da4 → v3.10-rc1~50^2~20
- **[Phase 3]** Sibling 5eb5c72c72fef is f_fs.c only; not required for inode.c
- **[Phase 3]** git log --author="Gabriel Prostitis" -- drivers/usb/:
only these two mm-lifetime commits
- **[Phase 3]** git merge-base --is-ancestor a1c33c80e11ec HEAD: is ancestor (inspection only)
- **[Phase 4]** b4 dig -c a1c33c80e11ec: v2 2/2 lore URL
- **[Phase 4]** b4 dig -a: v1 then v2; v2 cover notes inode.c swapped- line fix
- **[Phase 4]** b4 dig -w: Greg KH, linux-usb, Alan Stern
- **[Phase 4]** b4 dig -m /tmp/gadget-mm-uaf.mbox: KASAN, io_uring trigger, cross-process corruption; Stern ack; no NAK; Greg delay-then- merge
- **[Phase 4]** WebFetch/curl lore: **403** — UNVERIFIED via HTTP; mbox used instead
- **[Phase 4]** stable@ search: **403** — UNVERIFIED
- **[Phase 5]** grep: ep_aio only from ep_read_iter/ep_write_iter; those are ep_io_operations
- **[Phase 5]** Same mm stash in f_fs.c, fixed separately
- **[Phase 6]** git describe HEAD / make kernelversion: **v7.3-rc4** / **7.3.0-rc4**
- **[Phase 6]** Buggy path present before a1c33c80e11ec; helpers present
- **[Phase 7]** USB_GADGETFS in drivers/usb/gadget/legacy/Kconfig
- **[Phase 8]** Failure mode: mm UAF → oops or cross-process corruption; HIGH
- **UNVERIFIED:** whether stable@ already discussed this (lore 403); no syzbot ID in the commit
**YES**
drivers/usb/gadget/legacy/inode.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/gadget/legacy/inode.c +13 -4
@@ -473,11 +473,17 @@ static void ep_user_copy_worker(struct work_struct *work)struct kiocb *iocb = priv->iocb;size_t ret; -kthread_use_mm (mm); - ret =copy_to_iter (priv->buf, priv->actual, &priv->to); -kthread_unuse_mm (mm); -if (!ret) +if (mmget_not_zero (mm)) { +kthread_use_mm (mm); + ret =copy_to_iter (priv->buf, priv->actual, &priv->to); +kthread_unuse_mm (mm); +mmput (mm); +if (!ret) + ret = -EFAULT ; + }else { ret = -EFAULT ; + } +mmdrop (mm);/* completing the iocb can drop the ctx and mm, don't touch mm after */ iocb->ki_complete (iocb, ret);
@@ -503,6 +509,7 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)* complete the aio request immediately. */ if (priv->to_free ==NULL ||unlikely (req->actual ==0 )) { +mmdrop (priv->mm);kfree (req->buf);kfree (priv->to_free);kfree (priv);
@@ -543,6 +550,7 @@ static ssize_t ep_aio(struct kiocb *iocb, priv->epdata = epdata; priv->actual =0 ; priv->mm = current->mm;/* mm teardown waits for iocbs in exit_aio() */ +mmgrab (priv->mm);/* each kiocb is coupled to one usb_request, but we can't * allocate or submit those if the host disconnected.
@@ -572,6 +580,7 @@ static ssize_t ep_aio(struct kiocb *iocb, fail:spin_unlock_irq (&epdata->dev->lock); +mmdrop (priv->mm);kfree (priv->to_free);kfree (priv);put_ep (epdata);
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] USB: gadget: inode: fix mm lifetime handling
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] usb: gadget: inode: mmdrop() called in atomic context in ep_aio_complete() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: gadget: inode: mmdrop() called in atomic context in ep_aio_complete() --
commit 1034aa9a2c06c8a1a74aa881eb54ff67ca5c0fee
Author: Gabriel Prostitis <[email protected]>
USB: gadget: inode: fix mm lifetime handling
This commit fixes a use-after-free in gadgetfs async I/O handling by pinning the submitting task's mm_struct with mmgrab() in ep_aio() and releasing it with mmdrop() upon request completion. It also uses mmget_not_zero() in ep_user_copy_worker() before switching to the address space.
Quoted 4 lines
drivers/usb/gadget/legacy/inode.c +0
-0
[ ... ]
drivers/usb/gadget/legacy/inode.c static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req) · line 512
Quoted 5 lines
drivers/usb/gadget/legacy/inode.c +1
-0@@ -503,6 +509,7 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)* complete the aio request immediately. */ if (priv->to_free ==NULL ||unlikely (req->actual ==0 )) { +mmdrop (priv->mm);
[Severity: High]
Is it safe to call mmdrop(priv->mm) directly in ep_aio_complete()?
ep_aio() pins current->mm with mmgrab(priv->mm) for all async requests. If the submitting task exits before the USB request completes (for example, with io_uring or a forked process where do_exit() -> exit_mm() -> mmput() runs before completion), priv->mm can hold the final reference on mm->mm_count.
When the request completes and takes the immediate completion branch (priv->to_free == NULL || unlikely(req->actual == 0)) — which occurs for async writes, single-buffer ITER_UBUF reads where dup_iter() returns NULL, zero-length reads, errors, disconnects, or cancellations via ep_aio_cancel() -> usb_ep_dequeue() — ep_aio_complete() runs as the usb_request->complete callback with interrupts disabled and while holding spin_lock(&epdata->dev->lock):
drivers/usb/gadget/legacy/inode.c:ep_aio_complete() {
spin_lock(&epdata->dev->lock);
priv->req = NULL;
priv->epdata = NULL;
if (priv->to_free == NULL || unlikely(req->actual == 0)) {
mmdrop(priv->mm);
}If mmdrop(priv->mm) drops the last reference, it invokes __mmdrop() from atomic, interrupts-disabled context:
kernel/fork.c:__mmdrop() {
...
cleanup_lazy_tlbs(mm);
WARN_ON_ONCE(mm == current->active_mm);
mm_free_pgd(mm);
...
}This appears to cause a few issues:
1. On architectures with CONFIG_MMU_LAZY_TLB_SHOOTDOWN=y, __mmdrop() -> cleanup_lazy_tlbs() -> on_each_cpu_mask() -> smp_call_function_many_cond() waits synchronously for cross-CPU IPIs, triggering lockdep_assert_irqs_enabled() and WARN_ON_ONCE(!in_task()) in kernel/smp.c and potentially deadlocking with interrupts disabled.
2. On x86, __mmdrop() -> mm_free_pgd() -> pgd_free() -> pgd_dtor() acquires spin_lock(&pgd_lock) without disabling interrupts:
arch/x86/mm/pgtable.c:pgd_dtor() {
spin_lock(&pgd_lock);
pgd_list_del(pgd);
spin_unlock(&pgd_lock);
}As noted in free_signal_struct() in kernel/fork.c, __mmdrop() is not safe to call from interrupt or softirq context on x86 because taking pgd_lock can deadlock if the interrupted context already holds pgd_lock.
3. On CONFIG_PREEMPT_RT=y, __mmdrop() acquires sleeping spinlock_t locks while interrupts are disabled and a spinlock is held.
Should ep_aio_complete() use mmdrop_async(priv->mm) here (or avoid grabbing priv->mm when priv->to_free == NULL, since the worker is only scheduled when priv->to_free != NULL)?
Quoted 3 lines
drivers/usb/gadget/legacy/inode.c +0
-0kfree (req->buf);kfree (priv->to_free);kfree (priv);
[ ... ]
Quoted 5 lines
drivers/usb/gadget/legacy/inode.c +1
-0@@ -543,6 +550,7 @@ static ssize_t ep_aio(struct kiocb *iocb, priv->epdata = epdata; priv->actual =0 ; priv->mm = current->mm;/* mm teardown waits for iocbs in exit_aio() */ +mmgrab (priv->mm);
[ ... ]
Quoted 8 lines
drivers/usb/gadget/legacy/inode.c +1
-0@@ -572,6 +580,7 @@ static ssize_t ep_aio(struct kiocb *iocb, fail:spin_unlock_irq (&epdata->dev->lock); +mmdrop (priv->mm);kfree (priv->to_free);kfree (priv);put_ep (epdata);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1