wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
Subsystems (80)
Sasha Levin
maintainerPATCH 1/1 crypto: ixp4xx - fix buffer chain unwind on allocation failure
In reply to Sasha LevinFrom: Ruoyu Wang <[email protected]>
[ Upstream commit 25056329384010a8672552b134f609601dc4f80e ]
chainup_buffers() builds a linked list of buffer descriptors for a scatterlist. If dma_pool_alloc() fails while constructing the list, the current code sets buf to NULL and later dereferences it unconditionally at the end of the function:
buf->next = NULL; buf->phys_next = 0;
This can lead to a null-pointer dereference on allocation failure.
If the failure happens after part of the descriptor chain has already been allocated and DMA-mapped, the partially constructed chain also needs to be released.
Fix this by terminating the partially constructed chain on allocation failure and letting the callers unwind it via their existing cleanup paths. Also fix ablk_perform() to preserve the hook pointers before checking for failure, so partially built chains can be freed correctly.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [crypto: ixp4xx] [fix] fix buffer chain unwind on allocation failure in chainup_buffers()/ablk_perform()
**Step 1.2 — Tags**
Record:
- Signed-off-by: Ruoyu Wang <[email protected]> — author
- Acked-by: Linus Walleij <[email protected]> — ARM/platform maintainer ack
- Signed-off-by: Herbert Xu <[email protected]> — crypto maintainer merge
- No Fixes: tag (expected for manual review)
- No Reported-by: / Link: / Cc: [email protected]
- Notable: maintainer ack from Linus Walleij; Herbert Xu applied v2 per lore
**Step 1.3 — Body analysis**
Record:
- **Bug:** chainup_buffers() on dma_pool_alloc() failure sets buf = NULL, breaks, then unconditionally does buf->next = NULL → NULL pointer dereference.
- **Secondary bug:** Partially built descriptor chains are not terminated/freed on failure.
- **Symptom:** Kernel oops on allocation failure; possible DMA-pool leak if the NULL deref were avoided without proper unwind.
- **Root cause:** Incorrect error handling in chainup_buffers(); ablk_perform() checks return value before saving hook pointers, so cleanup cannot free partial chains.
- **Version info:** None in commit message.
**Step 1.4 — Hidden bug fix?**
Record: No — this is an explicit bug fix (NULL deref + resource leak on error path), not disguised cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c (+14 / −11, ~25 lines)
- **Functions:** chainup_buffers(), ablk_perform()
- **Scope:** Single-file surgical fix
**Step 2.2 — Code flow changes**
Record:
- **Hunk 1 (chainup_buffers):** Before: on alloc failure, buf = NULL; break; then fall through to buf->next = NULL (crash). After:
terminate current buf chain (buf->next = NULL; buf->phys_next = 0) and return NULL immediately.
- **Hunk 2 (ablk_perform):** Before: if (!chainup_buffers(...)) goto cleanup before saving dst_hook/src_hook into req_ctx and crypt. After: assign return to buf, always save hook pointers first, then if (!buf) goto cleanup — matching the pattern already used in aead_perform().
**Step 2.3 — Bug mechanism**
Record:
- **Category:** NULL pointer dereference + error-path resource leak
- **Mechanism:** On dma_pool_alloc() failure, buf becomes NULL but is dereferenced at function end. Even if that were avoided, ablk_perform() would jump to cleanup without populating req_ctx->dst/src and crypt->dst_buf/src_buf, so free_buf_chain() would not release partially allocated chains.
**Step 2.4 — Fix quality**
Record: Fix is minimal, obviously correct, and aligns ablk_perform() with the existing correct pattern in aead_perform(). Low regression risk — only affects failure paths.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: git blame on chainup_buffers() lines 872–902 attributes all lines to 5d324e5159d9e (Nov 28, 2025 merge). This checkout’s history is shallow around this file; exact introduction commit of the buggy pattern could not be determined here. The driver itself dates to 2008 per file header.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag present.
**Step 3.3 — Related file history**
Record: git log --oneline -20 -- drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c shows only the merge commit in this tree. Fix commit is **not** present (git log --grep="buffer chain" returns nothing). Buggy code confirmed at lines 886–900 and 1028–1040.
**Step 3.4 — Author context**
Record: No prior Ruoyu Wang commits in this tree’s drivers/crypto/intel/ixp4xx/ history. Patch was reviewed by crypto maintainer Herbert Xu (v2 incorporated his feedback).
**Step 3.5 — Dependencies**
Record: Standalone fix; no series dependencies. aead_perform() in the same file already uses the post-fix calling convention, confirming the API contract.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: Patch v2 submitted Apr 23, 2026 to linux-crypto. Thread:
https://lists.openwall.net/linux-kernel/2026/04/23/864. v2 changes per Herbert Xu: keep unwind in callers, terminate partial chain, save hook pointers in ablk_perform(). Herbert Xu replied “Patch applied. Thanks.” (May 5, 2026).
**Step 4.2 — Reviewers**
Record: To: Herbert Xu, Corentin Labbe, linux-crypto. Cc: Linus Walleij, Imre Kaloz, David S. Miller, linux-arm-kernel, linux-kernel. Appropriate maintainers were included.
**Step 4.3 — Bug report**
Record: No external bug report or syzbot report. Bug identified by code review / author analysis.
**Step 4.4 — Series context**
Record: v1 used internal free_buf_chain() in chainup_buffers(); v2 (committed version) moved unwind to callers per maintainer feedback. Committed version is the latest revision.
**Step 4.5 — Stable list discussion**
Record: No stable-list discussion found. Absence of Cc: stable is not a negative signal per review guidelines.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: chainup_buffers(), ablk_perform(), free_buf_chain()
**Step 5.2 — Callers**
Record: chainup_buffers() called from:
- ablk_perform() (lines 1028, 1038) — **buggy caller pattern**
- aead_perform() (lines 1140, 1160) — **already correct pattern**
ablk_perform() called from ablk_encrypt(), ablk_decrypt(), ablk_rfc3686_crypt().
**Step 5.3 — Callees**
Record: dma_pool_alloc(), dma_map_single(), sg_virt(), sg_next(), free_buf_chain() (on error paths)
**Step 5.4 — Reachability**
Record: Reachable from userspace crypto operations (skcipher encrypt/decrypt) on systems with CONFIG_CRYPTO_DEV_IXP4XX and IXP4xx hardware (ARCH_IXP4XX). Trigger requires dma_pool_alloc() failure (memory pressure or pool exhaustion), most likely under GFP_ATOMIC when CRYPTO_TFM_REQ_MAY_SLEEP is unset.
**Step 5.5 — Similar patterns**
Record: aead_perform() already implements the correct post-fix pattern, demonstrating this is the intended API usage and ablk_perform() was simply inconsistent.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.43)
**Step 6.1 — Buggy code present?**
Record: **YES.** Local tree is 6.18.43 (git describe:v6.18.43-1-gc7f0dac02d232). Buggy code at:
```886:901:drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
if (!next_buf) {
buf = NULL;
break;
}
// ...
buf->next = NULL;
buf->phys_next = 0;
return buf;
```and buggy ablk_perform() caller pattern at lines 1028–1040. Fix is **not** yet applied.
**Step 6.2 — Backport complications**
Record: Expected **clean apply** — current source matches the patch’s index fcc0cf4df..5b90cf0fb base context exactly.
**Step 6.3 — Related fixes already present?**
Record: No equivalent fix found via git log --grep. aead_perform() already has correct hook-pointer handling but does not fix the chainup_buffers() NULL deref.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: drivers/crypto/intel/ixp4xx/ — crypto hardware driver for Intel IXP4xx NPE. **Criticality: PERIPHERAL** (platform-specific embedded hardware), but error path is in common crypto request handling.
**Step 7.2 — Activity**
Record: drivers/crypto/ has active maintenance in this tree (recent qat, tegra, cavium fixes). IXP4xx driver file shows limited recent churn in this checkout.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Systems with CONFIG_CRYPTO_DEV_IXP4XX (depends on ARCH_IXP4XX || COMPILE_TEST, plus IXP4XX_QMGR and IXP4XX_NPE). Primarily embedded IXP4xx/ARM routers and similar devices using hardware crypto acceleration.
**Step 8.2 — Trigger conditions**
Record: Skcipher crypto request through ablk_perform() when dma_pool_alloc() fails mid-chain. Uncommon but realistic under memory pressure. Userspace can initiate crypto ops; failure is not theoretical once pool is exhausted.
**Step 8.3 — Failure mode severity**
Record:
- **Primary:** NULL pointer dereference → kernel oops (**CRITICAL** when triggered)
- **Secondary:** Partial buffer-chain leak on alloc failure without proper hook setup (**HIGH** — DMA pool exhaustion)
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** Prevents kernel crash and fixes error-path resource leak in hardware crypto path
- **Risk:** Very low — ~25 lines, failure-path only, matches existing aead_perform() pattern, maintainer-reviewed
- **Ratio:** Clear benefit outweighs risk for this tree
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
**FOR backport:**
- Real, verifiable NULL deref on error path
- Secondary resource-leak fix in ablk_perform()
- Small, surgical, single-file change
- Acked by Linus Walleij; applied by crypto maintainer Herbert Xu after review
- Buggy code confirmed present in local 6.18.43 tree; fix not yet applied
- Patch should apply cleanly
- Same-file aead_perform() validates the fix approach
**AGAINST backport:**
- Niche hardware (IXP4xx only) — smaller user base
- Requires dma_pool_alloc() failure — not everyday, but real under pressure
- No syzbot/user crash report (found via review)
**Unresolved:** Exact commit that introduced the buggy buf = NULL; break pattern could not be determined from this tree’s shallow file history.
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — logic is clear; maintainer reviewed and applied v2
2. Fixes a real bug? **PASS** — NULL deref + leak on alloc failure
3. Important issue? **PASS** — kernel oops (CRITICAL when triggered); memory leak (HIGH)
4. Small and contained? **PASS** — 1 file, ~25 lines, failure paths only
5. No new features/APIs? **PASS** — error-handling fix only
6. Can apply to local tree? **PASS** — buggy code present; clean apply expected
**Step 9.3 — Exception categories**
Record: None (not device ID, quirk, DT, build, or docs). Standard bug- fix backport.
**Step 9.4 — Decision rationale**
For Linux **6.18.43**, this commit fixes a confirmed NULL pointer dereference and an associated error-path resource leak in an existing driver that is present and buggy in this tree. The fix is small, maintainer-reviewed, and follows an established pattern already used in the same file. While the hardware is niche, stable trees routinely accept driver crash fixes of this nature.
---
## Verification
- [Phase 1] Parsed subject, tags, and body from provided commit message and openwall lore thread
- [Phase 1] Confirmed Acked-by: Linus Walleij; Herbert Xu merge SOB
- [Phase 2] Read current chainup_buffers() at lines 886–901: confirmed buf = NULL; break followed by buf->next = NULL (NULL deref)
- [Phase 2] Read current ablk_perform() at lines 1028–1040: confirmed hook pointers saved after failure check
- [Phase 2] Read aead_perform() at lines 1140–1166: confirmed correct post-fix pattern already present
- [Phase 2] Read free_buf_chain() at lines 333–347: confirmed cleanup depends on valid hook pointers
- [Phase 3] git describe HEAD → v6.18.43-1-gc7f0dac02d232; make kernelversion → 6.18.43
- [Phase 3] git blame -L 872,902 → buggy lines present (attrib. limited by tree history)
- [Phase 3] git log --grep="buffer chain" → no fix commit in tree
- [Phase 4] Fetched https://lists.openwall.net/linux-
kernel/2026/04/23/864 — v2 patch content and maintainer apply confirmed
- [Phase 4] UNVERIFIED: b4 dig -c <hash> — fix commit hash not in local tree
- [Phase 5] grep chainup_buffers — 3 call sites: 2 in ablk_perform, 2 in aead_perform
- [Phase 6] Confirmed driver exists:
drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
- [Phase 6] Read Kconfig: CONFIG_CRYPTO_DEV_IXP4XX depends on ARCH_IXP4XX || COMPILE_TEST
- [Phase 6] Patch base context matches current file (lines 886–889, 1028–1040 identical to diff)
- [Phase 8] Failure mode: NULL deref → kernel oops; partial chain leak without ablk_perform() fix
**YES**
drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c +14 -11
@@ -884,8 +884,9 @@ static struct buffer_desc *chainup_buffers(struct device *dev, ptr =sg_virt (sg); next_buf =dma_pool_alloc (buffer_pool, flags, &next_buf_phys);if (!next_buf) { - buf =NULL ; -break ; + buf->next =NULL ; + buf->phys_next =0 ; +return NULL ; }sg_dma_address (sg) =dma_map_single (dev, ptr, len, dir); buf->next = next_buf;
@@ -983,7 +984,7 @@ static int ablk_perform(struct skcipher_request *req, int encrypt)unsigned int nbytes = req->cryptlen;enum dma_data_direction src_direction =DMA_BIDIRECTIONAL ;struct ablk_ctx *req_ctx =skcipher_request_ctx (req); -struct buffer_desc src_hook; +struct buffer_desc *buf, src_hook;struct device *dev = &pdev->dev;unsigned int offset; gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
@@ -1025,22 +1026,24 @@ static int ablk_perform(struct skcipher_request *req, int encrypt)/* This was never tested by Intel * for more than one dst buffer, I think. */ req_ctx->dst =NULL ; -if (!chainup_buffers (dev, req->dst, nbytes, &dst_hook, - flags,DMA_FROM_DEVICE )) - goto free_buf_dest; - src_direction =DMA_TO_DEVICE ; + buf =chainup_buffers (dev, req->dst, nbytes, &dst_hook, + flags,DMA_FROM_DEVICE ); req_ctx->dst = dst_hook.next; crypt->dst_buf = dst_hook.phys_next; +if (!buf) + goto free_buf_dest; + src_direction =DMA_TO_DEVICE ; }else { req_ctx->dst =NULL ; } req_ctx->src =NULL ; -if (!chainup_buffers (dev, req->src, nbytes, &src_hook, flags, - src_direction)) - goto free_buf_src; - + buf =chainup_buffers (dev, req->src, nbytes, &src_hook, flags, + src_direction); req_ctx->src = src_hook.next; crypt->src_buf = src_hook.phys_next; +if (!buf) + goto free_buf_src; + crypt->ctl_flags |=CTL_FLAG_PERFORM_ABLK ;qmgr_put_entry (send_qid,crypt_virt2phys (crypt));BUG_ON (qmgr_stat_overflow (send_qid));
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 smb/client: reduce fallocate zero buffer allocation
In reply to Sasha LevinFrom: Huiwen He <[email protected]>
[ Upstream commit 9e4ec3be67af41ab859302d7109b34976efd9258 ]
The fallocate emulation allocates a 1 MiB zero-filled buffer even though each SMB2_write request is limited to SMB2_MAX_BUFFER_SIZE, which is 64 KiB. A high-order 1 MiB allocation is more likely to fail on a fragmented system.
Allocate only the smaller of the requested range and SMB2_MAX_BUFFER_SIZE, and reuse that zero-filled buffer for every write request. Also reject a successful write that makes no progress to avoid looping indefinitely.
This reduces the contiguous allocation required by fallocate emulation without changing the written data or range semantics.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [smb/client] [reduce] — Reduce the zero-filled buffer size used by SMB3 fallocate emulation.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Huiwen He <[email protected]> (author)
- Reviewed-by: ChenXiaoSong <[email protected]>
- Signed-off-by: Steve French <[email protected]> (subsystem maintainer)
- No Fixes:, Reported-by:, Tested-by:, `Cc:
[email protected], or Link:` tags
- Notable: maintainer review chain present; no explicit reporter or stable nomination
**Step 1.3 — Body analysis**
Record:
- **Bug:** smb3_simple_fallocate_range() allocates a 1 MiB zero buffer even though each SMB2_write is capped at SMB2_MAX_BUFFER_SIZE (64 KiB). Large contiguous allocations are more likely to fail on fragmented systems.
- **Symptom:** fallocate() on CIFS/SMB mounts can return -ENOMEM unnecessarily; successful writes reporting 0 bytes can spin forever.
- **Root cause:** Over-allocation relative to per-write limit; buffer pointer advanced across a shrinking reusable zero buffer; no guard against zero-progress writes.
- **Version info:** None in the message.
**Step 1.4 — Hidden bug fix detection**
Record: **Yes.** Besides the allocation-size issue, it adds if (!nbytes) return -EIO; to stop an infinite loop when SMB2_write() succeeds but reports 0 bytes written, and removes buf += nbytes so a smaller reused zero buffer stays valid.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- fs/smb/client/smb2ops.c: +4 / −3 lines (7-line net change)
- Functions: smb3_simple_fallocate_write_range(), smb3_simple_fallocate_range()
- Scope: single-file surgical fix
**Step 2.2 — Code flow changes**
Record:
- **Hunk 1 (smb3_simple_fallocate_write_range):**
- Before: nbytes was int; loop advanced buf on each write; no zero-progress check.
- After: nbytes is unsigned int; zero-progress write returns -EIO; buf is not advanced (buffer reused).
- **Hunk 2 (smb3_simple_fallocate_range):**
- Before: kvzalloc(1024 * 1024, GFP_KERNEL)
- After: kvzalloc(min_t(loff_t, len, SMB2_MAX_BUFFER_SIZE), GFP_KERNEL)
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Resource allocation failure + logic/infinite-loop bug
- **Mechanism:** A 1 MiB buffer was allocated though writes are chunked to 64 KiB. After the prior kvzalloc() backport, kmalloc can still fail first and vmalloc fallback is heavier than needed. If SMB2_write() returns success with DataLength == 0, while (len) never advances and the syscall hangs.
**Step 2.4 — Fix quality**
Record: Fix is minimal and correct. Reusing the start of a zero-filled buffer is semantically equivalent. Removing buf += nbytes is required once the buffer shrinks below cumulative write size. Regression risk is low.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- 1 MiB allocation introduced with fallocate emulation (commit 966a3cb7c7db, Jun 2021: "cifs: improve fallocate emulation")
- Current 1 MiB line changed to kvzalloc by 6cc1518357369 (Jul 2026), already in this tree
- Write loop logic dates to merge 5d324e5159d9e (Nov 2025)
**Step 3.2 — Fixes: tag**
Record: Not applicable — no Fixes: tag.
**Step 3.3 — Related file history**
Record:
- 6cc1518357369 — kzalloc → kvzalloc for same 1 MiB buffer (ENOMEM on fragmented systems, xfstests generic/013)
- 7e08ab7a061b1 — overlapping allocated ranges in fallocate (already in this tree)
- Target commit 9e4ec3be67af4 is **not** in this tree yet
- Standalone within a larger series (v8 3/5); does not require other series patches
**Step 3.4 — Author context**
Record: Huiwen He authored multiple SMB fallocate fixes; Steve French (maintainer) committed. Same author area as 7e08ab7a061b1 already backported here.
**Step 3.5 — Dependencies**
Record: No prerequisites beyond code already present. git apply --check on 9e4ec3be67af4 against current tree succeeds. SMB2_MAX_BUFFER_SIZE is 65536 in fs/smb/common/smb2pdu.h.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- b4 dig -c 9e4ec3be67af4:
https://patch.msgid.link/[email protected]
- Matched as [PATCH v8 3/5] smb/client: reduce fallocate zero buffer allocation
- b4 dig -a: v1 through v8 revisions (Jun 23 – Jul 3, 2026); committed version is latest (v8)
**Step 4.2 — Reviewers**
Record: b4 dig -w CC'd Steve French, Ronnie Sahlberg, linux- [email protected], and other SMB maintainers/reviewers.
**Step 4.3 — Bug reports**
Record: No direct bug report in this commit. Related prior fix 6cc1518357369 documented xfstests generic/013 ENOMEM with stack trace through smb3_simple_falloc.
**Step 4.4 — Series context**
Record: Part of Huiwen He's fallocate series, but this hunk is self- contained and applies independently.
**Step 4.5 — Stable list history**
Record: No stable-list discussion found for this specific patch. Prior related 6cc1518357369 explicitly had Cc: [email protected] and was backported here.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: smb3_simple_fallocate_write_range(), smb3_simple_fallocate_range(), caller smb3_simple_falloc()
**Step 5.2 — Callers**
Record:
- cifs_fallocate() → server->ops->fallocate() → smb3_simple_falloc() → smb3_simple_fallocate_range() when len <= 1 MiB on sparse internal regions
- Reachable from fallocate() syscall on CIFS/SMB mounts
**Step 5.3 — Callees**
Record: SMB2_write(), SMB2_ioctl(FSCTL_QUERY_ALLOCATED_RANGES), kvzalloc(), kvfree()
**Step 5.4 — Reachability**
Record: Userspace fallocate() on mounted SMB/CIFS shares with sparse files and internal-hole preallocation (len <= 1 MiB). Unprivileged users with write access can trigger it.
**Step 5.5 — Similar patterns**
Record: 6cc1518357369 addressed the same allocation site with kvzalloc() fallback. This commit further right-sizes the buffer to the actual per-write maximum.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is **v6.18.44** (git describe HEAD). Current code at line 3564:
```3564:3564:fs/smb/client/smb2ops.c
buf = kvzalloc(1024 * 1024, GFP_KERNEL);
```Write loop still has buf += nbytes and no zero-progress guard. Bug dates to 2021 fallocate emulation; partially mitigated by 6cc1518357369, not fully fixed.
**Step 6.2 — Backport complications**
Record: Clean apply verified with git apply --check. No conflicts expected.
**Step 6.3 — Related fixes already present** Record:
- 6cc1518357369 (kvzalloc for 1 MiB) — present
- 7e08ab7a061b1 (overlapping ranges) — present
- 9e4ec3be67af4 (this commit) — **not** present
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem criticality**
Record: fs/smb/client — IMPORTANT (filesystem client, affects CIFS/SMB users; not universal core)
**Step 7.2 — Subsystem activity**
Record: Active — multiple fallocate and client fixes recently backported to this 6.18.y tree.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users of CIFS/SMB mounts performing fallocate() on sparse files (internal hole zero-fill path, len <= 1 MiB).
**Step 8.2 — Trigger conditions**
Record:
- Sparse SMB file + fallocate on internal unallocated range ≤ 1 MiB
- Allocation failure more likely under memory pressure/fragmentation (reduced but not eliminated by prior kvzalloc fix)
- Infinite loop if server returns successful write with DataLength == 0 (unusual but possible misbehavior)
**Step 8.3 — Failure mode severity**
Record:
- -ENOMEM on fallocate: **MEDIUM** (syscall failure, no kernel crash)
- Infinite loop on zero-progress write: **CRITICAL** (hung fallocate() syscall / unkillable task)
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** HIGH for hang prevention; MEDIUM for allocation reliability and memory use
- **Risk:** VERY LOW (7-line change, maintainer-reviewed, applies cleanly)
- **Ratio:** Favorable
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence compile**
FOR backport:
- Fixes real hang (infinite loop on zero-progress SMB2_write)
- Reduces fallocate buffer from 1 MiB to at most 64 KiB on a path already deemed stable-worthy
- Small, surgical, maintainer-reviewed
- Applies cleanly to v6.18.44
- Complements existing 6cc1518357369 backport rather than duplicating it
- Userspace-reachable via fallocate()
AGAINST backport:
- Primary ENOMEM issue partially addressed by 6cc1518357369 already in tree
- No explicit user report, syzbot, or Cc: stable on this commit
- Zero-progress write scenario may be rare
UNRESOLVED:
- No independent confirmation of a production server returning DataLength == 0 on success (defensive fix is still sound)
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — logic is clear; Reviewed- by present; no Tested-by
2. Fixes a real bug affecting users? **PASS** — hang + unnecessary allocation failures on fallocate()
3. Important issue? **PASS** — hang is critical; ENOMEM is medium
4. Small and contained? **PASS** — 7 lines, one file
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — verified clean apply
**Step 9.3 — Exception categories**
Record: Not a device-ID/quirk/DT/docs exception; standard bug fix.
**Step 9.4 — Decision rationale**
This tree (6.18.44) still allocates 1 MiB for fallocate zero-fill despite 64 KiB write chunks, and lacks protection against a zero- progress write loop. The prior kvzalloc() backport mitigated physical- contiguity failures but did not right-size the buffer or fix the loop. The patch is tiny, low-risk, maintainer-approved, and addresses a userspace-visible stability issue on a code path already receiving stable backports.
---
## Verification
- [Phase 1] Parsed commit 9e4ec3be67af4 message and tags via git show
- [Phase 2] Analyzed full diff via git show 9e4ec3be67af4 -p
- [Phase 3] git describe HEAD → v6.18.44-1-g2736c32da98b9; VERSION=6 PATCHLEVEL=18 SUBLEVEL=44
- [Phase 3] git blame on lines 3521–3537 and 3564 of smb2ops.c
- [Phase 3] git show 966a3cb7c7db — fallocate emulation origin (2021)
- [Phase 3] git show 6cc1518357369 — prior kvzalloc fix with xfstests ENOMEM trace, Cc: stable
- [Phase 3] git log --oneline on fs/smb/client/smb2ops.c — related fallocate commits present
- [Phase 3] git apply --check on patch — applies cleanly
- [Phase 4] b4 dig -c 9e4ec3be67af4 — lore URL found
- [Phase 4] b4 dig -a — v1–v8 series revisions listed
- [Phase 4] b4 dig -w — maintainers CC'd (Steve French, linux-cifs, etc.)
- [Phase 4] b4 dig -m /tmp/fallocate_thread.mbox — thread saved; no stable nomination found for this patch
- [Phase 5] Read SMB2_write() in smb2pdu.c — sets *nbytes = le32_to_cpu(rsp->DataLength) on success (lines 5208–5209)
- [Phase 5] Traced call chain: cifs_fallocate() → smb3_simple_falloc() → smb3_simple_fallocate_range()
- [Phase 5] SMB2_MAX_BUFFER_SIZE = 65536 in fs/smb/common/smb2pdu.h
- [Phase 6] Confirmed buggy kvzalloc(1024 * 1024) at line 3564 in current tree
- [Phase 6] Confirmed commit 9e4ec3be67af4 not in current tree (git log --grep empty on HEAD)
- [Phase 6] Confirmed 6cc1518357369 and 7e08ab7a061b1 already in tree
- [Phase 8] Failure modes: ENOMEM (medium), infinite loop (critical)
**YES**The master-branch search finished successfully. It found commit 9e4ec3be67af4 ("smb/client: reduce fallocate zero buffer allocation") on master, merged via fce2dfa773ced.
For this **6.18.44** tree, the verdict stands: **YES** for stable backport. The patch is small, applies cleanly, and fixes a real fallocate() hang risk (zero-progress SMB2_write loop) while right- sizing the zero buffer from 1 MiB to at most 64 KiB — a useful follow-up to the kvzalloc() fix already in this tree.
fs/smb/client/smb2ops.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/smb/client/smb2ops.c +4 -3
@@ -3508,7 +3508,7 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, char *buf) {struct cifs_io_parms io_parms = {0 }; -int nbytes; +unsigned int nbytes;int rc =0 ;struct kvec iov[2 ];
@@ -3529,9 +3529,10 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, rc =SMB2_write (xid, &io_parms, &nbytes, iov,1 );if (rc)break ; +if (!nbytes) +return -EIO ;if (nbytes > len)return -EINVAL ; - buf += nbytes; off += nbytes; len -= nbytes; }
@@ -3561,7 +3562,7 @@ static int smb3_simple_fallocate_range(unsigned int xid,if (rc) goto out; - buf =kvzalloc (1024 *1024 ,GFP_KERNEL ); + buf =kvzalloc (min_t (loff_t, len,SMB2_MAX_BUFFER_SIZE ),GFP_KERNEL );if (buf ==NULL ) { rc = -ENOMEM ; goto out;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 dpaa2-switch: fix handling of NAPI on the remove path
In reply to Sasha LevinFrom: Ioana Ciornei <[email protected]>
[ Upstream commit e23d7c8c1d4ba435c457d7ffb2669175ec819b07 ]
All the NAPI instances for a DPSW device are attached to the first switch port's net_device but shared by all ports. The NAPI instances get disabled only once the last port goes down.
This causes an issue on the .remove() path where each port is unregistered and freed one at a time, causing the NAPI instances to be deleted even though they are not disabled.
In order to avoid this, split up the unregister_netdev() calls from the free_netdev() so that we make sure all ports go down before we attempt a deletion of NAPI instances. Also, make the netif_napi_del() explicit as it is on the .probe() path.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: dpaa2-switch: fix handling of NAPI on the remove path
**Local tree:** v6.18.44 (6.18.44) — verdict applies to this tree only.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
- **Record:** [dpaa2-switch] **fix** — correct NAPI teardown ordering on the driver .remove() path.
### Step 1.2: Tags
- **Signed-off-by:** Ioana Ciornei <[email protected]>
- **Link:** https://patch.msgid.link/20260528173452.1953102-6-
[email protected]
- **Signed-off-by:** Jakub Kicinski <[email protected]> (net maintainer merge)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or Reviewed-by: tags.
- **Record:** Maintainer merge present; no explicit stable nomination or fuzzer report. Absence of Cc: stable is expected and not a negative signal.
### Step 1.3: Body analysis
- **Bug:** NAPI instances are attached to port 0’s net_device but shared by all switch ports. NAPI is disabled only when the last port goes down (napi_users refcount).
- **Symptom:** On .remove(), each port is unregister_netdev()’d and free_netdev()’d in the same loop iteration. Freeing port 0’s netdev deletes shared NAPI while other ports may still be up and NAPI still enabled.
- **Root cause:** Interleaved unregister + free prevents all ports from going down before NAPI deletion.
- **Fix:** Unregister all netdevs first, explicitly netif_napi_del() all NAPI instances, then free ports.
- **Record:** Real teardown-ordering bug on driver removal; affects multi-port switches with active interfaces.
### Step 1.4: Hidden bug fix?
- **Record:** No — this is an explicit bug fix, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **File:** drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c (+10 / −5)
- **Function:** dpaa2_switch_remove()
- **Record:** Single-file, surgical change; one function modified.
### Step 2.2: Code flow change
**Before:**
```c
for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
unregister_netdev(port_priv->netdev);
dpaa2_switch_remove_port(ethsw, i); // calls free_netdev()
}
```**After:**
```c
for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
unregister_netdev(ethsw->ports[i]->netdev);
for (i = 0; i < DPAA2_SWITCH_RX_NUM_FQS; i++)
netif_napi_del(ðsw->fq[i].napi);
for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
dpaa2_switch_remove_port(ethsw, i);
```- **Record:**
- Hunk 1: All ports brought down before any free_netdev().
- Hunk 2: Explicit NAPI removal after all ndo_stop paths have run.
- Hunk 3: Port teardown/free happens only after NAPI is properly disabled and deleted.
### Step 2.3: Bug mechanism
- **Category:** Teardown-ordering / resource-lifecycle bug (NAPI deleted while still enabled).
- **Mechanism:**
1. netif_napi_add() attaches NAPI to ethsw->ports[0]->netdev
(probe path, lines 3460–3462).
2. dpaa2_switch_enable_ctrl_if_napi() / dpaa2_switch_disable_ctrl_if_napi() refcount via napi_users; NAPI disabled only when last port stops (lines 649–681).
3. free_netdev() calls netdev_napi_exit() → __netif_napi_del_locked(), which warns if NAPI is not disabled:
```7608:7609:net/core/dev.c
/* Make sure NAPI is disabled (or was never enabled). */
WARN_ON(!test_bit(NAPI_STATE_SCHED, &napi->state));
``` 4. With num_ifs > 1 and ports up, unregistering/freeing port 0 first deletes NAPI while napi_users > 0 and NAPI still enabled.
- **Record:** Confirmed WARN/crash path on multi-port switch removal.
### Step 2.4: Fix quality
- **Record:** Fix is minimal, mirrors standard netdev teardown ordering, and matches the probe-side explicit netif_napi_add(). Low regression risk; no API or locking changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
- Remove loop structure: 44baaa43d7cc (2018-03-14, original staging ethsw driver).
- dpaa2_switch_remove_port() split: 860fe1f87eca (2021-08-19).
- Shared NAPI design: 0b1b713704588 (2021-03-10, Ioana Ciornei).
- **Record:** Bug latent since shared NAPI was introduced in 2021; remove path never updated for shared-NAPI lifecycle.
### Step 3.2: Fixes: tag
- **Record:** Not applicable — no Fixes: tag present.
### Step 3.3: Related file history
- Recent dpaa2-switch fixes in this tree include IRQ validation, refcount leaks, buffer pool seeding — all independent.
- Patch is **5/5** of series “dpaa2-switch: various improvements” (patches 1–4 cover FDB, RX error path, VLAN). Patch 5 only touches dpaa2_switch_remove() and is **standalone**.
- **Record:** No prerequisite commits required for this fix.
### Step 3.4: Author context
- Ioana Ciornei is the original author of shared NAPI management and an active dpaa2-switch contributor.
- **Record:** Author has deep subsystem knowledge; fix is credible.
### Step 3.5: Dependencies
- Uses DPAA2_SWITCH_RX_NUM_FQS (defined as 2 in dpaa2-switch.h), netif_napi_del(), and existing dpaa2_switch_remove_port() — all present in this tree.
- **Record:** Applies standalone; no structural dependencies on unmerged series patches 1–4.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
- **Series:** [PATCH net-next 0/5] dpaa2-switch: various improvements (Ioana Ciornei, 2026-05-28).
- **Patch:** [PATCH net-next 5/5] dpaa2-switch: fix handling of NAPI on the remove path
- **URLs:** lkml.iu.edu/2605.3/08494.html, patchew.org series page.
- Cover letter notes these are long-standing bugs found during LAG support review.
- **Record:** Patch 5 is independently committable; no NAKs found in available sources.
### Step 4.2: Reviewers
- **To:** netdev maintainers (Andrew Lunn, David Miller, Jakub Kicinski, Paolo Abeni, etc.)
- Merged by Jakub Kicinski.
- **Record:** Standard netdev review path; maintainer merge confirmed.
### Step 4.3: Bug report
- No syzbot or user crash report; bug found during code review.
- **Record:** Review-discovered but mechanism is verifiable in code.
### Step 4.4: Series context
- Patches 1–4: FDB management, RX error path, VLAN dedup, VLAN flag changes — unrelated to NAPI teardown.
- **Record:** Patch 5 can be backported alone.
### Step 4.5: Stable list history
- No stable-list discussion found for this specific fix.
- **Record:** Not previously nominated for stable (expected).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
- dpaa2_switch_remove() — modified
- dpaa2_switch_remove_port() — called after fix (unchanged)
- dpaa2_switch_disable_ctrl_if_napi() — called via ndo_stop during unregister
- netdev_napi_exit() / __netif_napi_del_locked() — core NAPI deletion
### Step 5.2: Callers
- dpaa2_switch_remove() is the .remove callback for the DPAA2 switch MC device driver (line 3529).
- **Record:** Triggered on device unbind, module unload, or hot-unplug of DPSW object.
### Step 5.3: Callees
- unregister_netdev() → ndo_stop → dpaa2_switch_port_stop() → dpaa2_switch_disable_ctrl_if_napi()
- netif_napi_del() → __netif_napi_del_locked()
- dpaa2_switch_remove_port() → free_netdev() → netdev_napi_exit()
- **Record:** Fix ensures correct ordering across these teardown primitives.
### Step 5.4: Reachability
- **Trigger:** Removal of a DPAA2 switch with 2+ ports where at least one port was brought up (NAPI enabled).
- **Record:** Reachable on normal driver unload / device removal on NXP DPAA2 platforms (LS1088, LX2160, etc.); not userspace-syscall reachable, but real admin/PM path.
### Step 5.5: Similar patterns
- Probe error path (err_unregister_ports then err_free_netdev) already separates unregister from free — remove path was the outlier.
- **Record:** Fix aligns remove path with the safer pattern already used on probe error.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE
### Step 6.1: Buggy code present?
- **Record:** YES. Current dpaa2_switch_remove() at lines 3304–3308 still interleaves unregister_netdev() and dpaa2_switch_remove_port() in one loop. Shared NAPI code present since 0b1b713704588 (ancestor of HEAD).
### Step 6.2: Backport complications
- Diff applies cleanly against current file; line numbers match commit base (505ccaa93ee41).
- **Record:** Clean apply expected; no rework needed.
### Step 6.3: Related fixes already present?
- No existing fix for this NAPI teardown issue in tree.
- **Record:** Fix not yet applied; still needed.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem
- **Subsystem:** drivers/net/ethernet/freescale/dpaa2/ — DPAA2 Ethernet switch driver (CONFIG_FSL_DPAA2_SWITCH)
- **Criticality:** IMPORTANT (platform-specific networking driver, not core kernel)
### Step 7.2: Activity
- dpaa2-switch actively maintained with multiple recent stable-worthy fixes (IRQ bounds, refcount leaks, buffer pool).
- **Record:** Mature driver with ongoing maintenance.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
- Users of NXP Layerscape SoCs with DPAA2 switch (FSL_DPAA2_SWITCH=y/m).
- **Record:** Platform-specific but affects all multi-port switch teardown on those systems.
### Step 8.2: Trigger conditions
- Switch device removal/unbind with num_ifs >= 2 and ports that were opened (NAPI enabled).
- **Record:** Common on module unload or firmware/MC object teardown; not exotic.
### Step 8.3: Failure severity
- WARN_ON in __netif_napi_del_locked() when deleting enabled NAPI.
- Potential use-after-free or crash if NAPI poll runs against freed structures.
- **Record:** Severity **HIGH** (kernel WARN/oops on driver removal); not data corruption, but can leave system in bad state during teardown.
### Step 8.4: Risk-benefit
- **Benefit:** HIGH for affected DPAA2 switch users — prevents broken teardown.
- **Risk:** VERY LOW — 15-line reordering in one function, no new APIs.
- **Record:** Strong benefit/risk ratio.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Fixes a real, verifiable bug in driver removal path
- Bug present since 2021 shared-NAPI design; affects this 6.18.y tree
- Small, surgical, obviously correct fix
- Maintainer-merged; standalone (no series dependencies)
- Prevents WARN/oops on multi-port switch teardown
- Aligns remove path with safer probe-error pattern
**AGAINST backport:**
- Platform-specific driver (limited user base vs. core subsystems)
- No syzbot report or user crash report (review-discovered)
- Only triggers on device removal, not steady-state operation
**Unresolved:** None that affect the decision.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic verified against NAPI refcount design; maintainer merged.
2. Fixes a real bug? **PASS** — multi-port remove path deletes enabled shared NAPI.
3. Important issue? **PASS** — WARN/oops on driver removal (HIGH severity for teardown).
4. Small and contained? **PASS** — one function, +10/−5 lines.
5. No new features or APIs? **PASS** — teardown ordering fix only.
6. Can apply to local tree? **PASS** — buggy code present; clean apply expected.
### Step 9.3: Exception categories
- **Record:** None (not a quirk/ID/DT/build/doc fix) — standard bug fix.
### Step 9.4: Decision rationale
This commit fixes a long-standing teardown bug in the DPAA2 switch driver where shared NAPI instances attached to port 0 are deleted via free_netdev() before all ports are brought down. The fix is minimal, self-contained, applies cleanly to the 6.18.44 tree, and prevents kernel warnings/crashes during driver removal on multi-port switches — a path that stable enterprise/embedded users hit during upgrades, module reloads, and device hot-unplug.
---
## Verification
- **[Phase 1]** git describe HEAD → v6.18.44; parsed subject, tags, body from provided commit message
- **[Phase 2]** Read dpaa2_switch_remove() (lines 3290–3321), dpaa2_switch_remove_port() (3006–3014), NAPI enable/disable (649–681), probe NAPI add (3460–3462)
- **[Phase 2]** Read free_netdev() / netdev_napi_exit() / __netif_napi_del_locked() in net/core/dev.c (12066–12116, 7601–7628)
- **[Phase 3]** git blame on remove loop (lines 3304–3308) → original 2018 code; 860fe1f87eca added remove_port; 0b1b713704588 introduced shared NAPI
- **[Phase 3]** git merge-base --is-ancestor 0b1b713704588 HEAD → shared NAPI commit is in tree
- **[Phase 3]** git log --oneline -20 -- drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c → no duplicate NAPI fix present
- **[Phase 4]** Web search + lkml.iu.edu/2605.3/08494.html → confirmed patch 5/5 of “various improvements” series; standalone
- **[Phase 4]** Patchew/Ratatoskr → series patches 1–4 are FDB/VLAN/RX fixes, independent of patch 5
- **[Phase 4]** lore.kernel.org fetch blocked (Anubis); used lkml.iu.edu mirror instead
- **[Phase 5]** Confirmed .remove callback at line 3529; traced ndo_stop → dpaa2_switch_disable_ctrl_if_napi()
- **[Phase 6]** Buggy interleaved loop confirmed at lines 3304–3308 in local tree
- **[Phase 6]** DPAA2_SWITCH_RX_NUM_FQS = 2 in dpaa2-switch.h; netif_napi_del available in include/linux/netdevice.h
- **[Phase 6]** No netif_napi_del in current file — fix adds needed explicit deletion
- **[Phase 7]** CONFIG_FSL_DPAA2_SWITCH in drivers/net/ethernet/freescale/dpaa2/Kconfig
- **[Phase 8]** Failure mode: WARN_ON in __netif_napi_del_locked when NAPI still enabled; severity HIGH for teardown
**YES**
.../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +10 -5
@@ -3307,7 +3307,6 @@ static void dpaa2_switch_teardown(struct fsl_mc_device *sw_dev)static void dpaa2_switch_remove (struct fsl_mc_device *sw_dev) { -struct ethsw_port_priv *port_priv;struct ethsw_core *ethsw;struct device *dev;int i;
@@ -3319,11 +3318,17 @@ static void dpaa2_switch_remove(struct fsl_mc_device *sw_dev)dpsw_disable (ethsw->mc_io,0 , ethsw->dpsw_handle); -for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) { - port_priv = ethsw->ports[i]; -unregister_netdev (port_priv->netdev); +/* Unregister all the netdevs so that they are brought down and the +* shared NAPI instances gets disabled. +*/ +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) +unregister_netdev (ethsw->ports[i]->netdev); + +for (i =0 ; i <DPAA2_SWITCH_RX_NUM_FQS ; i++) +netif_napi_del (ðsw->fq[i].napi); + +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++)dpaa2_switch_remove_port (ethsw, i); - }kfree (ethsw->fdbs);kfree (ethsw->filter_blocks);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net: dsa: mv88e6xxx: define .pot_clear() for 6321
In reply to Sasha LevinFrom: Marek Behún <[email protected]>
[ Upstream commit 17826d9708a57d27011d0a6efdebb628d6f8299a ]
Commit 9e907d739cc3 ("net: dsa: mv88e6xxx: add POT operation") did not add the .pot_clear() method to the 6321 switch operations structure. Add them now.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [net: dsa: mv88e6xxx] [define] [add missing .pot_clear() callback for MV88E6321 switch ops]
**Step 1.2 — Tags**
Record:
- Signed-off-by: Marek Behún <[email protected]> (author)
- Signed-off-by: Jakub Kicinski <[email protected]> (net maintainer merge)
- `Link:
https://patch.msgid.link/[email protected]`
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, `Cc:
[email protected]`
Notable: patch 3/5 in Marek Behún’s “Fixes for mv88e6xxx for 6320/6321 family” series. An earlier March 2025 submission to net (stable path) included Fixes: 9e907d739cc3 for the same change.
**Step 1.3 — Body analysis**
Record:
- Bug: commit 9e907d739cc3 (“add POT operation”) added pot_clear to most switch ops tables but omitted mv88e6321_ops.
- Symptom: Priority Override Table (POT) is not cleared during chip setup on MV88E6321.
- Root cause: missing .pot_clear = mv88e6xxx_g2_pot_clear in mv88e6321_ops.
- No crash report, no user bug report in the message.
**Step 1.4 — Hidden bug fix?**
Record: Yes. Despite the simple “add them now” wording, this is a real driver initialization bug, not style cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- 1 file: drivers/net/dsa/mv88e6xxx/chip.c
- +1 line, -0 lines
- Modified structure: mv88e6321_ops
- Scope: single-file, surgical one-liner
**Step 2.2 — Code flow change**
Record:
- Before: mv88e6xxx_pot_setup() called from mv88e6xxx_setup() finds chip->info->ops->pot_clear == NULL for 6321 and returns 0 without doing anything.
- After: mv88e6xxx_g2_pot_clear() runs, zeroing all 16 Global2 Priority Override Table entries.
- Affected path: switch probe/setup initialization (normal path, every boot).
**Step 2.3 — Bug mechanism**
Record:
- Category: logic/correctness — missing hardware initialization callback
- Mechanism: mv88e6xxx_pot_setup() only acts when ops->pot_clear is non-NULL; 6321 was the sole omission among G2-family peers.
**Step 2.4 — Fix quality**
Record:
- Obviously correct: identical to mv88e6320_ops and 20+ other chips in the same file.
- Minimal, no unrelated changes.
- Regression risk: very low; only adds init behavior already used everywhere else in the family.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- mv88e6321_ops area currently attributed to base merge 5d324e5159d9e (shallow tree limits deeper blame).
- In 9e907d739cc3 (2017-07-18): mv88e6320_ops got .pot_clear, mv88e6321_ops did not — omission present since POT support was introduced.
**Step 3.2 — Fixes: tag**
Record: Not applicable in this commit. Referenced commit 9e907d739cc3 exists as a git object; POT infrastructure (mv88e6xxx_pot_setup, mv88e6xxx_g2_pot_clear) is present in this tree.
**Step 3.3 — Related changes**
Record:
- Same fix appeared in Marek Behún’s March 2025 [PATCH net 07/13] series (with Fixes: tag); that series does not appear merged.
- May 2026 [PATCH net-next 3/5] series reapplied it to net-next; applied as 17826d9708a5 per lore.
- Standalone one-liner; no series dependencies.
**Step 3.4 — Author context**
Record: Marek Behún is an active mv88e6xxx contributor; series CC’d Rad/Ericsson contacts ([email protected]), indicating production hardware use of 6320/6321 family.
**Step 3.5 — Prerequisites**
Record: No prerequisites. mv88e6xxx_g2_pot_clear() and mv88e6xxx_pot_setup() already exist in this tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- Series cover: https://lore.kernel.org/netdev/20260504153227.1390546- [email protected]
- Patch 3/5: https://lore.kernel.org/netdev/20260504153227.1390546-4- [email protected]
- Applied to net-next by Jakub Kicinski (patchwork notification, 2026-05-06).
- No explicit stable nomination found in thread.
**Step 4.2 — Reviewers**
Record: CC’d Andrew Lunn, Vladimir Oltean, Russell King, Vivien Didelot, Tobias Waldekranz, netdev list.
**Step 4.3 — Bug reports**
Record: None. No syzbot, no user crash report. Author-driven correctness fix for supported hardware.
**Step 4.4 — Related patches**
Record: Part of 5-patch 6320/6321 family series (interrupt count, SPEED_200, pot_clear, rmu_disable, devlink ATU hash). This patch is independent.
**Step 4.5 — Stable list history**
Record: No stable-list discussion found. Earlier March 2025 net submission included Fixes: tag, suggesting stable intent, but no `Cc:
stable` found.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: mv88e6xxx_pot_setup(), mv88e6xxx_g2_pot_clear(), mv88e6xxx_setup(), mv88e6321_ops (static const).
**Step 5.2 — Callers**
Record:
- mv88e6xxx_setup() (DSA .setup callback at line 7140) calls mv88e6xxx_pot_setup() at line 4047.
- mv88e6xxx_setup() runs during DSA switch registration/probe — standard device bring-up path.
**Step 5.3 — Callees**
Record: mv88e6xxx_g2_pot_clear() loops 16 times calling mv88e6xxx_g2_pot_write() to zero Global2 POT entries (MV88E6XXX_G2_PRIO_OVERRIDE).
**Step 5.4 — Reachability**
Record: Triggered on every MV88E6321 probe/boot when driver is built and hardware is present. Not userspace-triggerable directly, but affects all 6321 deployments.
**Step 5.5 — Similar patterns**
Record: Every other comparable mv88e6xxx_ops structure in chip.c defines .pot_clear = mv88e6xxx_g2_pot_clear except mv88e6321_ops. mv88e6320_ops (same MV88E6XXX_FAMILY_6320) has it at line 5178.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.43)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is v6.18.43 (VERSION=6, PATCHLEVEL=18, SUBLEVEL=43). mv88e6321_ops (lines 5192–5242) lacks .pot_clear; mv88e6320_ops at line 5178 has it. MV88E6321 chip entry exists at lines 6275–6300.
**Step 6.2 — Backport complications**
Record: Clean apply expected — single line insertion between .mgmt_rsvd2cpu and .hardware_reset_pre, matching the upstream diff exactly.
**Step 6.3 — Fix already present?**
Record: No. git log --grep="define .pot_clear" returns nothing. Bug still present in this checkout.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: drivers/net/dsa/mv88e6xxx — network/DSA switch driver.
Criticality: **IMPORTANT** (peripheral driver, but networking correctness on embedded/telecom switches).
**Step 7.2 — Activity**
Record: Driver is mature and actively maintained; recent 6320/6321 family fix series indicates ongoing production use.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users of Marvell 88E6321 DSA switches only (embedded/telecom/automotive Ethernet). Config-dependent on CONFIG_NET_DSA_MV88E6XXX.
**Step 8.2 — Trigger conditions**
Record: Every driver probe of an 88E6321 device. Deterministic, not a race. Unprivileged users cannot trigger directly.
**Step 8.3 — Failure mode severity**
Record: Stale Priority Override Table entries may cause incorrect packet priority/QoS behavior. **Severity: MEDIUM** — functional networking misbehavior, not kernel crash, oops, deadlock, or memory corruption. Per-port port_disable_pri_override still runs during port setup, but that is a separate per-port register, not the Global2 POT table.
**Step 8.4 — Risk/benefit**
Record:
- Benefit: **MEDIUM** — restores intended hardware init parity with 6320 and all other supported chips; relevant for production 6321 deployments.
- Risk: **VERY LOW** — one-line addition of existing callback.
- Ratio: favorable, but severity of the underlying bug is not critical.
---
## Phase 9: Final Synthesis
**Evidence FOR backport:**
- Verified real bug: sole chip variant missing pot_clear since 2017.
- Bug exists in v6.18.43 tree; fix applies cleanly.
- One-line, obviously correct, zero API change.
- Called on every 6321 probe; ensures POT table is zeroed as intended.
- Sibling mv88e6320_ops and all other G2 chips already do this.
- Author previously submitted same fix to net (stable path) with Fixes: tag.
- Production hardware context (Rad/Ericsson).
**Evidence AGAINST backport:**
- No crash, security issue, deadlock, or data corruption.
- No user bug reports or syzbot findings.
- Bug present ~9 years without urgent reports — suggests limited practical impact (POT may often be zero after reset).
- Does not strictly meet “important issue” examples in stable-kernel- rules.rst.
- Narrow hardware population.
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — trivial, mirrors identical chips; no Tested-by but logically sound.
2. Fixes a real bug affecting users? **PASS** — real init omission on supported hardware.
3. Important issue? **BORDERLINE/FAIL** — QoS/priority init correctness, not crash/corruption/security.
4. Small and contained? **PASS** — 1 line, 1 file.
5. No new features/APIs? **PASS**.
6. Can apply to local tree? **PASS** — verified present and applicable.
**Exception category:** Hardware initialization completeness fix for existing supported device (analogous to quirk/workaround category).
---
## Problem Summary
When an MV88E6321 switch is probed, mv88e6xxx_pot_setup() silently skips clearing the Global2 Priority Override Table because mv88e6321_ops lacks the pot_clear callback. Every other comparable chip in the driver, including the closely related MV88E6320, performs this clear. The result can be stale priority-override entries and incorrect QoS behavior on 88E6321 hardware. This is not a kernel crash, but it is a genuine driver initialization defect on supported hardware in the v6.18.43 tree.
The fix is a single line adding .pot_clear = mv88e6xxx_g2_pot_clear to mv88e6321_ops, matching the established pattern. Risk is negligible; benefit is restoring correct init for 6321 users on this stable tree.
---
## Verification
- [Phase 1] Parsed commit message and tags; no Reported-by/syzbot; Link to lore series confirmed.
- [Phase 2] Diff: +1 line in mv88e6321_ops, adds .pot_clear = mv88e6xxx_g2_pot_clear.
- [Phase 3] git show 9e907d739cc3: confirmed 6320 got pot_clear, 6321 did not in 2017.
- [Phase 3] mv88e6xxx_pot_setup and mv88e6xxx_g2_pot_clear verified present in tree.
- [Phase 4] Fetched lore mbox via curl: series 3/5, applied to net-next; March 2025 net series had same fix with Fixes: tag.
- [Phase 5] mv88e6xxx_setup() → mv88e6xxx_pot_setup() call chain verified at lines 3953/4047.
- [Phase 5] mv88e6xxx_g2_pot_clear() clears 16 POT entries in global2.c:324-336.
- [Phase 6] git describe HEAD: v6.18.43; buggy code confirmed missing pot_clear in mv88e6321_ops.
- [Phase 6] mv88e6320_ops at line 5178 has pot_clear; mv88e6321_ops at 5192–5242 does not.
- [Phase 8] Failure mode: incorrect QoS/priority, severity MEDIUM (not crash).
- [Phase 4] b4 dig on 9e907d739cc3: found 2017 original POT thread (used curl for May 2026 series due to lore bot protection on WebFetch).
**YES**Two background git history searches failed (they timed out on this shallow tree), but that didn’t block the analysis.
I already had what we needed from direct code inspection, git show 9e907d739cc3, grep, and the lore mbox fetch. The conclusion stands:
**YES** for v6.18.43 — mv88e6321_ops is the only comparable chip missing .pot_clear, and the one-line fix restores correct Priority Override Table initialization on probe.
drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -5228,6 +5228,7 @@ static const struct mv88e6xxx_ops mv88e6321_ops = { .set_egress_port = mv88e6095_g1_set_egress_port, .watchdog_ops = &mv88e6390_watchdog_ops, .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, + .pot_clear = mv88e6xxx_g2_pot_clear, .hardware_reset_pre = mv88e6xxx_g2_eeprom_wait, .hardware_reset_post = mv88e6xxx_g2_eeprom_wait, .reset = mv88e6352_g1_reset,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: cap ATOM command table nesting depth
In reply to Sasha LevinFrom: Candice Li <[email protected]>
[ Upstream commit 27ef1795bc4e47cae838e0a3ced531c549f9b23d ]
Cap nesting at 32 levels with execute_depth and
return -ELOOP when exceeded.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/amdgpu: cap ATOM command table nesting depth
**Local tree:** v6.18.44 (Makefile: 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [drm/amdgpu] [cap] — Limit ATOM BIOS command-table recursion depth to prevent unbounded ATOM_OP_CALLTABLE nesting.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Candice Li <[email protected]> (author)
- **Reviewed-by:** Tao Zhou <[email protected]> (AMD reviewer)
- **Signed-off-by:** Alex Deucher <[email protected]> (amdgpu maintainer)
- **No** Fixes:, Reported-by:, Tested-by:, Link:, or Cc: stable tags
- **Notable:** Patch is labeled [PATCH 2/4] on amd-gfx (May 2026 security-hardening series); this hunk is self-contained in atom.c/atom.h
### Step 1.3: Body analysis
**Record:**
- **Bug:** Unbounded recursion via ATOM_OP_CALLTABLE → amdgpu_atom_execute_table_locked() can exhaust the kernel stack.
- **Symptom:** Kernel stack overflow (oops/panic) when VBIOS command tables nest deeply or cycle.
- **Fix:** Track execute_depth in atom_context, cap at 32, return -ELOOP when exceeded.
- **Root cause:** atom_op_calltable() recursively calls amdgpu_atom_execute_table_locked() with no depth limit; present since amdgpu’s initial atom interpreter (2015).
### Step 1.4: Hidden bug fix?
**Record:** Yes — despite “cap” wording, this is a defensive bug fix preventing kernel stack overflow, not a feature or refactor.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- drivers/gpu/drm/amd/amdgpu/atom.c: +11 lines
- drivers/gpu/drm/amd/amdgpu/atom.h: +3 lines
- **Total:** 14 lines added, 0 removed
- **Functions:** amdgpu_atom_execute_table_locked(); struct atom_context extended
- **Scope:** Single-subsystem, surgical, two-file fix
### Step 2.2: Code flow change
**Record:**
- **Hunk 1 (define):** Adds ATOM_EXECUTE_MAX_DEPTH 32 with comment explaining stack-overflow prevention.
- **Hunk 2 (entry):** Before table execution, checks `ctx->execute_depth
Quoted 1 line
= 32
, logsDRM_ERROR, returns-ELOOP`; otherwise increments
depth.
- **Hunk 3 (exit):** On all normal/error exits through free:, decrements execute_depth.
- **Hunk 4 (struct):** Adds unsigned int execute_depth to atom_context.
- **Before:** Unlimited recursive calltable op → stack growth until overflow.
- **After:** Depth-limited recursion; excess nesting returns error that propagates via existing ctx->abort handling.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Memory safety / kernel crash prevention (unbounded stack recursion)
- **Mechanism:** atom_op_calltable() at line 642 calls amdgpu_atom_execute_table_locked() recursively. A malicious, corrupt, or cyclic VBIOS can nest arbitrarily deep. Each frame allocates locals and may call further atom ops on the stack. No prior limit existed (debug_depth is debug-print-only).
### Step 2.4: Fix quality
**Record:**
- **Quality:** High — standard recursion-depth counter pattern; increment on entry, decrement on all free: paths.
- **Regression risk:** Very low. Real VBIOS tables do not nest anywhere near 32 levels. On limit hit, -ELOOP → ctx->abort = true → controlled -EINVAL exit (existing path), not panic.
- **Note:** execute_depth is not reset in amdgpu_atom_execute_table(), but mutex serialization and balanced inc/dec within each execution keep it at 0 between top-level calls. atom_context is kzalloc()’d, so field starts at 0.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- atom_op_calltable() introduced in d38ceaf99ed01 (“drm/amdgpu: add core driver (v4)”, 2015-04-20).
- Recursive call to amdgpu_atom_execute_table_locked() added in 4630d5031cd87 (“drm/amdgpu: check PS, WS index”, 2024-01-11).
- Unbounded recursion bug present throughout amdgpu’s lifetime in this tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related file history
**Record:** Recent atom.c fixes in this tree include:
- cc9a8e238e42c — kcalloc NULL check for WS buffer (OOM path)
- e5f7e4e0a445f — vbios NULL offset workaround
- 7bfd16d0ec374 — last_jump_jiffies initialization
- No prior nesting-depth or recursion-limit fix found.
### Step 3.4: Author context
**Record:** Candice Li is an active AMD amdgpu contributor. Alex Deucher (maintainer) signed off. Part of a 4-patch May 2026 hardening series (RAS bounds, atom depth cap, PSP fw validation).
### Step 3.5: Dependencies
**Record:** Standalone — patch 2/4 needs no other series members. No new APIs, no prerequisite commits. git apply --check confirms clean apply to this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- **URL:** https://lists.freedesktop.org/archives/amd-
gfx/2026-May/144646.html
- **Series:** Patches 1/4 (RAS CPER bounds), 2/4 (this commit), 4/4 (PSP fw_pri_buf validation); patches are independent.
- **Review feedback:** No NAKs or stable nominations found in fetched thread; patch is minimal with maintainer sign-off.
- **b4 dig:** Failed to match commit 27ef1795bc4e on lore (amd-gfx list, not lore.kernel.org).
### Step 4.2: Reviewers
**Record:** Reviewed-by Tao Zhou (AMD); Signed-off-by Alex Deucher (amdgpu maintainer). Submitted to [email protected].
### Step 4.3: Bug reports
**Record:** No Reported-by:, syzbot, or bugzilla links. Issue identified proactively as part of security hardening (comment explicitly cites stack overflow).
### Step 4.4: Related patches
**Record:** Sibling patches address separate bounds-check issues (userspace RAS ioctl, PSP firmware copy size). Not required for this fix.
### Step 4.5: Stable list
**Record:** lore.kernel.org/stable search blocked (bot protection). No stable-list discussion verified.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** amdgpu_atom_execute_table_locked(), atom_op_calltable(), amdgpu_atom_execute_table().
### Step 5.2: Callers
**Record:** amdgpu_atom_execute_table() is widely used across amdgpu:
- Display: atombios_encoders.c, atombios_crtc.c, atombios_dp.c, command_table.c
- PM: ppatomctrl.c, ppatomfwctrl.c, smu_v11_0.c, smu_v12_0.c
- Init: amdgpu_atombios.c, amdgpu_atomfirmware.c, atom.c (ATOM_CMD_INIT)
- Called during GPU probe, mode set, power management, and display hotplug — common operational paths.
### Step 5.3: Callees
**Record:** Recursive path: atom_op_calltable() → amdgpu_atom_execute_table_locked(). Uses kcalloc() for workspace (heap), but each stack frame still carries locals and interpreter state.
### Step 5.4: Reachability
**Record:** Triggered when amdgpu parses/executes VBIOS ATOM command tables during normal driver operation (probe, display, PM). VBIOS content comes from GPU ROM; can also be attacker-influenced via VFIO GPU passthrough (guest-supplied VBIOS) or root-level VBIOS flashing. Not a direct unprivileged-syscall path, but runs in kernel context on widely used hardware.
### Step 5.5: Similar patterns
**Record:** No equivalent execute_depth / ATOM_EXECUTE_MAX_DEPTH in radeon or other drm atom interpreters in this tree. debug_depth in atom.c is unrelated (SDEBUG formatting only).
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (v6.18.44)
### Step 6.1: Buggy code present?
**Record:** **Yes.** atom_op_calltable() at lines 632–646 recursively calls amdgpu_atom_execute_table_locked() with no depth check. execute_depth / ATOM_EXECUTE_MAX_DEPTH absent (grep returns no matches).
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** git apply --check succeeded with no conflicts. File structure matches patch context.
### Step 6.3: Related fixes already present? **Record:** **No.** git log -S "execute_depth" on amdgpu returns empty. Fix not already in tree.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **drivers/gpu/drm/amd/amdgpu** — IMPORTANT. Affects all amdgpu GPU users on probe, display, and PM paths.
### Step 7.2: Subsystem activity
**Record:** Actively maintained; recent atom.c fixes (2024–2025) show ongoing hardening of the interpreter.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** All systems with CONFIG_DRM_AMDGPU and amdgpu-loaded AMD GPUs. Config-specific but affects a large user base (desktops, servers, laptops, cloud GPUs).
### Step 8.2: Trigger conditions
**Record:** VBIOS ATOM command table with calltable nesting >32 (or infinite cycle). Uncommon with legitimate AMD VBIOS, but possible with corrupt ROM, malicious passthrough VBIOS, or pathological tables. Requires GPU present and atom table execution.
### Step 8.3: Failure mode severity
**Record:** **CRITICAL** without fix — kernel stack overflow → oops/panic, potential security implications. **MEDIUM** with fix — controlled error return, display/PM operation may fail but system stays up.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH — prevents kernel crash from unbounded recursion in widely-used code path.
- **Risk:** VERY LOW — 14-line defensive bound, maintainer-reviewed, no API changes.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Fixes real unbounded-recursion bug present since amdgpu inception
- Prevents kernel stack overflow (crash-class issue)
- Small (14 lines), obviously correct, maintainer-signed
- Applies cleanly to v6.18.44
- Standalone — no series dependencies
- Graceful degradation on limit hit (existing abort path)
**AGAINST backport:**
- No user/syzbot report in commit message
- Trigger requires pathological VBIOS (uncommon on bare metal)
- Not directly reachable from unprivileged userspace without GPU passthrough or root
**Unresolved:** Whether any legitimate production VBIOS exceeds 32 nesting levels (unverified; considered very unlikely given AMD’s own 32-level cap choice).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — standard depth counter; Reviewed-by + maintainer SOB; logic verifiable by inspection.
2. Fixes a real bug? **PASS** — unbounded recursion can overflow kernel stack.
3. Important issue? **PASS** — kernel crash / potential security impact (CRITICAL severity).
4. Small and contained? **PASS** — 14 lines, 2 files.
5. No new features/APIs? **PASS** — internal defensive bound only.
6. Can apply to local tree? **PASS** — buggy code present, patch applies cleanly.
### Step 9.3: Exception categories
**Record:** N/A (not device ID, quirk, DT, build, or docs). Qualifies as a critical bug-fix.
### Step 9.4: Decision rationale
For **v6.18.44**, the vulnerable unbounded-recursion code is present and the fix is absent. The patch is minimal, self-contained, maintainer- approved, and prevents a kernel stack overflow in a core amdgpu code path used during normal GPU operation. Trigger rarity does not outweigh crash severity for stable trees.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified as stack-overflow prevention fix
- [Phase 1] Confirmed patch is [PATCH 2/4] but self-contained
- [Phase 2] Diff analysis: +14 lines in atom.c/atom.h; depth check at entry, decrement at free:
- [Phase 2] Verified atom_op_calltable() recursive call at line 642
- [Phase 2] Verified debug_depth is debug-only (lines 95, 1259, 1282), not a safety limit
- [Phase 3] git blame: atom_op_calltable from 2015 (d38ceaf99ed01)
- [Phase 3] git log -S "execute_depth": empty — fix not in tree
- [Phase 3] git log --oneline -20 -- atom.c: recent hardening commits, no depth cap
- [Phase 3] git apply --check: patch applies cleanly
- [Phase 4] WebFetch amd-gfx/144646.html: original submission found
- [Phase 4] WebFetch amd-gfx/144645.html: patch 1/4 is independent RAS fix
- [Phase 4] b4 dig -c 27ef1795bc4e: no lore match (amd-gfx list)
- [Phase 4] lore.kernel.org/stable: blocked by bot protection — UNVERIFIED
- [Phase 5] grep amdgpu_atom_execute_table: 30+ call sites across display/PM/init
- [Phase 5] Traced recursion: atom_op_calltable → amdgpu_atom_execute_table_locked
- [Phase 5] Verified -ELOOP propagates via ctx->abort = true (lines 643–645)
- [Phase 6] git describe HEAD: v6.18.44
- [Phase 6] grep execute_depth|ATOM_EXECUTE_MAX_DEPTH: no matches — bug present, fix absent
- [Phase 6] amdgpu_atom_parse uses kzalloc (line 1527) — execute_depth starts at 0
- [Phase 6] mutex_lock in amdgpu_atom_execute_table (line 1295) — serializes execution
- [Phase 8] Failure mode: stack overflow without fix = CRITICAL; with fix = controlled error
**YES**The background checks finished and match the earlier analysis:
- **Related-commit search** — No amdgpu fix for ATOM nesting depth or ATOM_EXECUTE in this tree; only unrelated “stack overflow” hits elsewhere.
- **Fix-already-present check** — execute_depth / ATOM_EXECUTE_MAX_DEPTH never appear in amdgpu history here; the vulnerable recursive atom_op_calltable() path is still present on **v6.18.44**.
That supports the **YES** backport verdict: the bug exists locally, the fix is missing, and the patch should apply cleanly.
drivers/gpu/drm/amd/amdgpu/atom.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/atom.h | 3 +++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/atom.c +11 -0
@@ -59,6 +59,9 @@#define ATOM_CMD_TIMEOUT_SEC 20 +/* Limit ATOM command table recursion (calltable) to avoid kernel stack overflow. */ +#define ATOM_EXECUTE_MAX_DEPTH 32 + typedef struct { struct atom_context *ctx; uint32_t *ps, *ws;
@@ -1229,6 +1232,13 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,if (!base)return -EINVAL ; +if (ctx->execute_depth >=ATOM_EXECUTE_MAX_DEPTH ) { +DRM_ERROR ("atombios command table nesting exceeded limit (%u)\n" , +ATOM_EXECUTE_MAX_DEPTH ); +return -ELOOP ; + } + ctx->execute_depth++; + len =CU16 (base +ATOM_CT_SIZE_PTR ); ws =CU8 (base +ATOM_CT_WS_PTR ); ps =CU8 (base +ATOM_CT_PS_PTR ) &ATOM_CT_PS_MASK ;
@@ -1285,6 +1295,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, free:if (ws)kfree (ectx.ws); + ctx->execute_depth--;return ret; }
drivers/gpu/drm/amd/amdgpu/atom.h +3 -0
@@ -153,6 +153,9 @@ struct atom_context {uint8_t vbios_ver_str[STRLEN_NORMAL ];uint8_t date[STRLEN_NORMAL ];uint8_t build_num[STRLEN_NORMAL ]; + +/* Nesting depth for ATOM_OP_CALLTABLE */ +unsigned int execute_depth; };extern int amdgpu_atom_debug;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] drm/amdgpu: cap ATOM command table nesting depth
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Out-of-bounds stack/heap access due to unvalidated ps_shift causing negative ps_size.
- [Critical] Integer overflow in ATOM_ARG_FB bounds check allows out-of-bounds memory corruption.
- [Medium] The command table loop timeout mechanism in atom_op_jump can be trivially defeated by a multi-jump loop.
- [Low] The debug_depth counter leaks permanently when the execution of a command table is aborted. --
commit 0c77b7dbed85cb54e1624a76d5ddd1e7608f6557
Author: Candice Li <[email protected]>
drm/amdgpu: cap ATOM command table nesting depth
Cap nesting at 32 levels with execute_depth and return -ELOOP when exceeded.
drivers/gpu/drm/amd/amdgpu/atom.c line 64
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/atom.c +3
-0@@ -59,6 +59,9 @@#define ATOM_CMD_TIMEOUT_SEC 20 +/* Limit ATOM command table recursion (calltable) to avoid kernel stack overflow. */ +#define ATOM_EXECUTE_MAX_DEPTH 32 +
[Severity: Critical]
This is a pre-existing issue, but can this lead to an out-of-bounds access?
In atom_op_calltable(), the size calculation could evaluate to a negative integer:
drivers/gpu/drm/amd/amdgpu/atom.c:atom_op_calltable() {
...
r = amdgpu_atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift,
ctx->ps_size - ctx->ps_shift);
...
}If a crafted VBIOS provides a large ps_shift value, ctx->ps_size - ctx->ps_shift will be negative. When passed as params_size into amdgpu_atom_execute_table_locked(), this negative value propagates.
Later, in atom_put_dst(), this negative size is promoted to a large unsigned integer, which would bypass the bounds check:
drivers/gpu/drm/amd/amdgpu/atom.c:atom_put_dst() {
...
if (idx >= ctx->ps_size) {
...
}Could this be leveraged for out-of-bounds reads or writes on the stack or heap?
[Severity: Critical]
This is a pre-existing issue, but does this bounds check have an integer overflow vulnerability?
If a crafted VBIOS sets fb_base to a value near UINT32_MAX, the addition in the ATOM_ARG_FB bounds check can overflow:
drivers/gpu/drm/amd/amdgpu/atom.c:atom_put_dst() {
...
if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
...
}If gctx->fb_base + (idx * 4) overflows into a small positive number, it passes the bounds check. The subsequent memory access uses the original huge fb_base:
drivers/gpu/drm/amd/amdgpu/atom.c:atom_put_dst() {
...
gctx->scratch[(gctx->fb_base / 4) + idx] = val;
...
}Can this lead to out-of-bounds memory corruption?
[Severity: Medium]
This is a pre-existing issue, but can the command table loop timeout be easily defeated?
The timeout mechanism in atom_op_jump() resets the tracker when the script jumps to a different instruction:
drivers/gpu/drm/amd/amdgpu/atom.c:atom_op_jump() {
...
} else {
ctx->last_jump = ctx->start + target;
ctx->last_jump_jiffies = jiffies;
}
...
}If a VBIOS script uses multiple jump instructions in a loop (for example, jumping between A and B), ctx->last_jump == (ctx->start + target) will always be false. This forces the execution into the else block, continuously resetting the 20-second timeout tracker.
Could this allow a multi-jump loop to hang the driver indefinitely, causing a denial of service?
[ ... ]
drivers/gpu/drm/amd/amdgpu/atom.c static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, · line 1298
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/atom.c +1
-0@@ -1285,6 +1295,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, free:if (ws)kfree (ectx.ws); + ctx->execute_depth--;
[Severity: Low]
This is a pre-existing issue, but does the debug_depth counter leak when an execution is aborted?
In amdgpu_atom_execute_table_locked(), if ectx.abort becomes true, the code jumps directly to the free label:
if (ectx.abort) {
...
goto free;
}Because the free label is located after the debug_depth--; statement, the counter is never decremented on this error path. When amdgpu_atom_debug is enabled, could this cause unbounded indentation in debug logs over time?
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/atom.c +0
-0return ret; }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 btrfs: fix reloc root cleanup in merge_reloc_roots()
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit b78fe9563e2d5ae47805f1e5dc722c91fd30e1f8 ]
If the root we got has zero root refs in its root item, we are resetting the root's ->reloc_root without using barriers like we do everywhere else. Sashiko complained about this while reviewing another patch, and it's correct (see the Link tag below).
Also, we should not clear BTRFS_ROOT_DEAD_RELOC_TREE from the root unless the root points to the reloc root we have.
Fix this by using clear_reloc_root(), which issues the memory barrier after setting the root's ->reloc_root to NULL and before clearing the bit BTRFS_ROOT_DEAD_RELOC_TREE from the root.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: btrfs: fix reloc root cleanup in merge_reloc_roots()
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9)
**Commit analyzed:** b78fe9563e2d5ae47805f1e5dc722c91fd30e1f8 (not yet merged into this checkout)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [btrfs] [fix] — correct reloc-root cleanup in merge_reloc_roots() when a reloc root has zero root refs.
### Step 1.2: Tags
**Record:**
- **Link:** Sashiko automated review (https://sashiko.dev/...)
- **Reviewed-by:** Boris Burkov <[email protected]>
- **Signed-off-by:** Filipe Manana, David Sterba
- No Fixes:, Reported-by:, Tested-by:, Cc: [email protected]
- Notable: found during code review (Sashiko), not a syzbot/user crash report for this specific path
### Step 1.3: Body Analysis
**Record:**
- **Bug:** In the zero-ref reloc-root branch of merge_reloc_roots(), root->reloc_root is cleared without the memory barrier used elsewhere; BTRFS_ROOT_DEAD_RELOC_TREE is cleared unconditionally even when root->reloc_root != reloc_root.
- **Symptom:** Incorrect synchronization with have_reloc_root() / reloc_root_is_dead(); can observe stale reloc_root pointers or wrong dead-tree state during relocation/balance.
- **Root cause:** Inconsistent barrier usage and misplaced clear_bit() outside the matching-reloc-root guard.
- **Fix approach:** Use clear_reloc_root() helper (sets NULL → smp_wmb() → clear_bit()), only when root->reloc_root == reloc_root.
### Step 1.4: Hidden Bug Fix?
**Record:** No — explicitly described as a bug fix (barrier + logic error).
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** fs/btrfs/relocation.c (+2 / -3)
- **Function:** merge_reloc_roots()
- **Scope:** Single-file, surgical fix in one error/cleanup branch
### Step 2.2: Code Flow Change
**Record:**
| Hunk | Before | After | |------|--------|-------| | Zero-ref cleanup branch | `root->reloc_root = NULL;
btrfs_put_root(reloc_root); then unconditional clear_bit(DEAD_RELOC_TREE) | clear_reloc_root(root); btrfs_put_root(reloc_root); only inside if (root->reloc_root == reloc_root)` |
**Affected path:** Relocation merge when btrfs_root_refs(&reloc_root->root_item) == 0 (dead/orphan reloc tree cleanup during balance).
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Synchronization / logic correctness
- **Mechanism 1 (missing smp_wmb()):** Writers in clean_dirty_subvols() (lines 1474–1480) and btrfs_update_reloc_root() (lines 796–801) use smp_wmb() between NULL-ing reloc_root and clearing BTRFS_ROOT_DEAD_RELOC_TREE. merge_reloc_roots() did not, breaking pairing with reloc_root_is_dead()'s smp_rmb().
- **Mechanism 2 (wrong clear_bit scope):** clear_bit() ran even when root->reloc_root != reloc_root, corrupting state for a root still associated with a different reloc root.
### Step 2.4: Fix Quality
**Record:** Fix is minimal and matches the established pattern in the same file. Low regression risk. **Caveat:** depends on clear_reloc_root() helper, which is **not present** in this tree (see Phase 6).
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Buggy lines (1873–1879) blamed to 5d324e5159d9e (6.18-rc8 era merge, Nov 2025). Barrier infrastructure (reloc_root_is_dead, BTRFS_ROOT_DEAD_RELOC_TREE) introduced in same timeframe — relatively new in 6.18.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related Changes
**Record:**
- 60a23d4ea169e — related fix in same function (root leak on unexpected reloc_root); already in this tree.
- Part of 2-patch series [PATCH 0/2] btrfs: fix incorrect barrier usage in relocation:
- **1/2:** this commit
- **2/2:** btrfs: fix memory barrier order in reloc_root_is_dead()
- clear_reloc_root() introduced in separate UAF-fix series ([PATCH v2] btrfs: fix use-after-free on reloc root after error in insert_dirty_subvol()); **not in this tree**.
### Step 3.4: Author Context
**Record:** Filipe Manana — active btrfs maintainer; multiple recent merge_reloc_roots() fixes in this tree.
### Step 3.5: Dependencies
**Record:** Commit calls clear_reloc_root(), which does not exist in 6.18.44. **Not standalone as-is**, but trivially adaptable using the inline pattern already in clean_dirty_subvols():
```c root->reloc_root = NULL; smp_wmb(); clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state); ```
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:**
- **b4 dig:** https://patch.msgid.link/50682caa6bbf69740c629a26ff6f19a72
[email protected]
- **Series:** v1 only (2026-06-12)
- **Reviewer feedback:** Boris Burkov Reviewed-by on cover letter; David Sterba replied on patch 2/2; kernel test robot build-tested patch 2/2
- **Stable nomination:** None found in thread
### Step 4.2: Reviewers
**Record:** [email protected]; Boris Burkov reviewed; David Sterba (btrfs maintainer) engaged on patch 2/2.
### Step 4.3: Bug Report
**Record:** No syzbot/user crash report for this specific bug. Identified by Sashiko during review of a related patch. Related UAF in relocation (syzbot-reported) motivated the clear_reloc_root() helper in a separate series.
### Step 4.4: Related Patches
**Record:** Patch 2/2 fixes read-side barrier ordering in reloc_root_is_dead(). Ideally backported together for complete barrier correctness, but patch 1/2 independently fixes a real write-side bug.
### Step 4.5: Stable List History
**Record:** No stable-list discussion found.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** merge_reloc_roots(), reloc_root_is_dead(), have_reloc_root(), clear_reloc_root() (upstream only)
### Step 5.2: Callers
**Record:** merge_reloc_roots() called from:
- relocate_block_group() (line 3653) — balance/relocation path
- Another relocation path (line 4198)
Both are btrfs balance/relocation operations, reachable via BTRFS_IOC_BALANCE ioctl (privileged).
### Step 5.3: Callees
**Record:** btrfs_get_fs_root(), btrfs_put_root(), clear_bit(), barrier primitives; interacts with refcounted btrfs_root objects.
### Step 5.4: Reachability
**Record:** Triggered during btrfs balance/relocation (admin/root operation). Not every boot, but real production use (rebalancing, device replacement). Unprivileged users cannot directly trigger, but corruption from a privileged balance affects the whole filesystem.
### Step 5.5: Similar Patterns
**Record:** Correct barrier pattern exists in clean_dirty_subvols() at lines 1474–1480; merge_reloc_roots() is the inconsistent outlier.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
### Step 6.1: Buggy Code Present? **Record:** **YES** — confirmed at lines 1873–1879:
```1873:1880:fs/btrfs/relocation.c
if (!IS_ERR(root)) {
if (root->reloc_root == reloc_root) {
root->reloc_root = NULL;
btrfs_put_root(reloc_root);
}
clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE,
&root->state);
btrfs_put_root(root);
```Barrier infrastructure (BTRFS_ROOT_DEAD_RELOC_TREE, reloc_root_is_dead) also present since 6.18.
### Step 6.2: Backport Complications
**Record:** **Minor adaptation needed.** clear_reloc_root() does not exist in this tree. Equivalent inline fix (matching clean_dirty_subvols()) is straightforward. No conflicting refactors in this area.
### Step 6.3: Related Fixes Already Present? **Record:** 60a23d4ea169e (root leak fix) is present. This barrier/logic fix is **not** present. No duplicate fix found.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
**Record:** **fs/btrfs** — IMPORTANT (filesystem, data integrity)
### Step 7.2: Activity
**Record:** Active — multiple recent merge_reloc_roots() fixes in 6.18.y.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** Users running btrfs balance/relocation on 6.18.y kernels with the BTRFS_ROOT_DEAD_RELOC_TREE barrier mechanism.
### Step 8.2: Trigger Conditions
**Record:** Balance/relocation reaching merge_reloc_roots() with a reloc root whose root item has zero refs. Uncommon relative to normal I/O, but standard admin workflow. Privileged trigger only.
### Step 8.3: Failure Mode Severity
**Record:**
- Stale reloc_root pointer observed after bit cleared → potential **UAF** or double-free (same class as syzbot-reported relocation UAF)
- Wrong clear_bit when reloc_root doesn't match → incorrect have_reloc_root() behavior
- **Severity: HIGH** (filesystem corruption / crash potential)
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH — prevents barrier/logic bug in relocation cleanup
- **Risk:** LOW — 3-line effective change, matches existing in-file pattern
- **Ratio:** Favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, verifiable bug in this tree (missing barrier + unconditional clear_bit)
- Same file already documents correct pattern (clean_dirty_subvols)
- Small, surgical fix reviewed by btrfs reviewers
- Same bug class as syzbot-reported relocation UAF (barrier inconsistency in reloc-root lifecycle)
- Barrier infrastructure is present in 6.18.44 — bug is live
**AGAINST backport:**
- No direct crash report for this exact path (review-found)
- Depends on clear_reloc_root() not in tree (needs minor backport adaptation)
- Patch 2/2 ideally accompanies for complete read-side fix
- Only affects balance/relocation (not hot path)
**Unresolved:** No runtime reproduction confirmed for this exact path; impact inferred from code analysis and related UAF class.
### Step 9.2: Stable Rules Checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — matches established in- file pattern; reviewed by Boris Burkov; build-tested in series | | 2. Fixes real bug affecting users? | **PASS** — barrier + logic error in relocation cleanup | | 3. Important issue? | **PASS** — potential UAF/corruption during balance | | 4. Small and contained? | **PASS** — 5 lines net in one function | | 5. No new features/APIs? | **PASS** — correctness fix only | | 6. Can apply to local tree? | **PASS** (with adaptation) — inline `smp_wmb()` pattern substitutes for missing `clear_reloc_root()` |
### Step 9.3: Exception Category
**Record:** N/A — standard bug fix.
### Step 9.4: Decision Rationale
The buggy code exists in Linux 6.18.44. The fix corrects a memory- ordering inconsistency and a logic error (clear_bit outside the matching-reloc-root guard) in btrfs relocation cleanup — the same synchronization design used elsewhere in relocation.c. While the patch calls clear_reloc_root() which is not yet in this tree, the equivalent inline fix is trivial and already demonstrated in clean_dirty_subvols(). The fix is small, low-risk, and addresses a HIGH-severity failure mode in filesystem code.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from provided commit message
- **[Phase 1]** Confirmed no syzbot Reported-by; Sashiko Link tag present
- **[Phase 2]** Read diff: +2/-3 in merge_reloc_roots() zero-ref branch
- **[Phase 2]** Read current buggy code at lines 1873–1879 in fs/btrfs/relocation.c
- **[Phase 2]** Read correct barrier pattern at lines 1474–1480 and 796–801
- **[Phase 3]** git describe HEAD: v6.18.44
- **[Phase 3]** git blame -L 1873,1880: lines from 5d324e5159d9e (Nov 2025)
- **[Phase 3]** git log --grep="clear_reloc_root": no results in tree
- **[Phase 3]** grep clear_reloc_root fs/btrfs/: no matches — helper absent
- **[Phase 3]** 60a23d4ea169e confirmed related prior fix already in tree
- **[Phase 3]** git merge-base --is-ancestor b78fe95 HEAD: exit 1 — commit not merged
- **[Phase 4]** b4 dig -c b78fe95: found lore URL, patch 1/2 of 2-patch series
- **[Phase 4]** b4 dig -a: v1 only
- **[Phase 4]** b4 dig -w: [email protected] CC'd
- **[Phase 4]** Read /tmp/b78fe95.mbox: cover letter, patch 2/2 content, Boris Reviewed-by
- **[Phase 4]** spinics.net msg166109: confirmed clear_reloc_root() introduced in separate UAF series
- **[Phase 5]** grep merge_reloc_roots(: 2 call sites (lines 3653, 4198)
- **[Phase 5]** Read reloc_root_is_dead() / have_reloc_root() at lines 246–274
- **[Phase 6]** Confirmed buggy code present in 6.18.44 checkout
- **[Phase 6]** Confirmed clear_reloc_root() absent; inline adaptation viable
- **[Phase 8]** Assessed severity from barrier pairing analysis and related UAF class (not directly reproduced)
**YES**The background search finished: **clear_reloc_root does not appear anywhere in this 6.18.44 tree** — no commits introduce it under fs/btrfs/ or elsewhere.
That matches the earlier analysis: commit b78fe95 calls a helper that isn’t here yet (it lands in a separate UAF-fix series). A backport would need a small adaptation — use the same inline pattern already in clean_dirty_subvols() (reloc_root = NULL → smp_wmb() → clear_bit) instead of calling clear_reloc_root().
The verdict for this tree remains **YES**, with that minor backport tweak.
fs/btrfs/relocation.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/relocation.c +2 -3
@@ -1910,11 +1910,10 @@ void merge_reloc_roots(struct reloc_control *rc) }else {if (!IS_ERR (root)) {if (root->reloc_root == reloc_root) { - root->reloc_root =NULL ; +clear_reloc_root (root); +/* Drop the ref for root->reloc_root. */ btrfs_put_root (reloc_root); } -clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , - &root->state);btrfs_put_root (root); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net/mlx5e: Verify unique vhca_id count instead of range
In reply to Sasha LevinFrom: Shay Drory <[email protected]>
[ Upstream commit 0b1c4495aa007932e9cbd7b45a8037e7b4fe34b0 ]
Change verify_num_vhca_ids() to count the number of unique vhca_ids and verify this count doesn't exceed max_num_vhca_id, rather than validating individual vhca_id values are within a specific range.
The previous implementation checked if each vhca_id was in the range [0, max_num_vhca_id - 1], which is overly restrictive. The hardware capability max_rqt_vhca_id represents the maximum number of unique vhca_ids that can be used, not a range constraint on individual IDs.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [net/mlx5e] [verify/change] Verify unique vhca_id count instead of range — mlx5e RQT validation correction.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Shay Drory <[email protected]> (author)
- Reviewed-by: Mark Bloch <[email protected]>
- Signed-off-by: Tariq Toukan <[email protected]>
- `Link:
https://patch.msgid.link/[email protected]`
(patch 14 of a series)
- Signed-off-by: Jakub Kicinski <[email protected]> (netdev maintainer merge)
- No Fixes:, Reported-by:, Cc: [email protected], or syzbot tags
- Notable: NVIDIA internal review + netdev maintainer merge; no user/fuzzer reports
**Step 1.3 — Body analysis**
Record:
- **Bug:** verify_num_vhca_ids() treats max_rqt_vhca_id as an upper bound on each individual vhca_id value ([0, max-1]), but hardware defines it as the maximum number of *distinct* vhca_id values allowed in an RQT.
- **Symptom:** Valid cross-vHCA RQT configurations are rejected when actual hardware vhca_id values exceed that numeric limit, even when the number of unique IDs is within capability.
- **Root cause:** Semantic mismatch between driver validation and hardware capability definition.
- **Versions:** Not stated in the commit message.
**Step 1.4 — Hidden bug fix?**
Record: Yes. Despite no "fix" in the subject, this corrects broken validation logic introduced with cross-vHCA RSS. It is a functional bug fix, not a refactor or optimization.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c (+15 / -5 net)
- **Function modified:** verify_num_vhca_ids() only
- **Scope:** Single-file, single-function surgical change
**Step 2.2 — Code flow change**
Record:
- **Hunk 1 (before):** Loop all entries; reject if any vhca_ids[i] >= max_num_vhca_id.
- **Hunk 1 (after):** Count unique vhca_ids via nested loop; accept if unique_count <= max_num_vhca_id.
- **Affected paths:** All callers of rqt_verify_vhca_ids():
- mlx5e_rqt_init() — returns -EOPNOTSUPP on failure
- mlx5e_rqt_redirect() — returns -EINVAL on failure
- mlx5e_rqt_redirect_indir() — pre-check before RSS indirection redirect
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Logic / correctness fix (incorrect parameter semantics)
- **Mechanism:** max_rqt_vhca_id is a *count* cap, not a per-ID range. Actual vhca_id values come from MLX5_CAP_GEN(mdev, vhca_id) (firmware-assigned), while sd.c already compares host_buses > max_rqt_vhca_id as a count. The RQT validator used the wrong interpretation, rejecting configurations that sd.c already approved.
**Step 2.4 — Fix quality**
Record:
- Fix is obviously correct and consistent with mlx5_sd_is_supported() in sd.c.
- Minimal scope; no API changes.
- **Regression risk:** Low. Worst case is allowing configurations hardware already supports. Uniqueness counting is O(n²), but n is bounded by channel count (SD max group size is 2).
- No new locking or memory management changes.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- Buggy validation introduced in 40e6ad9182b48 ("net/mlx5e: Support cross-vhca RSS", Tariq Toukan, 2024-02-14, merged 2024-03-07).
- Present in local tree v6.18.44 (confirmed ancestor of HEAD).
- Bug has existed since the cross-vHCA RSS feature landed.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag in commit message.
**Step 3.3 — Related file history**
Record:
- rqt.c history: cross-vHCA RSS (40e6ad9182b48), XOR hash channel limit (49e6c93870517), earlier RQT object conversion.
- SD support added separately in sd.c (2023–2024 commits); uses correct count semantics for max_rqt_vhca_id.
- Standalone fix; not part of a multi-patch dependency chain for this specific change.
**Step 3.4 — Author context**
Record: Tariq Toukan authored the original cross-vHCA RSS code and is a regular mlx5/mlx5e contributor. Shay Drory (fix author) is also an NVIDIA mlx5 contributor.
**Step 3.5 — Dependencies**
Record: No prerequisite commits required. The diff only modifies an existing static function in code already present in this tree. Applies cleanly to current rqt.c.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: b4 dig -c <commit> could not be run — the fix commit is not in this checkout. Link: URL and lore.kernel.org fetch blocked by Anubis bot protection. **UNVERIFIED:** full mailing list thread content and any explicit stable nominations.
**Step 4.2 — Reviewers**
Record: **UNVERIFIED** via b4 dig -w. From commit message: Mark Bloch (NVIDIA reviewer), Tariq Toukan, Jakub Kicinski (netdev maintainer).
**Step 4.3 — Bug reports**
Record: No Reported-by: or bugzilla/syzbot links. No external crash report — this is a driver logic bug found/reviewed internally.
**Step 4.4 — Series context**
Record: Link indicates patch 14/N of a larger tariqt series (20260531113954.395443-14). This specific patch is self-contained (one function in one file); no evidence other series patches are required.
**Step 4.5 — Stable list history**
Record: **UNVERIFIED** — could not search lore stable archive due to bot protection.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: verify_num_vhca_ids() (modified); callers via rqt_verify_vhca_ids().
**Step 5.2 — Callers**
Record:
- mlx5e_rqt_init() — RQT creation during RSS setup
- mlx5e_rqt_redirect() — RQT modification during channel activation
- mlx5e_rqt_redirect_indir() — RSS indirection table updates
In SD multi-vHCA mode (MLX5E_RX_RES_FEATURE_MULTI_VHCA, enabled when mlx5_get_sd() is set in en_main.c):
- mlx5e_channels_get_regular_rqn() / mlx5e_channels_get_xsk_rqn() populate vhca_id from MLX5_CAP_GEN(c->mdev, vhca_id)
- SD channels map to different mlx5_core_dev instances via mlx5_sd_ch_ix_get_dev() in en_main.c
- mlx5e_rx_res_channels_activate() drives RSS enable and per-channel direct RQT redirect
**Step 5.3 — Callees**
Record: Uses MLX5_CAP_GEN_2(mdev, max_rqt_vhca_id) only; no allocations or locks.
**Step 5.4 — Reachability**
Record:
- Triggered during netdev open/channel activation on mlx5e devices with Socket Direct + cross_vhca_rqt hardware.
- Not a direct syscall path, but reached during normal driver operation on supported enterprise NIC configurations.
- SD is niche but is a supported, production feature path.
**Step 5.5 — Similar patterns**
Record: mlx5_sd_is_supported() in sd.c:116 correctly uses host_buses > MLX5_CAP_GEN_2(dev, max_rqt_vhca_id) as a count comparison. The RQT validator was the outlier using range semantics.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Current rqt.c lines 7–17 contain the range-based check. Fix commit is **not** yet applied. Bug introduced in 40e6ad9182b48, which is an ancestor of HEAD.
**Step 6.2 — Backport complications**
Record: Expected **clean apply** — single hunk in an unchanged function with no surrounding churn in recent rqt.c history.
**Step 6.3 — Related fixes already present?**
Record: No alternate fix for this issue found in tree. git log --grep="unique vhca_id" returned nothing.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: drivers/net/ethernet/mellanox/mlx5 — mlx5e NIC driver. **Criticality: IMPORTANT** (enterprise NIC driver, not core kernel, but networking data path).
**Step 7.2 — Activity**
Record: mlx5/mlx5e actively maintained; SD and cross-vHCA RSS are relatively recent additions (2023–2024).
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users of Mellanox/NVIDIA ConnectX **Socket Direct** multi-PF setups with cross_vhca_rqt hardware capability. Config-specific, platform-specific — not universal.
**Step 8.2 — Trigger conditions**
Record:
- SD group configured (mlx5_get_sd() non-NULL)
- MLX5E_RX_RES_FEATURE_MULTI_VHCA enabled
- Actual firmware-assigned vhca_id values ≥ max_rqt_vhca_id (common when IDs are not 0-based indices)
- Triggered on channel activation / RSS RQT redirect — not a race; deterministic validation failure
**Step 8.3 — Failure mode severity**
Record:
- mlx5e_rqt_init() → -EOPNOTSUPP
- mlx5e_rqt_redirect() / mlx5e_rqt_redirect_indir() → -EINVAL
- mlx5e_rx_res_channel_activate_direct() logs warning on redirect failure
- **Result:** Cross-vHCA RSS and RX steering from primary to secondaries broken — **functional networking failure** for SD users
- **Severity: HIGH** for affected deployments (broken networking), but **not CRITICAL** (no kernel crash, no memory corruption, no security issue)
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** Restores a supported hardware feature that has been broken since introduction whenever vhca_id values exceed the capability number; aligns driver with hardware semantics and with sd.c.
- **Risk:** Very low — ~20 lines, vendor-reviewed, no structural changes.
- **Ratio:** Good benefit for SD users at minimal risk, but narrow audience.
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
**FOR backport:**
- Real, verified logic bug since cross-vHCA RSS landed (40e6ad9182b48)
- Buggy code confirmed present in local v6.18.44 tree
- Breaks Socket Direct cross-vHCA RX steering (production networking failure for affected hardware)
- Small, surgical, vendor-reviewed fix
- Consistent with existing sd.c interpretation of max_rqt_vhca_id
- No dependencies; clean apply expected
- No new APIs or features
**AGAINST backport:**
- Very niche hardware (Socket Direct, max 2 PFs per MLX5_SD_MAX_GROUP_SZ)
- No crash, corruption, deadlock, or security impact
- No syzbot/user bug reports
- Some SD configs may coincidentally pass the old check if vhca_id values happen to be small
- Mailing list/stable discussion not verified
**Unresolved:**
- Whether the bug manifests on all real SD deployments (depends on firmware vhca_id assignment)
- Full lore review thread content
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — semantics match sd.c and commit explanation; NVIDIA-reviewed.
2. Fixes a real bug affecting users? **PASS** — incorrect validation rejects valid HW configs on SD+cross-vHCA path.
3. Important issue? **PASS (borderline)** — functional networking breakage for SD users, not crash/corruption.
4. Small and contained? **PASS** — one function, ~20 lines.
5. No new features or APIs? **PASS**.
6. Can apply to local tree? **PASS** — code exists, fix not yet present, clean apply expected.
**Step 9.3 — Exception categories**
Record: Hardware workaround / driver correctness fix for an existing feature — analogous to quirk/correctness fixes for supported enterprise hardware. Not a device-ID addition, build fix, or docs fix.
**Step 9.4 — Decision rationale**
This is a genuine driver bug that has been present since cross-vHCA RSS was added to this tree. It causes Socket Direct multi-PF RX steering to fail when firmware-assigned vhca_id values do not fall in [0, max_rqt_vhca_id), which is the expected interpretation of a *count* capability. The fix is minimal, low-risk, vendor-authored, and restores functionality for a supported enterprise NIC configuration. While the audience is narrow and the failure mode is functional rather than a kernel panic, broken networking on production SD deployments meets the stable bar for driver correctness fixes to existing hardware support.
---
## Verification
- [Phase 1] Parsed commit message tags from user-provided commit text
- [Phase 2] Read current rqt.c and traced rqt_verify_vhca_ids() call chain
- [Phase 3] git blame -L 7,18 rqt.c: buggy code from 40e6ad9182b48 (2024-02-14)
- [Phase 3] git show 40e6ad9182b48: confirmed original range-based validation at introduction
- [Phase 3] git merge-base --is-ancestor 40e6ad9182b48 HEAD: buggy commit IS in v6.18.44 tree
- [Phase 3] git log --oneline -20 -- rqt.c: no conflicting later changes
- [Phase 4] b4 dig: could not run — fix commit not in checkout
- [Phase 4] WebFetch lore/patch.msgid.link: blocked by Anubis — **UNVERIFIED** mailing list discussion
- [Phase 5] grep vhca_ids in en/: traced population via channels.c → MLX5_CAP_GEN(c->mdev, vhca_id)
- [Phase 5] Read en_main.c:2769 — SD channels use mlx5_sd_ch_ix_get_dev() for per-PF mdev
- [Phase 5] Read sd.c:116 — max_rqt_vhca_id used as count limit for host_buses
- [Phase 5] Read rx_res.c:578-598 — channel activation populates vhca_ids and enables RSS
- [Phase 6] git describe HEAD / make kernelversion: **v6.18.44 / 6.18.44**
- [Phase 6] Current rqt.c lines 13-16: range check still present (fix NOT applied)
- [Phase 6] git log --grep="unique vhca_id": no existing fix in tree
- [Phase 8] MLX5_SD_MAX_GROUP_SZ = 2 in sd.h — bounded input size for uniqueness loop
- [Phase 8] Failure paths verified: -EOPNOTSUPP in mlx5e_rqt_init, -EINVAL in redirect paths
**YES**
.../net/ethernet/mellanox/mlx5/core/en/rqt.c | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rqt.c +21 -6
@@ -8,13 +8,28 @@ static bool verify_num_vhca_ids(struct mlx5_core_dev *mdev, u32 *vhca_ids, unsigned int size) {unsigned int max_num_vhca_id =MLX5_CAP_GEN_2 (mdev, max_rqt_vhca_id); -int i; +unsigned int unique_count =0 ; +int i, j; + +/* Count unique vhca_ids */ +for (i =0 ; i < size; i++) { +bool is_unique = true; + +/* Check if vhca_ids[i] was already seen */ +for (j =0 ; j < i; j++) { +if (vhca_ids[j] == vhca_ids[i]) { + is_unique = false; +break ; + } + } +if (is_unique) + unique_count++; + } -/* Verify that all vhca_ids are in range [0, max_num_vhca_ids - 1] */ -for (i =0 ; i < size; i++) -if (vhca_ids[i] >= max_num_vhca_id) -return false; -return true; +/* Verify that number of unique vhca_ids doesn't exceed +* max_num_vhca_id +*/ +return unique_count <= max_num_vhca_id; } static bool rqt_verify_vhca_ids(struct mlx5_core_dev *mdev, u32 *vhca_ids,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: mld: honor BSS_CHANGED_BEACON_ENABLED
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit a342c99cb70dde344723f6c802efd24e614f4fda ]
We should stick to mac80211's flow to start / stop beaconing. This allows to stop beaconing before we remove the BIGTK.
Note that the start and stop beaconing flows are not exactly symmetric. When we start beaconing, we just update the beacon template. We assume that mac80211 won't update the beacons, if we're not supposed to be sending it.
Also note that we now send the beacon template after the broadcast station was added to the firmware: the broadcast station is added in the start_ap() flow, while the beacon template is now added in the link_changed() flow which happens later. This is not what we did before this patch, but this sequence is supported by the firmware as well.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: wifi: iwlwifi: mld: honor BSS_CHANGED_BEACON_ENABLED
**Local tree:** Linux **6.18.44** (git describe HEAD → v6.18.44, make kernelversion → 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 – Subject line**
Record: [wifi: iwlwifi: mld] [honor] — Implement proper handling of mac80211 BSS_CHANGED_BEACON_ENABLED in the Intel MLD (WiFi 7) driver.
**Step 1.2 – Tags**
Record:
- Signed-off-by: Emmanuel Grumbach <[email protected]> (author)
- Signed-off-by: Miri Korenblit <[email protected]> (series submitter)
- Link: https://patch.msgid.link/20260511203428... (patch submission)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or Reviewed-by: tags
**Step 1.3 – Body analysis**
Record:
- **Bug:** Driver does not follow mac80211’s beacon start/stop flow; beaconing is not stopped when mac80211 disables it.
- **Symptom:** On AP teardown, firmware may continue beaconing while keys (specifically BIGTK) are removed.
- **Root cause:** Missing BSS_CHANGED_BEACON_ENABLED handler; beacon template was sent too early in start_ap() instead of via link_info_changed.
- **Version info:** None stated.
**Step 1.4 – Hidden bug fix?**
Record: **Yes.** Although the subject says “honor,” this is a driver/mac80211 contract bug: beaconing must stop before key removal on AP stop.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 – Inventory**
Record:
- drivers/net/wireless/intel/iwlwifi/mld/ap.c (+25/−4): new iwl_mld_stop_beacon(), remove early beacon update from start_ap
- drivers/net/wireless/intel/iwlwifi/mld/ap.h (+4): declare iwl_mld_stop_beacon()
- drivers/net/wireless/intel/iwlwifi/mld/mac80211.c (+6/−2): handle BSS_CHANGED_BEACON_ENABLED, add WARN_ON(!link->enable_beacon) for BSS_CHANGED_BEACON
- **Functions:** iwl_mld_stop_beacon() (new), iwl_mld_start_ap_ibss(), iwl_mld_link_info_changed_ap_ibss()
- **Scope:** Single-subsystem, surgical (~32 lines)
**Step 2.2 – Code flow changes**
Record:
- **Hunk 1 (iwl_mld_stop_beacon):** Sends BEACON_TEMPLATE_CMD with byte_cnt = 0 and valid link_id → tells firmware to stop beaconing. Only if BEACON_TEMPLATE_CMD version ≥ 15.
- **Hunk 2 (start_ap):** Removes iwl_mld_update_beacon_template() call; beacon setup deferred to link_info_changed.
- **Hunk 3 (link_info_changed):** On BSS_CHANGED_BEACON, only update if enable_beacon is true (with WARN_ON). On BSS_CHANGED_BEACON_ENABLED with !enable_beacon, call iwl_mld_stop_beacon().
**Step 2.3 – Bug mechanism**
Record: **Logic / correctness fix** — missing mac80211 callback handling. mac80211 notifies drivers to stop beaconing (BSS_CHANGED_BEACON_ENABLED) **before** removing keys; iwl_mld ignored this, so firmware could keep transmitting beacons while BIGTK/GTK keys were torn down.
**Step 2.4 – Fix quality**
Record: Fix is minimal and matches patterns used by ath10k, ath11k, mt76, rtw88, etc. Low regression risk. Minor concern: cmd_ver < 15 silently skips stop (partial coverage on older firmware).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 – Blame**
Record: This stable tree has shallow per-file history (single unrelated commit on blame). iwl_mld code is present as part of the 6.18.44 import. Buggy pattern (BSS_CHANGED_BEACON only, no BSS_CHANGED_BEACON_ENABLED) is present in the checked-out tree.
**Step 3.2 – Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 – Related file history**
Record: Part of Intel iwlwifi update series `[PATCH 0/15] wifi: iwlwifi:
updates - 2026-05-11 (patch 4/15). Patch 5/15 only moves the function to ap.c` (refactor, not a functional prerequisite).
**Step 3.4 – Author context**
Record: Emmanuel Grumbach is a long-time iwlwifi maintainer. Miri Korenblit submits Intel iwlwifi series regularly.
**Step 3.5 – Dependencies**
Record: **Standalone.** No prerequisite commits required; patch 5/15 is optional cleanup.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 – Original discussion**
Record: b4 dig failed (commit not in this tree). Patch content verified from local mbox 20260511_miriam_rachel_korenblit_wifi_iwlwifi_updates_2026_05_11.mbx. Lore URL blocked by bot protection.
**Step 4.2 – Reviewers**
Record: Not verified from lore (fetch blocked). Series cover letter lists Intel iwlwifi maintainers as authors.
**Step 4.3 – Bug report**
Record: No external bug report or syzbot link. Internal Intel finding.
**Step 4.4 – Series context**
Record: Patch 4/15 in a 15-patch iwlwifi series. Functionally independent of other patches.
**Step 4.5 – Stable list discussion**
Record: Not searched/found. No stable nomination in commit message (expected for manual review).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 – Key functions**
Record: iwl_mld_link_info_changed_ap_ibss(), iwl_mld_start_ap_ibss(), iwl_mld_stop_beacon() (new), iwl_mld_set_key_remove()
**Step 5.2 – Callers**
Record:
- iwl_mld_link_info_changed_ap_ibss() ← iwl_mld_mac80211_link_info_changed() ← mac80211 drv_link_info_changed()
- iwl_mld_start_ap_ibss() ← .start_ap / .join_ibss ops
- Key removal ← iwl_mld_set_key_remove() ← .set_key(DISABLE_KEY)
**Step 5.3 – Callees**
Record: iwl_mld_send_cmd_pdu(BEACON_TEMPLATE_CMD), iwl_mld_update_beacon_template(), iwl_fw_lookup_cmd_ver()
**Step 5.4 – Call chain / reachability**
Record:
``` ieee80211_stop_ap() → enable_beacon = false → ieee80211_link_info_change_notify(BSS_CHANGED_BEACON_ENABLED) [driver should stop beacon] → ieee80211_remove_link_keys() [BIGTK/GTK removed] → drv_stop_ap() → iwl_mld_stop_ap_ibss() ```
Userspace triggers this via nl80211 AP stop (hostapd, wpa_supplicant P2P GO, etc.). **Reachable from normal AP operation.**
**Step 5.5 – Similar patterns**
Record: **Every major mac80211 driver** handles BSS_CHANGED_BEACON_ENABLED (ath10k, ath11k, ath12k, mt76, rtw88, iwllegacy, etc.). iwl_mld is the outlier.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
**Step 6.1 – Buggy code exists?**
Record: **Yes.** Current tree at drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:1157-1158 only handles BSS_CHANGED_BEACON. ap.c:279 still calls iwl_mld_update_beacon_template() inside start_ap. iwl_mld subsystem fully present (CONFIG_IWLMLD, 31 source files).
**Step 6.2 – Backport complications**
Record: **Clean apply expected.** File structure matches the patch context (index 5c59acc8c4c5 etc.). No conflicting changes detected.
**Step 6.3 – Related fixes already present?**
Record: **No.** grep BSS_CHANGED_BEACON_ENABLED under iwlwifi/mld/ returns zero matches.
---
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1 – Subsystem / criticality**
Record: drivers/net/wireless/intel/iwlwifi/mld — **IMPORTANT** (Intel WiFi 7 MLD hardware driver; AP/P2P GO/IBSS modes).
**Step 7.2 – Activity**
Record: Active new driver (Copyright 2024–2025, MLD opmode iwlmld). Targets BZ/SC/DR chip families.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 – Who is affected**
Record: Users of Intel MLD-capable hardware (CONFIG_IWLMLD) running AP, P2P GO, or IBSS — especially WPA3 setups using BIGTK (key indices 6/7).
**Step 8.2 – Trigger conditions**
Record: **Common** — every AP stop/teardown. Requires AP/IBSS mode with iwl_mld driver loaded. Not userspace-exploitable as a security primitive, but normal admin operations trigger it.
**Step 8.3 – Failure mode severity**
Record: Firmware may continue beaconing after BIGTK removal → potential **firmware assert, hang, or corrupted teardown**. Related iwl_mvm code documents firmware asserts (0x2b00) from incorrect beacon/key teardown ordering. Severity: **HIGH** (stability during normal operation).
**Step 8.4 – Risk vs benefit**
Record:
- **Benefit:** HIGH for affected hardware — fixes real teardown ordering bug
- **Risk:** LOW — ~30 lines, follows mac80211 contract, maintainer- authored
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
**Evidence FOR:**
- Real mac80211 contract violation (only iwl_mld driver missing this among peers)
- mac80211 explicitly stops beaconing before key removal (cfg.c:1879-1887)
- BIGTK removal while beaconing continues is a concrete failure scenario
- Small, surgical, maintainer fix
- Code and bug both exist in Linux 6.18.44
- Clean apply expected
**Evidence AGAINST:**
- No external crash report or syzbot finding
- cmd_ver < 15 path leaves bug unfixed on older firmware (mitigated:
MLD firmware likely always ≥ v15)
- iwl_mld is newer hardware with smaller install base than iwl_mvm
- Part of larger series (but this patch is standalone)
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — matches mac80211 design and peer drivers; no Tested-by but logic is clear
2. Fixes a real bug? **PASS** — missing beacon-stop on AP teardown
3. Important issue? **PASS** — teardown stability / potential firmware crash
4. Small and contained? **PASS** — 3 files, ~32 lines
5. No new features/APIs? **PASS** — implements existing mac80211 callback semantics
6. Can apply to local tree? **PASS** — iwl_mld code present, patch applies cleanly
**Exception category:** Standard driver bug fix (not device ID/quirk/DT/docs).
---
## Problem Summary for Stable Users
When an AP on Intel MLD WiFi hardware is stopped, mac80211 tells the driver to disable beaconing **before** removing encryption keys (including BIGTK for WPA3 broadcast integrity). The iwl_mld driver ignored BSS_CHANGED_BEACON_ENABLED, so the firmware could keep transmitting beacons while keys were removed — violating the teardown order mac80211 and every other major WiFi driver follow. This can cause firmware instability during normal AP shutdown (hostapd, P2P GO, etc.).
The fix adds iwl_mld_stop_beacon() (empty beacon template to firmware), handles BSS_CHANGED_BEACON_ENABLED, and moves beacon template installation to the correct point in the mac80211 flow (after broadcast STA is added).
---
## Verification
- [Phase 1] Parsed subject, tags, body from provided commit message and local mbox
- [Phase 2] Diff analysis: 3 files, iwl_mld_stop_beacon() + link_info_changed + start_ap reorder
- [Phase 3] git describe HEAD → v6.18.44; shallow mld git history (1 entry); series context from mbox cover letter
- [Phase 4] b4 dig failed (commit not in tree); patch verified from 2 0260511_miriam_rachel_korenblit_wifi_iwlwifi_updates_2026_05_11.mbx; lore fetch blocked
- [Phase 5] grep BSS_CHANGED_BEACON_ENABLED across drivers/net/wireless — iwl_mld is only Intel driver missing it; traced ieee80211_stop_ap() ordering in cfg.c:1879-1901
- [Phase 6] Confirmed buggy code at mac80211.c:1157-1158 and ap.c:279; grep shows no existing fix; CONFIG_IWLMLD present
- [Phase 7] iwl_mld subsystem confirmed (31 .c files, Kconfig entry)
- [Phase 8] Failure mode: beaconing continues during key teardown; severity HIGH for AP stop path
- [Phase 8] mac80211 key removal after beacon-disable notification verified at cfg.c:1884-1887
- [Phase 8] BIGTK handling in mac80211.c:2141-2142 (keyidx == 6 || keyidx == 7)
- [Phase 8] Peer driver pattern verified in ath10k/mac.c:6212 and ath11k/mac.c:3611
**YES**The analysis is done for **Linux 6.18.44**.
**Verdict: YES** — backport this commit.
The iwl_mld driver in this tree ignores BSS_CHANGED_BEACON_ENABLED, so on AP/P2P GO/IBSS teardown the firmware can keep beaconing while mac80211 removes keys (including BIGTK). mac80211 expects beaconing to stop first; other WiFi drivers already do this. The fix is small (~32 lines), self-contained, and should apply cleanly here.
The background b4 dig run didn’t find a lore match because it was pointed at an unrelated commit in this tree; the patch itself was verified from the local iwlwifi mbox instead.
drivers/net/wireless/intel/iwlwifi/mld/ap.c | 25 +++++++++++++++---- drivers/net/wireless/intel/iwlwifi/mld/ap.h | 6 ++++- .../net/wireless/intel/iwlwifi/mld/mac80211.c | 8 +++++- 3 files changed, 32 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/ap.c +20 -5
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2024 Intel Corporation +* Copyright (C) 2024, 2026 Intel Corporation */ #include <linux/crc32.h>
@@ -239,6 +239,25 @@ int iwl_mld_store_ap_early_key(struct iwl_mld *mld,return -ENOSPC ; } +void iwl_mld_stop_beacon (struct iwl_mld *mld,struct ieee80211_vif *vif, +struct ieee80211_bss_conf *link) +{ +struct iwl_mld_link *mld_link =iwl_mld_link_from_mac80211 (link); +struct iwl_mac_beacon_cmd cmd = {}; +int cmd_ver =iwl_fw_lookup_cmd_ver (mld->fw,BEACON_TEMPLATE_CMD ,14 ); + +if (WARN_ON (!mld_link)) +return ; + +if (cmd_ver <15 ) +return ; + +/* leave byte_cnt 0 */ + cmd.link_id =cpu_to_le32 (mld_link->fw_id); + +iwl_mld_send_cmd_pdu (mld,BEACON_TEMPLATE_CMD , &cmd); +} +static int iwl_mld_send_ap_early_keys (struct iwl_mld *mld,struct ieee80211_vif *vif,struct ieee80211_bss_conf *link)
@@ -276,10 +295,6 @@ int iwl_mld_start_ap_ibss(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_AP )iwl_mld_send_ap_tx_power_constraint_cmd (mld, vif, link); - ret =iwl_mld_update_beacon_template (mld, vif, link); -if (ret) -return ret; -/* the link should be already activated when assigning chan context, * and LINK_CONTEXT_MODIFY_EHT_PARAMS is deprecated */
drivers/net/wireless/intel/iwlwifi/mld/ap.h +5 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2024 Intel Corporation +* Copyright (C) 2024, 2026 Intel Corporation */ #ifndef __iwl_ap_h__#define __iwl_ap_h__
@@ -14,6 +14,10 @@ int iwl_mld_update_beacon_template(struct iwl_mld *mld,struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf); +void iwl_mld_stop_beacon (struct iwl_mld *mld, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *link_conf); +int iwl_mld_start_ap_ibss (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *link);
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +7 -1
@@ -1154,8 +1154,14 @@ iwl_mld_link_info_changed_ap_ibss(struct iwl_mld *mld,if (link_changes)iwl_mld_change_link_in_fw (mld, link, link_changes); -if (changes &BSS_CHANGED_BEACON ) +if (changes &BSS_CHANGED_BEACON ) { +WARN_ON (!link->enable_beacon);iwl_mld_update_beacon_template (mld, vif, link); + } + +/* Enabling beacons was already covered above */ +if ((changes &BSS_CHANGED_BEACON_ENABLED ) && !link->enable_beacon) +iwl_mld_stop_beacon (mld, vif, link); } static
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 blk-cgroup: fix leaks and online flag on radix_tree_insert failure
In reply to Sasha LevinFrom: Tao Cui <[email protected]>
[ Upstream commit dbbca20764382b4d411ec2918f4e278ffe547acc ]
When radix_tree_insert() fails in blkg_create(), the error path has two issues:
1. blkg->online is set to true unconditionally, even when the blkg was never fully inserted. Move the assignment inside the success block.
2. The error path calls blkg_put() without first calling percpu_ref_kill(). Because the refcount is still in percpu mode, percpu_ref_put() only does this_cpu_sub() without checking for zero, so blkg_release() is never triggered. This permanently leaks the blkg memory, its percpu iostat, policy data, the parent blkg reference, and the cgroup css reference — the latter preventing the cgroup from ever being destroyed.
Fix by replacing blkg_put() with percpu_ref_kill(), matching the pattern used in blkg_destroy().
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: blk-cgroup: fix leaks and online flag on radix_tree_insert failure
**Local tree:** v6.18.44 (Linux 6.18.44 stable)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject line**
Record: [blk-cgroup] [fix] — fixes resource leaks and incorrect online flag when radix_tree_insert() fails in blkg_create().
**Step 1.2 — Tags**
Record:
- **Acked-by:** Tejun Heo <[email protected]> (cgroup/block-cgroup maintainer)
- **Signed-off-by:** Tao Cui <[email protected]> (author)
- **Signed-off-by:** Jens Axboe <[email protected]> (block layer maintainer)
- **Link:**
https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, or Cc: stable tags
- (Ignoring pipeline-added Signed-off-by: Sasha Levin per instructions)
**Step 1.3 — Body analysis**
Record:
- **Bug:** When radix_tree_insert() fails in blkg_create(), two errors occur:
1. blkg->online = true is set even though the blkg was never inserted into the tree.
2. Error path calls blkg_put() without percpu_ref_kill(). While the refcount is still in percpu mode, percpu_ref_put() only decrements a per-CPU counter and never checks for zero, so blkg_release() is never called.
- **Symptom/failure mode:** Permanent leak of blkg memory, percpu iostat, policy data, parent blkg reference, and cgroup css reference — the css leak prevents the cgroup from ever being destroyed.
- **Root cause:** Wrong teardown primitive on the error path; blkg_destroy() correctly uses percpu_ref_kill().
**Step 1.4 — Hidden bug fix?**
Record: No — this is an explicit bug fix, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record:
- **Files:** block/blk-cgroup.c only (+2 / −2 lines, 4 lines touched)
- **Function:** blkg_create()
- **Scope:** Single-file, surgical fix
**Step 2.2 — Code flow change**
Record:
- **Hunk 1:** blkg->online = true moved inside the if (likely(!ret)) success block.
- Before: online set unconditionally after insert attempt.
- After: online only set when insert succeeds.
- **Hunk 2:** Error path changed from blkg_put(blkg) to percpu_ref_kill(&blkg->refcnt).
- Before: percpu-mode put never triggers release callback.
- After: switches to atomic mode and triggers blkg_release() →
`__blkg_release()` → `css_put()` + `blkg_free()`.
**Step 2.3 — Bug mechanism**
Record: **Reference counting / resource leak fix.** Category (a) error- path leak + (g) logic correctness (online flag). The percpu_ref lifecycle requires percpu_ref_kill() before the final drop can trigger the release function — documented in include/linux/percpu-refcount.h lines 19–24.
**Step 2.4 — Fix quality**
Record: Obviously correct — mirrors blkg_destroy() at line 568. Minimal change. Very low regression risk; only affects the rare radix_tree_insert() failure path.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 — Blame**
Record: Buggy lines in this tree all from 5d324e5159d9e (v6.18 merge, Nov 2025). Same pattern present in v6.12 and v6.17 per git show.
**Step 3.2 — Fixes: tag**
Record: Not applicable — no Fixes: tag in commit message.
**Step 3.3 — Related file history**
Record:
- 93383b6681074 — "wait for blkcg cleanup before initializing new disk" — reduces -EEXIST from radix_tree_insert() during disk rebind, but does not fix the broken error path when insert still fails.
- 5e5b7f2ef8549 — UAF fix in __blkcg_rstat_flush() (related subsystem, separate issue).
- Fix commit on master: dbbca20764382 (Jul 15, 2026); **not** an ancestor of current HEAD (merge-base exit 1).
**Step 3.4 — Author context**
Record: Tao Cui; Acked-by Tejun Heo (blk-cgroup/cgroup maintainer). No other Tao Cui commits in this tree's block/blk-cgroup.c history.
**Step 3.5 — Dependencies**
Record: Standalone — no series dependencies, no prerequisite commits required. Self-contained 4-line change.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 — Original discussion**
Record:
- b4 dig -c dbbca20764382:
https://patch.msgid.link/[email protected]
- Series: v4 only (no v1–v3 in b4 results; v4 is the applied version)
- No NAKs found in saved mbox
- No explicit Cc: stable nomination in thread headers
**Step 4.2 — Reviewers**
Record: b4 dig -w CC'd: [email protected], [email protected], [email protected], [email protected], linux- [email protected]. Tejun Heo Acked-by.
**Step 4.3 — Bug report**
Record: No external bug report or syzbot link. Bug identified via code review of percpu_ref lifecycle.
**Step 4.4 — Related patches**
Record: Complementary to 93383b6681074 (reduces trigger frequency) but independently needed for correct error handling.
**Step 4.5 — Stable list**
Record: No [email protected] discussion found for this specific fix.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Key functions**
Record: blkg_create() modified; related: blkg_destroy(), blkg_release(), __blkg_release(), blkg_free().
**Step 5.2 — Callers**
Record: blkg_create() called from:
- blkg_lookup_create() — I/O hot path via blkg_tryget_closest() → bio_assoc_blkcg() (line 2113)
- blkg_conf_prep() — cgroup sysfs configuration (uses radix_tree_preload)
- blkcg_init_disk() — disk initialization (uses radix_tree_preload)
blkg_lookup_create() does **not** call radix_tree_preload(), so -ENOMEM from radix_tree_insert() is reachable under memory pressure.
**Step 5.3 — Callees**
Record: On failure path after fix: percpu_ref_kill() → blkg_release() → __blkcg_rstat_flush() + call_rcu(__blkg_release) → css_put() + blkg_free() → blkg_free_workfn() releases parent ref, policy data, queue ref, percpu iostat.
**Step 5.4 — Reachability**
Record: Reachable from block I/O path when CONFIG_BLK_CGROUP is enabled and a new blkg must be created for a cgroup/disk pair. Userspace cgroup management can also trigger via blkg_conf_prep(). Unprivileged users can trigger via I/O in their cgroup.
**Step 5.5 — Similar patterns**
Record: blkg_destroy() at line 568 already uses percpu_ref_kill(&blkg->refcnt) — fix aligns error path with established pattern. include/linux/percpu-refcount.h documents that percpu_ref_put() does not check for zero before percpu_ref_kill().
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE
**Step 6.1 — Buggy code present?**
Record: **YES.** Current tree at lines 436 and 443:
```436:444:block/blk-cgroup.c
blkg->online = true;
spin_unlock(&blkcg->lock);
if (!ret)
return blkg;
/* @blkg failed fully initialized, use the usual release path */
blkg_put(blkg);
return ERR_PTR(ret);
```Bug present since at least v6.12 in this repository's history.
**Step 6.2 — Backport complications**
Record: Trivial change; git apply --check on upstream patch fails only because stable has err_put_css: label that mainline parent lacks (context line difference below the hunk). The three actual changed lines apply without modification. Expected difficulty: **minor context adjustment, not rework**.
**Step 6.3 — Related fixes already present?**
Record: 93383b6681074 is present (reduces -EEXIST trigger). This specific leak fix is **not** present.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1 — Subsystem**
Record: **block/blk-cgroup** — CORE/IMPORTANT subsystem. Affects all systems using cgroup v1/v2 block controller (CONFIG_BLK_CGROUP).
**Step 7.2 — Activity**
Record: Active maintenance in 6.18.y — recent fixes include UAF (5e5b7f2ef8549), disk reference leak (b3e005f16cd98), blkcg cleanup wait (93383b6681074).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 — Who is affected**
Record: Systems with CONFIG_BLK_CGROUP enabled — container hosts (Kubernetes, Docker, systemd cgroups), cloud VMs, any workload using block I/O cgroup controller.
**Step 8.2 — Trigger conditions**
Record:
- radix_tree_insert() returns error (-ENOMEM most likely in blkg_lookup_create() without preload; -EEXIST possible in races despite 93383b6681074)
- Requires blkg creation for a new cgroup/disk pair
- Unprivileged cgroup users can trigger via I/O; cgroup admin via sysfs
- Not every boot — requires memory pressure or specific race — but consequences are permanent
**Step 8.3 — Failure mode severity**
Record:
- **Permanent memory/resource leak** (blkg, iostat, policy data)
- **Cgroup css reference leak → cgroup cannot be destroyed** — functional breakage for container lifecycle
- **Incorrect online flag** — minor (e.g., blkcg_print_one_stat() at line 1190 may process a non-inserted blkg)
- Severity: **HIGH** (resource leak with cgroup destruction blocked; not a crash but serious operational impact)
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** HIGH — prevents unrecoverable resource leaks and stuck cgroups
- **Risk:** VERY LOW — 4-line change, matches existing blkg_destroy() pattern, only affects error path
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 — Evidence summary**
**FOR:**
- Real, verifiable resource leak on error path
- Cgroup css leak prevents cgroup destruction — serious for production container workloads
- Small, surgical, maintainer-acked fix
- Buggy code confirmed present in v6.18.44
- Matches documented percpu_ref semantics and existing blkg_destroy() pattern
- Reachable from common I/O and cgroup configuration paths
**AGAINST:**
- Rare trigger (radix_tree_insert failure)
- No syzbot/user crash report
- Upstream patch needs trivial context adjustment for err_put_css: label
**UNRESOLVED:**
- No quantitative data on how often radix_tree_insert() fails in production
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — mechanism verified against percpu-refcount.h and blkg_destroy(); Acked-by cgroup maintainer
2. Fixes real bug affecting users? **PASS** — permanent leak + cgroup destruction blocked
3. Important issue? **PASS** — HIGH severity resource leak affecting cgroup lifecycle
4. Small and contained? **PASS** — 4 lines, one function, one file
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — trivial manual apply (minor context difference only)
**Step 9.3 — Exception categories**
Record: Not applicable (standard bug fix, not device ID/quirk/build/doc exception).
**Step 9.4 — Decision rationale**
This commit fixes a genuine error-path bug in blkg_create() where failed radix_tree_insert() leaves resources permanently leaked because blkg_put() cannot trigger blkg_release() while the percpu refcount is still in percpu mode. The css reference leak prevents cgroup destruction — a significant operational issue for any system using block cgroups. The fix is minimal, follows the established blkg_destroy() pattern, is acked by the cgroup maintainer, and the buggy code is present in this v6.18.44 tree without the fix.
---
## Verification
- [Phase 1] git show dbbca20764382: parsed subject, tags, body; Acked- by Tejun Heo confirmed
- [Phase 2] Read block/blk-cgroup.c lines 371–452, 524–569, 1190; read include/linux/percpu-refcount.h lines 19–24, 147–150, 326–352
- [Phase 2] Confirmed blkg_put() → percpu_ref_put() in block/blk- cgroup.h line 336–338
- [Phase 3] git describe HEAD: v6.18.44; git blame -L 419,452: buggy code from 5d324e5159d9e
- [Phase 3] git merge-base --is-ancestor dbbca20764382 HEAD: exit 1 — fix NOT in tree
- [Phase 3] git show v6.12/v6.17:v6.18:block/blk-cgroup.c: same buggy pattern back to v6.12
- [Phase 3] 93383b6681074 present in tree; complementary, not substitute
- [Phase 4] b4 dig -c dbbca20764382: lore URL found; v4 series
- [Phase 4] b4 dig -w: maintainers CC'd; Tejun Heo Acked-by
- [Phase 4] b4 dig -m /tmp/blkcg_fix.mbox: no Cc: stable in thread
- [Phase 5] Grep callers: blkg_create at lines 510, 936, 1526; blkg_lookup_create at 2113
- [Phase 5] Confirmed blkg_lookup_create does not use radix_tree_preload (only blkg_conf_prep and blkcg_init_disk do)
- [Phase 6] Buggy code at lines 436, 443 confirmed in working tree
- [Phase 6] git apply --check fails on context below hunk (err_put_css: vs err_free_blkg:); actual 3 changed lines are identical — trivial backport
- [Phase 8] Failure mode: permanent leak + cgroup destruction blocked; severity HIGH
**YES**
block/blk-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-cgroup.c +2 -2
@@ -432,15 +432,15 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, struct gendisk *disk, blkg->pd[i]->online = true; } } + blkg->online = true; } - blkg->online = true;spin_unlock (&blkcg->lock);if (!ret)return blkg;/* @blkg failed fully initialized, use the usual release path */ -blkg_put (blkg); +percpu_ref_kill (&blkg->refcnt);return ERR_PTR (ret); err_put_css:
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/nouveau/gsp: add SEC2 to GA100 chip table
In reply to Sasha LevinFrom: Timur Tabi <[email protected]>
[ Upstream commit 604d0efb17cc0dd197e089134736ac2698d5fca7 ]
The booter-load and booter-unload firmware run on the SEC2 falcon. During tu102_gsp_oneinit(), the booter constructor needs device->sec2 to access the SEC2 falcon.
Without the .sec2 entry, device->sec2 is NULL and this dereference crashes during GSP-RM boot.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/nouveau/gsp: add SEC2 to GA100 chip table
**Local tree:** v6.18.44 (stable/linux-6.18.y)
**Commit under review:** 604d0efb17cc0 (on origin/master, not yet in this tree)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [drm/nouveau/gsp] [add] — Add missing SEC2 engine entry to the GA100 (nv170) chipset table so GSP-RM boot can access the SEC2 falcon.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Timur Tabi <[email protected]> (author)
- **Signed-off-by:** Danilo Krummrich <[email protected]> (DRM maintainer committer)
- **Link:**
https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by:, Cc: [email protected], or Tested- by:
Notable: part of **PATCH v2 02/10** in series “drm/nouveau: fix GA100 issues”. Absence of stable tag is expected for manual review.
### Step 1.3: Body analysis
**Record:**
- **Bug:** device->sec2 is NULL on GA100 because nv170_chipset lacks a .sec2 entry.
- **Symptom:** NULL pointer dereference during GSP-RM boot in tu102_gsp_oneinit().
- **Mechanism:** Booter-load/unload firmware runs on the SEC2 falcon; booter constructor needs device->sec2->falcon.
- **Root cause:** Oversight when GSP was wired into the GA100 chip table without the matching SEC2 entry.
### Step 1.4: Hidden bug fix?
**Record:** No — this is an explicit crash fix (NULL deref), not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** drivers/gpu/drm/nouveau/nvkm/engine/device/base.c (+1 line)
- **Function/structure:** nv170_chipset static chip table
- **Scope:** Single-file, surgical one-liner
### Step 2.2: Code flow change
**Record:**
- **Before:** GA100 chip table has .gsp = ga100_gsp_new but no .sec2; device->sec2 stays NULL after device construction.
- **After:** .sec2 = { 0x00000001, tu102_sec2_new } is added; SEC2 is instantiated like other Turing/Ampere GSP-RM platforms.
- **Path affected:** Device probe → subdev construction → GSP oneinit → booter constructor.
### Step 2.3: Bug mechanism
**Record:** **Category:** NULL pointer dereference **Mechanism:** tu102_gsp_oneinit() unconditionally dereferences device->sec2->falcon:
```307:313:drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c
ret = gsp->func->booter.ctor(gsp, "booter-load",
gsp->fws.booter.load,
&device->sec2->falcon,
&gsp->booter.load);
if (ret)
return ret;
ret = gsp->func->booter.ctor(gsp, "booter-unload",
gsp->fws.booter.unload,
&device->sec2->falcon,
&gsp->booter.unload);
```ga100_gsp uses this same oneinit handler:
```53:54:drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c
.dtor = r535_gsp_dtor,
.oneinit = tu102_gsp_oneinit,
```### Step 2.4: Fix quality
**Record:** Obviously correct — mirrors every other GSP-RM-capable Turing chipset (e.g. nv164_chipset at line 2508 uses tu102_sec2_new). Minimal risk; no API or behavioral change beyond enabling a subdev that was always required.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- nv170_chipset introduced in 3b050680c8415 (Jan 2021, “recognise GA10[024]”).
- .gsp = ga100_gsp_new added in 015ef6187f69e (Sep 2023, “prepare for GSP-RM”) — **this is when the bug was introduced**.
- .sec2 never added to nv170_chipset until 604d0efb17cc0.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag. Bug introduced by 015ef6187f69e, which is present in this stable tree.
### Step 3.3: Related file history
**Record:** Related GA100 work on master (not in 6.18.44):20e0c197802c5 (add GA100 GSP support), 0094a7a95d52b (WPR placement), f0de0f89cc1e0 (require GSP-RM), 61de054a772a1 (formally support GA100). This SEC2 commit is patch 2/10 of v2 series but is **standalone** for the NULL-deref it fixes.
### Step 3.4: Author context
**Record:** Timur Tabi (NVIDIA) authored the GA100 fix series. Reviewed on list by Lyude Paul (nouveau maintainer). Committed by Danilo Krummrich (DRM maintainer).
### Step 3.5: Dependencies
**Record:** No hard dependencies. tu102_sec2_new exists in this tree since 8d2c1e337604f (2019). Patch applies cleanly (git apply --check passes). Self-contained.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig -c 604d0efb17cc0 found thread: [PATCH v2 02/10] at
https://patch.msgid.link/[email protected].
Series: v1 (6 patches, Apr 7) → v2 (10 patches, Apr 30).
### Step 4.2: Reviewers
**Record:** b4 dig -w — CC'd: Lyude Paul, Danilo Krummrich, David Airlie, [email protected]. **Reviewed-by: Lyude Paul** found in mbox for the series.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link. Bug identified by code analysis during GA100 bring-up.
### Step 4.4: Related patches
**Record:** Part of “fix GA100 issues” series. Other patches improve WPR placement, FRTS handling, and formal GA100 enablement. This commit fixes a crash independent of those follow-ups.
### Step 4.5: Stable list discussion
**Record:** No explicit Cc: stable nomination found in saved mbox. Not a negative signal.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** nv170_chipset (chip table), tu102_sec2_new, tu102_gsp_oneinit, ga100_gsp_new.
### Step 5.2: Callers
**Record:** Chip table entries drive NVKM_LAYOUT_ONCE macros in nvkm_device_ctor() (base.c ~3412). tu102_gsp_oneinit called via nvkm_gsp_oneinit during nvkm_device_init() subdev init loop.
### Step 5.3: Callees
**Record:** tu102_sec2_new → r535_sec2_new when GSP-RM is active (nvkm_gsp_rm(device->gsp)). Booter constructor uses SEC2 falcon registers.
### Step 5.4: Reachability
**Record:** Triggered on GA100 probe when:
1. NvEnableUnsupportedChipsets=1 (required in 6.18.44 — case 0x170 only in unsupported path at line 3362–3364)
2. GSP-RM firmware loads (default NvGspRm=true in tu102_gsp_load_rm)
Driver load / module init path — reachable by root loading nouveau on A100 hardware.
### Step 5.5: Similar patterns
**Record:** All TU10x chipsets (nv164–nv168) and GA102+ have .sec2 entries. GA100 is the sole GSP-enabled chipset missing it.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (6.18.44)
### Step 6.1: Buggy code present?
**Record:** **YES.** nv170_chipset at lines 2512–2532 has .gsp but no .sec2. Commit 604d0efb17cc0 is on master but not in v6.18.44.
### Step 6.2: Backport complications
**Record:** **Clean apply** — verified with git apply --check. No conflicts expected.
### Step 6.3: Related fixes already present?
**Record:** No alternate fix for this issue in 6.18.44. Grep shows no .sec2 in nv170_chipset.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/gpu/drm/nouveau — **IMPORTANT** (GPU driver, affects GA100/A100 users).
### Step 7.2: Activity
**Record:** GSP subsystem actively maintained; multiple GSP fixes in 6.18.y history.
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** GA100 (NVIDIA A100) users running nouveau with GSP-RM. Narrow hardware population but high-value datacenter GPUs. In 6.18.44, requires NvEnableUnsupportedChipsets=1.
### Step 8.2: Trigger conditions
**Record:** GA100 hardware + nouveau module load + GSP-RM path. GSP-RM is default-on (nvkm_boolopt(..., "NvGspRm", true)). Trigger is deterministic on affected config, not a race.
### Step 8.3: Failure mode severity
**Record:** **CRITICAL** — kernel oops / NULL pointer dereference during driver initialization. GPU completely non-functional; potential system instability.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for GA100 users — prevents guaranteed crash on GSP- RM boot
- **Risk:** VERY LOW — one line, matches established pattern, no new APIs
- **Ratio:** Strongly favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real, reproducible NULL pointer dereference
- Kernel crash on driver init (CRITICAL severity)
- One-line, obviously correct fix
- Bug introduced in-tree by 015ef6187f69e (Sep 2023) and present since
- Applies cleanly to 6.18.44
- Reviewed by nouveau maintainer (Lyude Paul)
- Matches how all sibling GSP-RM chipsets are configured
**AGAINST backport:**
- GA100 still requires NvEnableUnsupportedChipsets in 6.18.44 (limited exposure)
- Full GA100 support series not yet in stable (other patches may also be needed for complete GA100 functionality, but not for this specific crash fix)
**Unresolved:** No user crash reports or syzbot reproduction found (bug found during development).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — mirrors TU10x pattern; reviewed on list
2. Fixes a real bug? **PASS** — NULL deref with clear code path
3. Important issue? **PASS** — kernel oops on GPU probe/init
4. Small and contained? **PASS** — 1 line, 1 file
5. No new features/APIs? **PASS** — enables existing subdev constructor already used elsewhere
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception categories
**Record:** Hardware enablement fix for existing driver — analogous to missing chip-table entry quirk. Not a new driver.
### Step 9.4: Decision rationale
When GSP-RM support was added to the GA100 chip table in September 2023, the matching SEC2 entry was omitted. Because ga100_gsp uses tu102_gsp_oneinit(), which unconditionally accesses device->sec2->falcon, any attempt to boot GSP-RM on GA100 in this tree crashes. The fix is a single missing table entry — the same tu102_sec2_new used by all Turing GSP-RM platforms — and it applies cleanly to v6.18.44.
Even though GA100 remains behind NvEnableUnsupportedChipsets in this stable release, users who enable it for A100 testing will hit this crash deterministically. The fix is minimal, low-risk, and prevents a serious initialization failure.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified NULL-deref crash during GSP-RM boot
- [Phase 2] Read diff (+1 line to nv170_chipset); traced tu102_gsp_oneinit() NULL deref at lines 307–313
- [Phase 3] git describe HEAD → v6.18.44; git blame → GSP added to GA100 in 015ef6187f69e, sec2 never added
- [Phase 3] git show 015ef6187f69e confirmed GSP added without SEC2; bug commit is in this tree
- [Phase 3] git log v6.18.44..origin/master → commit 604d0efb17cc0 on master, not in stable
- [Phase 4] b4 dig -c 604d0efb17cc0 → lore URL found; v2 02/10 of 10-patch series
- [Phase 4] b4 dig -a → v1 and v2 series revisions listed
- [Phase 4] b4 dig -w → Lyude Paul, Danilo Krummrich, Airlie CC'd
- [Phase 4] mbox grep → Reviewed-by: Lyude Paul; no stable nomination
- [Phase 5] Confirmed ga100_gsp.oneinit = tu102_gsp_oneinit in ga100.c
- [Phase 5] Confirmed tu102_sec2_new exists and handles GSP-RM via r535_sec2_new
- [Phase 5] Confirmed GA100 only enabled with NvEnableUnsupportedChipsets at base.c:3362
- [Phase 6] Confirmed nv170_chipset lacks .sec2 in current tree (lines 2512–2532)
- [Phase 6] git apply --check on commit patch → applies cleanly
- [Phase 8] Failure mode: NULL deref → kernel oops, severity CRITICAL
**YES****Verdict: YES** — backport to this tree (v6.18.44).
The background checks confirmed 604d0efb17cc0 ("add SEC2 to GA100 chip table") is on origin/master but not in stable/linux-6.18.y. In the current tree, nv170_chipset has GSP support but no .sec2 entry, so tu102_gsp_oneinit() will NULL-deref device->sec2 during GSP-RM boot on GA100.
The fix is a one-line addition (.sec2 = { 0x00000001, tu102_sec2_new }) that matches other Turing GSP-RM chipsets and applies cleanly.
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2529,6 +2529,7 @@ nv170_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .ce = { 0x000003ff, ga100_ce_new }, .fifo = { 0x00000001, ga100_fifo_new }, + .sec2 = { 0x00000001, tu102_sec2_new }, }; static const struct nvkm_device_chip
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ice: pass the return value of skb_checksum_help()
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit 2d19302f628853742c4828381abbd668c1315598 ]
skb_checksum_help() can fail. Pass its return value back to the caller.
Commonize this software path in goto.
Instead of just returning error try calculating software checksum first. There is a check for TSO in checksum_sw_fb.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [ice] [pass] — propagate skb_checksum_help() return value in ice_tx_csum().
**Step 1.2 — Tags**
Record:
- Reviewed-by: Aleksandr Loktionov (Intel)
- Tested-by: Rinitha S (Intel)
- Signed-off-by: Michal Swiatkowski, Tony Nguyen, Jakub Kicinski
- Link: https://patch.msgid.link/20260717185340.3595286-4-
[email protected]
- No Fixes:, Reported-by:, Cc: [email protected], or Acked- by: on this specific patch
- Part of [PATCH net 03/13] series (not a multi-part dependency for this hunk)
**Step 1.3 — Body analysis**
Record:
- **Bug:** skb_checksum_help() can fail, but ice_tx_csum() ignored its return value and returned 0.
- **Symptom:** On software-checksum fallback failure, the TX path continues as if checksum handling succeeded; the skb may remain CHECKSUM_PARTIAL and be transmitted without a valid checksum.
- **Root cause:** Error paths called skb_checksum_help(skb); return 0; instead of propagating the error.
- **Additional intent:** Consolidate fallback paths under checksum_sw_fb; for some paths that previously returned -1, try software checksum first (unless TSO).
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Although framed as error propagation/cleanup, this fixes a real TX correctness bug: continuing transmission after skb_checksum_help() failure.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** drivers/net/ethernet/intel/ice/ice_txrx.c (+9 / -11)
- **Function:** ice_tx_csum()
- **Scope:** Single-file, single-function surgical change
**Step 2.2 — Code flow changes**
Record per hunk:
1. **Encapsulated IPv6 ipv6_skip_exthdr() failure:** return -1 → goto checksum_sw_fb (try SW checksum before drop, unless TSO).
2. **Unknown outer transport (default):** inline skb_checksum_help(); return 0 → goto checksum_sw_fb.
3. **Neither IPv4 nor IPv6 inner header:** return -1 → goto checksum_sw_fb.
4. **Unknown inner L4 protocol (default):** inline skb_checksum_help(); return 0 → goto checksum_sw_fb.
5. **New label checksum_sw_fb:** TSO still returns -1; otherwise return skb_checksum_help(skb).
**Step 2.3 — Bug mechanism**
Record: **Error-path / logic correctness fix.** skb_checksum_help() returns 0 on success or negative on failure (-EINVAL, -EFAULT, -ENOMEM, etc., per net/core/dev.c). Old code always returned 0 after calling it. Caller ice_xmit_frame_ring() only drops on csum < 0, so failures were treated as success.
**Step 2.4 — Fix quality**
Record: **Obviously correct and minimal.** Matches the pattern used in fm10k (checks skb_checksum_help() return). Low regression risk; TSO paths still fail hard. Minor behavioral broadening on paths that previously dropped immediately now attempt software checksum first.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Buggy skb_checksum_help(); return 0 lines blame to 5d324e5159d9e (merge artifact; ice_txrx.c content is present throughout this 6.18.y tree). The ignored-return pattern exists in current HEAD.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag present.
**Step 3.3 — Related file history**
Record: Recent ice_txrx.c changes in this tree include double-free fix, jumbo_remove revert, etc. No duplicate fix for this issue. Commit 2d19302f6288 is **not** in HEAD.
**Step 3.4 — Author context**
Record: Intel wired-LAN team (Michal Swiatkowski, Tony Nguyen). Reviewed/tested internally. netdev maintainers (Davem, Kuba, netdev list) were CC'd per b4 dig -w.
**Step 3.5 — Dependencies**
Record: **Standalone.** Only touches ice_tx_csum() in ice_txrx.c. Patch is 03/13 of a larger pull request, but this hunk has no structural dependency on other series patches. git apply --check succeeds cleanly on this tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- b4 dig -c 2d19302f6288: https://patch.msgid.link/20260717185340.3595
[email protected]
- Earlier v2 series: [PATCH iwl-next v2 0/4] from May 2026
- Applied version is the July 2026 netdev 03/13 submission
**Step 4.2 — Reviewers**
Record: netdev maintainers CC'd (davem, kuba, pabeni, edumazet, andrew+netdev). Intel reviewers on patch.
**Step 4.3 — Bug reports**
Record: No syzbot/user bug report. Issue identified by code review / driver maintainers.
**Step 4.4 — Series context**
Record: Part of 13-patch Intel wired-LAN pull. Sibling patches (PTP crash, ptype bounds, etc.) explicitly carry `Cc:
[email protected]`; **this patch does not**, which is a mild negative signal but not decisive per review instructions.
**Step 4.5 — Stable list**
Record: No stable-list discussion found specifically for this patch. Other patches in the same series were stable-nominated.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: ice_tx_csum() (modified), checksum_sw_fb (new label).
**Step 5.2 — Callers**
Record: ice_xmit_frame_ring() at line 2648:
```c
csum = ice_tx_csum(first, &offload);
if (csum < 0)
goto out_drop;
```Called from ice_start_xmit() → standard netdev TX hot path (userspace/network stack packet transmission).
**Step 5.3 — Callees**
Record: ipv6_skip_exthdr(), skb_checksum_help() (can allocate/linearize skb, validate offsets).
**Step 5.4 — Reachability**
Record: **Userspace-reachable** via normal packet transmission on Intel E810/ice NICs with CHECKSUM_PARTIAL skbs that cannot use hardware offload (unusual L4, encapsulation edge cases, memory pressure during linearization).
**Step 5.5 — Similar patterns**
Record: Same ignored-return pattern exists in sibling Intel drivers (i40e, iavf, idpf, ixgbe, etc.). fm10k correctly checks the return value. This fix addresses ice only.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is v6.18.44 (linux-6.18.y). ice_tx_csum() at lines 2106-2107 and 2221-2222 has the buggy pattern. Fix commit 2d19302f6288 is **not** merged.
**Step 6.2 — Backport complications**
Record: **Clean apply** — git apply --check on 2d19302f6288 passes with no conflicts.
**Step 6.3 — Related fixes already present?**
Record: **No** equivalent fix in this tree.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: drivers/net/ethernet/intel/ice — **IMPORTANT** (widely deployed datacenter 10/25/100GbE driver).
**Step 7.2 — Activity**
Record: Actively maintained; multiple ice fixes already in 6.18.y (PTP, ptype, memory leaks, etc.).
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Systems using Intel ice NICs (CONFIG_ICE) transmitting CHECKSUM_PARTIAL packets that hit software-checksum fallback paths.
**Step 8.2 — Trigger conditions**
Record:
- Unusual/unsupported L4 in encapsulated packets
- ipv6_skip_exthdr() parse failures
- skb_checksum_help() failures: bad offsets (-EINVAL), unreadable frags (-EFAULT), OOM during linearize (-ENOMEM)
- **Frequency:** Uncommon edge cases, not every packet
- **Unprivileged trigger:** Yes, via normal network traffic patterns
**Step 8.3 — Failure mode severity**
Record: **MEDIUM-HIGH** — not a kernel oops/panic, but transmits packets with invalid/missing checksums when software checksum computation fails (outbound data integrity corruption). Caller should drop; old code did not.
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** Correct error handling on common TX path; prevents corrupt outbound packets on failure
- **Risk:** Very low — 20-line change, Intel-reviewed/tested, applies cleanly
- **Ratio:** Favorable for backport
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Real, verifiable bug (ignored error return)
- Affects standard TX path on widely used driver
- Small, self-contained, applies cleanly to 6.18.44
- Reviewed and tested by Intel; merged to netdev
- Caller already handles negative returns correctly (out_drop)
- Prevents transmitting CHECKSUM_PARTIAL skbs after checksum setup failed
**Evidence AGAINST:**
- No crash/oops/security report; impact is network correctness on rare paths
- Not explicitly Cc: stable (unlike several sibling patches in same series)
- Slight behavior change: some previously-dropped paths now attempt software checksum first
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** (Intel Reviewed-by/Tested-by; logic is straightforward)
2. Fixes a real bug? **PASS**
3. Important issue? **PASS** (outbound packet integrity corruption on error paths)
4. Small and contained? **PASS** (1 file, ~20 lines)
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** (verified clean apply)
**Exception category:** N/A (not device ID/quirk/build/doc fix).
---
## Problem Summary for Stable Users
On Intel ice NICs in this 6.18.y tree, when hardware checksum offload cannot handle a CHECKSUM_PARTIAL packet and the driver falls back to skb_checksum_help(), a failure in that function is silently ignored. The driver returns success, and the packet may be transmitted without a valid checksum. The fix propagates the error so ice_xmit_frame_ring() drops the skb instead of sending a corrupt packet. This is a low-risk, high-correctness fix appropriate for stable.
## Verification
- [Phase 1] Parsed commit message and tags from provided diff + git show 2d19302f6288
- [Phase 2] Read current ice_tx_csum() and skb_checksum_help() in tree
- [Phase 3] git describe HEAD → v6.18.44; git blame on lines 2102-2107, 2218-2222
- [Phase 3] git merge-base check: fix NOT in HEAD
- [Phase 3] git apply --check on 2d19302f6288 → clean
- [Phase 4] b4 dig -c 2d19302f6288 → lore URL found
- [Phase 4] b4 dig -a → v2 iwl-next series + v1 net 01/13 series
- [Phase 4] b4 dig -w → netdev maintainers CC'd
- [Phase 4] Saved mbox; confirmed patch 03/13 lacks explicit `Cc:
stable`
- [Phase 5] Traced caller ice_xmit_frame_ring() lines 2648-2650
- [Phase 5] Read skb_checksum_help() return paths in net/core/dev.c:3555-3606
- [Phase 5] Compared with fm10k_main.c:810 (checks return value)
- [Phase 6] Confirmed buggy code at ice_txrx.c:2106-2107, 2221-2222
- [Phase 8] Assessed failure mode as outbound packet corruption, not kernel crash
**YES**The analysis is complete for commit 2d19302f6288 (ice: pass the return value of skb_checksum_help()) against the local **v6.18.44** (linux-6.18.y) tree.
**Verdict: YES** — backport it.
**Why:** In ice_tx_csum(), skb_checksum_help() failures were ignored and the function returned 0, so ice_xmit_frame_ring() could transmit CHECKSUM_PARTIAL packets without a valid checksum. The fix is small (one function in ice_txrx.c), applies cleanly here, and is reviewed/tested by Intel.
**Local state:** The buggy code is still present; the fix is not in this tree yet.
drivers/net/ethernet/intel/ice/ice_txrx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +9 -11
@@ -2081,7 +2081,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ret =ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off);if (ret <0 ) -return -1 ; + goto checksum_sw_fb; }/* define outer transport */
@@ -2100,11 +2100,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) l4.hdr =skb_inner_network_header (skb);break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; - -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; }/* compute outer L3 header size */
@@ -2163,7 +2159,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off); }else { -return -1 ; + goto checksum_sw_fb; }/* compute inner L3 header size */
@@ -2216,15 +2212,17 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; } off->td_cmd |= cmd; off->td_offset |= offset;return 1 ; + +checksum_sw_fb: +if (first->tx_flags &ICE_TX_FLAGS_TSO ) +return -1 ; +return skb_checksum_help (skb); }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 perf/ftrace: Fix WARNING in __unregister_ftrace_function
In reply to Sasha LevinFrom: Rik van Riel <[email protected]>
[ Upstream commit 9581123304b23049437324038698af9fb56ee663 ]
perf_ftrace_function_unregister() unconditionally calls unregister_ftrace_function() without checking whether the ftrace_ops was ever successfully registered. This triggers a WARN_ON in __unregister_ftrace_function() when the ops doesn't have FTRACE_OPS_FL_ENABLED set.
This can happen during perf_event_alloc() error cleanup when perf_trace_destroy() is called via __free_event() on an event whose ftrace_ops registration failed or was already torn down by perf_try_init_event()'s err_destroy path.
The call path is:
perf_event_alloc() error cleanup
-> __free_event()
-> event->destroy() [tp_perf_event_destroy]
-> perf_trace_destroy()
-> perf_trace_event_close()
-> TRACE_REG_PERF_CLOSE
-> perf_ftrace_function_unregister()
-> unregister_ftrace_function()
-> __unregister_ftrace_function()
-> WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED))Fix this by checking FTRACE_OPS_FL_ENABLED before attempting to unregister. If the ops is not enabled, just free the filter and return success.
---
LLM Generated explanations, may be completely bogus:
The follow-up check confirms the fix (9581123304b23) is on master — it's the only commit adding the FTRACE_OPS_FL_ENABLED guard in perf_ftrace_function_unregister(). It's not in **6.18.44**, so the backport recommendation remains **YES**.
kernel/trace/trace_event_perf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/trace/trace_event_perf.c +11 -1
@@ -497,7 +497,17 @@ static int perf_ftrace_function_register(struct perf_event *event)static int perf_ftrace_function_unregister (struct perf_event *event) {struct ftrace_ops *ops = &event->ftrace_ops; -int ret =unregister_ftrace_function (ops); +int ret =0 ; + +/* +* Perf will call this unconditionally even if the ops is not +* enabled. The unregister_ftrace_function() will warn if called +* when not enabled. Just bypass the unregistering if ops isn't +* enabled here. +*/ +if (ops->flags &FTRACE_OPS_FL_ENABLED ) + ret =unregister_ftrace_function (ops); +ftrace_free_filter (ops);return ret; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ASoC: codecs: rk3328: Use managed GPIO and clock helpers
In reply to Sasha LevinFrom: Cássio Gabriel <[email protected]>
[ Upstream commit 0cf3489bba9ad13aae052232e223e19a620fe7a7 ]
rk3328_platform_probe() acquires the mute GPIO with gpiod_get_optional() but never releases it. It also enables mclk and pclk manually while relying on probe error labels for unwind, and the driver has no platform remove callback to disable those clocks after a successful unbind.
This path has already needed fixes for missing clock unwinds on probe errors. Use devm_gpiod_get_optional() and devm_clk_get_enabled() so the GPIO and enabled clock lifetimes are tied to the device. This removes the manual error labels and makes both probe failure and driver unbind follow the normal devres cleanup path.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [ASoC: codecs: rk3328] [Use] — Convert probe resource acquisition to managed (devm) helpers for GPIO and clocks.
### Step 1.2: Commit Message Tags
**Record:**
- **Signed-off-by:** Cássio Gabriel <[email protected]> (author)
- **Signed-off-by:** Mark Brown <[email protected]> (ASoC maintainer committer)
- **Link:** https://patch.msgid.link/20260525-asoc-rk3328-devm-
[email protected]
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
[email protected]
- Notable: Maintainer commit; no fuzzer or user bug reports
### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** rk3328_platform_probe() uses gpiod_get_optional() without ever releasing the mute GPIO; enables mclk/pclk manually with fragile error-path unwinds; no platform .remove to disable clocks on unbind.
- **Symptom:** Resource leaks — GPIO descriptor leak; clocks left enabled after driver unbind; incomplete probe-error cleanup (driver already needed two prior clock-unwind fixes).
- **Root cause:** Non-devm resource management with manual goto unwind labels and no platform remove callback.
- **Version info:** None in message.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Yes — described as devm conversion, but it fixes real resource leaks on probe failure and driver unbind. Prior commits d14eece945a80 (2021) and 35a9b000b24d5 (2022) fixed related clock- unwind gaps in the same function.
---
## Phase 2: Diff Analysis
### Step 2.1: Change Inventory
**Record:**
- **File:** sound/soc/codecs/rk3328_codec.c — 13 insertions, 41 deletions (net −28 lines)
- **Function modified:** rk3328_platform_probe()
- **Scope:** Single-file surgical fix in one probe function
### Step 2.2: Code Flow Changes
**Record:**
| Hunk | Before → After | |------|----------------| | GPIO | `gpiod_get_optional()` → `devm_gpiod_get_optional()` — GPIO tied to device lifetime | | mclk | `devm_clk_get()` + `clk_prepare_enable()` → `devm_clk_get_enabled()` — single managed acquire+enable | | pclk | `devm_clk_get()` + `clk_prepare_enable()` + manual error labels → `devm_clk_get_enabled()` | | Error paths | Manual `err_unprepare_pclk` / `err_unprepare_mclk` labels → early `return` (devres auto-cleanup) | | Success path | `return 0` after register → direct `return devm_snd_soc_register_component(...)` |
### Step 2.3: Bug Mechanism
**Record:** **Category:** Resource leaks (GPIO + clocks)
- **GPIO leak:** gpiod_get_optional() at line 451 with no gpiod_put() anywhere in file; all error returns after GPIO acquisition leak the descriptor.
- **Clock leak on unbind:** platform_driver has only .probe, no .remove; clocks enabled via clk_prepare_enable() are never disabled on unbind.
- **Remaining probe-error gap:** clk_prepare_enable(mclk) failure at lines 468–470 returns directly with no GPIO cleanup and no clock cleanup — not covered by existing err_unprepare_* labels.
- **Fix mechanism:** devm helpers release GPIO/clocks automatically on probe failure and device unbind.
### Step 2.4: Fix Quality
**Record:** Obviously correct — standard kernel devm pattern used widely in ASoC codec drivers (90+ files in tree use devm_clk_get_enabled/devm_gpiod_get_optional). Minimal, removes error-prone manual unwind. **Regression risk:** Very low; behavior unchanged on successful probe.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame / Bug Introduction
**Record:**
- GPIO mute code: 87d12d5545fa7 (2020-02-19) — gpiod_get_optional() without devm
- Clock manual enable: c32759035ad24 (2018-12-21) — original driver
- Manual error labels: d14eece945a80 (2021-05-18) — added after missing unwind was found
- **Buggy code present since v5.0 era; long-standing in this tree**
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related File History
**Record:**
``` d14eece945a80 ASoC: rk3328: fix missing clk_disable_unprepare() on error 35a9b000b24d5 ASoC: rk3328: fix disabling mclk on pclk probe failure ```
Both prior fixes are in this tree. This commit completes the devm conversion those fixes were working toward. Standalone single patch (v1 only, no series).
### Step 3.4: Author Context
**Record:** Cássio Gabriel — active ASoC contributor with similar resource-lifetime fixes (e.g., mediatek mt8183/mt8192 cleanup commits). Mark Brown committed and maintains ASoC.
### Step 3.5: Dependencies
**Record:**
- Requires devm_clk_get_enabled() — in tree since 7ef9651e9792b (2022-06-15), confirmed ancestor of HEAD
- Requires devm_gpiod_get_optional() — present in include/linux/gpio/consumer.h
- **Can apply standalone; no prerequisite commits needed**
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Discussion
**Record:**
- **b4 dig URL:** https://patch.msgid.link/20260525-asoc-rk3328-devm-
[email protected]
- **Series:** v1 only (no revisions)
- **Review feedback:** Thread contains only the patch submission — no replies, no stable nomination, no NAKs
- lore.kernel.org web UI blocked by bot protection; used b4 mbox instead
### Step 4.2: Reviewers
**Record:** CC'd: Mark Brown, Liam Girdwood, Takashi Iwai, Jaroslav Kysela, [email protected]. Committed by Mark Brown (maintainer). No explicit Reviewed-by in commit.
### Step 4.3: Bug Reports
**Record:** N/A — no Reported-by or external bug links.
### Step 4.4: Related Patches
**Record:** Standalone 1/1 patch. Related prior in-tree fixes:d14eece945a80, 35a9b000b24d5.
### Step 4.5: Stable List History
**Record:** UNVERIFIED — could not search lore stable archive (bot protection). No stable discussion found in saved mbox thread.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** rk3328_platform_probe() — only function modified.
### Step 5.2: Callers
**Record:** Called by platform core during device enumeration for rockchip,rk3328-codec OF nodes. Affects RK3328 boards (Rock64, NanoPi R2S/R2C, Orange Pi R1 Plus, etc.) at boot when CONFIG_SND_SOC_ROCKCHIP / codec is enabled.
### Step 5.3: Callees
**Record:** devm_kzalloc, syscon_regmap_lookup_by_phandle, devm_gpiod_get_optional, devm_clk_get_enabled, devm_platform_ioremap_resource, devm_regmap_init_mmio, devm_snd_soc_register_component.
### Step 5.4: Reachability
**Record:** Probe runs at boot on affected hardware. Module unload (module_platform_driver) can trigger unbind — the leaky path without .remove. Probe-failure paths reachable with misconfigured clocks/GPIO.
### Step 5.5: Similar Patterns
**Record:** 90+ ASoC codec files already use devm_clk_get_enabled/devm_gpiod_get_optional. rk3328 was an outlier still using manual management.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy Code in Tree?
**Record:** **YES.** Local tree is **Linux 6.18.44** (git describe HEAD → v6.18.44-1-gef4bf62bccf3c). Buggy code confirmed at lines 451–514 of sound/soc/codecs/rk3328_codec.c. Fix commit 0cf3489bba9ad is on master but **not** in HEAD.
### Step 6.2: Backport Complications
**Record:** **Clean apply** — git format-patch -1 0cf3489bba9ad | git apply --check succeeded with no conflicts.
### Step 6.3: Related Fixes Already Present?
**Record:** Prior partial fixes d14eece945a80 and 35a9b000b24d5 are in tree. This devm conversion is not yet applied. No duplicate fix found.
---
## Phase 7: Subsystem and Maintainer Context
### Step 7.1: Subsystem Criticality
**Record:** **ASoC / Rockchip RK3328 codec driver** — **PERIPHERAL** (platform-specific audio codec, affects RK3328-based embedded boards only).
### Step 7.2: Subsystem Activity
**Record:** Moderate — recent commits include DAI terminology update and pm_runtime include cleanup. Driver is mature but still receives maintenance fixes.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Users of RK3328-based boards with the on-SoC audio codec enabled — embedded/ARM64 platforms (Rock64, NanoPi, Orange Pi variants). Not universal; driver/config-specific.
### Step 8.2: Trigger Conditions
**Record:**
- **GPIO leak:** Any probe path after successful gpiod_get_optional() that returns error (including clk_prepare_enable(mclk) failure at line 468–470).
- **Clock/GPIO leak on unbind:** Module unload or device unbind (no platform .remove).
- **Likelihood:** Probe errors uncommon; unbind rare on production embedded systems but real during development/module reload.
- **Unprivileged trigger:** No — requires hardware presence and driver binding.
### Step 8.3: Failure Mode Severity
**Record:**
- GPIO descriptor leak (one per failed probe or unbind)
- Clocks left running after unbind (power/resource leak)
- **Severity: LOW to MEDIUM** — no crash, corruption, deadlock, or security impact; gradual resource retention
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Eliminates verified resource leaks; prevents recurrence of manual unwind bugs (driver already needed two prior fixes); simplifies probe code
- **Risk:** Very low — standard devm pattern, net code reduction, clean apply
- **Ratio:** Moderate benefit, very low risk. Importance is below crash/corruption fixes but above pure cosmetic cleanup.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Verified real resource leaks (GPIO never released; clocks not disabled on unbind)
- Verified remaining probe-error leak path (mclk enable failure returns without any cleanup)
- Small, surgical, obviously correct devm conversion (−28 lines)
- Applies cleanly to 6.18.44
- All required APIs present in tree since 2022
- Same driver already needed two prior clock-unwind fixes — pattern of incomplete error handling
- Committed by ASoC maintainer Mark Brown
- Low regression risk
**AGAINST backport:**
- LOW severity — resource leaks, not crash/corruption/security/deadlock
- Niche hardware (RK3328 embedded boards only)
- Unbind path rarely exercised in production
- No user reports, syzbot, or stable nomination
- Successful-probe GPIO hold is functionally intentional until unbind
**Unresolved:** No stable-list discussion found; no independent Tested- by.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — standard devm pattern; maintainer committed; no test reports
2. Fixes a real bug? **PASS** — verified GPIO and clock resource leaks
3. Important issue? **BORDERLINE PASS** — resource leaks, not crash/corruption; LOW-MEDIUM severity
4. Small and contained? **PASS** — 1 file, 54 lines touched, net −28
5. No new features/APIs? **PASS** — uses existing devm helpers
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception Categories
**Record:** None — not device ID, quirk, DT, build, or docs fix. Standard resource-lifetime bug fix.
### Step 9.4: Decision Rationale
This is a genuine, verified resource-leak fix in a driver that has already required two separate stable-worthy clock-unwind patches. The devm conversion is the robust completion of that work: it fixes GPIO leaks on probe-error paths (including the mclk enable-failure path that bypasses all existing error labels) and clock/GPIO leaks on driver unbind. While severity is low (no crashes or data corruption), the fix is small, obviously correct, applies cleanly, has no dependencies, and carries negligible regression risk. For the 6.18.y tree where the buggy code is present and the required devm APIs have been available for years, this meets stable backport criteria.
---
## Verification
- **[Phase 1]** Parsed commit message from user query and git show 0cf3489bba9ad
- **[Phase 1]** Tags: Signed-off-by (author + Mark Brown), Link to patch; no Fixes/Reported-by/Cc:stable
- **[Phase 2]** Read current rk3328_codec.c lines 422–529; confirmed manual GPIO/clock management and missing .remove
- **[Phase 2]** Verified no gpiod_put in file (grep returned no matches)
- **[Phase 2]** Verified mclk enable failure path (lines 468–470) returns without cleanup
- **[Phase 3]** git blame -L 451,514: GPIO from 87d12d5545fa7 (2020), clocks from c32759035ad24 (2018)
- **[Phase 3]** git log --oneline on file: found prior fixes d14eece945a80, 35a9b000b24d5 in tree
- **[Phase 3]** git show d14eece945a80, 35a9b000b24d5: confirmed prior clock-unwind fixes
- **[Phase 3]** git merge-base --is-ancestor 7ef9651e9792b HEAD:
devm_clk_get_enabled available — YES
- **[Phase 3]** grep devm_gpiod_get_optional include/linux/gpio/consumer.h: API present
- **[Phase 4]** b4 dig -c 0cf3489bba9ad: found lore URL
- **[Phase 4]** b4 dig -c 0cf3489bba9ad -w: Mark Brown, Liam Girdwood, Takashi Iwai CC'd
- **[Phase 4]** b4 dig -c 0cf3489bba9ad -a: v1 only, no revisions
- **[Phase 4]** b4 dig -c 0cf3489bba9ad -m /tmp/rk3328_devm.mbox:
thread has patch only, no review replies
- **[Phase 4]** UNVERIFIED: lore stable archive search (bot protection on web)
- **[Phase 5]** grep count: 90+ ASoC codec files use devm_clk_get_enabled/devm_gpiod_get_optional
- **[Phase 5]** Confirmed rk3328_codec_driver has .probe only, no .remove (lines 523–529)
- **[Phase 6]** git describe HEAD: v6.18.44; make kernelversion
equivalent: 6.18.44
- **[Phase 6]** git merge-base --is-ancestor 0cf3489bba9ad HEAD:
commit NOT in HEAD
- **[Phase 6]** git format-patch -1 0cf3489bba9ad | git apply --check:
clean apply
- **[Phase 6]** Read current probe code: buggy pattern confirmed present
- **[Phase 8]** Failure mode: resource leaks, severity LOW-MEDIUM
**YES**The analysis is done for **Linux 6.18.44**.
**Commit:** ASoC: codecs: rk3328: Use managed GPIO and clock helpers (0cf3489bba9ad on master, not yet in this tree)
**Finding:** The current rk3328_platform_probe() has real resource
leaks: the mute GPIO from gpiod_get_optional() is never released, clocks stay enabled on unbind (no platform .remove), and the mclk enable-failure path still leaks the GPIO. The patch fixes this with devm_gpiod_get_optional() and devm_clk_get_enabled(), applies cleanly, and only depends on APIs already in 6.18.
**Verdict:** Backport to this tree.
**YES**
sound/soc/codecs/rk3328_codec.c | 54 ++++++++------------------------- 1 file changed, 13 insertions(+), 41 deletions(-)
sound/soc/codecs/rk3328_codec.c +13 -41
@@ -425,7 +425,6 @@ static int rk3328_platform_probe(struct platform_device *pdev)struct rk3328_codec_priv *rk3328;struct regmap *grf;void __iomem *base; -int ret =0 ; rk3328 =devm_kzalloc (&pdev->dev,sizeof (*rk3328),GFP_KERNEL );if (!rk3328)
@@ -441,14 +440,13 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON2 , (BIT (14 ) <<16 |BIT (14 ))); - ret =of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , - &rk3328->spk_depop_time); -if (ret <0 ) { +if (of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , + &rk3328->spk_depop_time)) {dev_info (&pdev->dev,"spk_depop_time use default value.\n" ); rk3328->spk_depop_time =200 ; } - rk3328->mute =gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH ); + rk3328->mute =devm_gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH );if (IS_ERR (rk3328->mute))return PTR_ERR (rk3328->mute);/*
@@ -461,57 +459,31 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON10 ,BIT (17 ) |BIT (1 )); } - rk3328->mclk =devm_clk_get (&pdev->dev,"mclk" ); + rk3328->mclk =devm_clk_get_enabled (&pdev->dev,"mclk" );if (IS_ERR (rk3328->mclk))return PTR_ERR (rk3328->mclk); - ret =clk_prepare_enable (rk3328->mclk); -if (ret) -return ret;clk_set_rate (rk3328->mclk,INITIAL_FREQ ); - rk3328->pclk =devm_clk_get (&pdev->dev,"pclk" ); -if (IS_ERR (rk3328->pclk)) { -dev_err (&pdev->dev,"can't get acodec pclk\n" ); - ret =PTR_ERR (rk3328->pclk); - goto err_unprepare_mclk; - } - - ret =clk_prepare_enable (rk3328->pclk); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable acodec pclk\n" ); - goto err_unprepare_mclk; - } + rk3328->pclk =devm_clk_get_enabled (&pdev->dev,"pclk" ); +if (IS_ERR (rk3328->pclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (rk3328->pclk), +"failed to get or enable acodec pclk\n" ); base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (base)) { - ret =PTR_ERR (base); - goto err_unprepare_pclk; - } +if (IS_ERR (base)) +return PTR_ERR (base); rk3328->regmap =devm_regmap_init_mmio (&pdev->dev, base, &rk3328_codec_regmap_config); -if (IS_ERR (rk3328->regmap)) { - ret =PTR_ERR (rk3328->regmap); - goto err_unprepare_pclk; - } +if (IS_ERR (rk3328->regmap)) +return PTR_ERR (rk3328->regmap);platform_set_drvdata (pdev, rk3328); - ret =devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, +return devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, rk3328_dai,ARRAY_SIZE (rk3328_dai)); -if (ret) - goto err_unprepare_pclk; - -return 0 ; - -err_unprepare_pclk: -clk_disable_unprepare (rk3328->pclk); - -err_unprepare_mclk: -clk_disable_unprepare (rk3328->mclk); -return ret; }static const struct of_device_id rk3328_codec_of_match[]__maybe_unused = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 pds_core: quiesce DMA before freeing resources
In reply to Sasha LevinFrom: "Nikhil P. Rao" <[email protected]>
[ Upstream commit 6443f4f20bdae726fe01cf5946fba9742a0ffda6 ]
pdsc_teardown() frees DMA buffers but does not disable bus mastering, leaving the device able to perform DMA after the buffers are freed. This can lead to use-after-free if the device writes to freed memory.
Add pci_clear_master() to pdsc_teardown() to disable bus mastering before freeing resources, ensuring all DMA is quiesced.
Add pci_set_master() to pdsc_setup() to re-enable bus mastering, which is needed for the firmware recovery path since pdsc_teardown() now disables it.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
- Record: [pds_core] [quiesce] DMA before freeing resources — explicitly a DMA quiesce/safety fix in the AMD Pensando core driver.
**Step 1.2 — Tags**
- Record:
- Signed-off-by: Nikhil P. Rao <[email protected]> (author)
- `Link: https://patch.msgid.link/20260604213637.3844317-1-
[email protected]`
- Signed-off-by: Jakub Kicinski <[email protected]> (netdev maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, `Cc:
[email protected]`
- Notable: netdev maintainer merge; no syzbot/fuzzer report
**Step 1.3 — Body analysis**
- Record:
- **Bug:** pdsc_teardown() frees DMA buffers without disabling PCI bus mastering; device can still DMA into freed memory.
- **Symptom:** Use-after-free (device writes to freed DMA buffers).
- **Fix:** pci_clear_master() in pdsc_teardown() before resource free; pci_set_master() in pdsc_setup() to restore bus mastering for firmware recovery.
- **Root cause:** Teardown frees coherent DMA (dma_free_coherent) while the PCI function remains bus-master enabled.
**Step 1.4 — Hidden bug fix?**
- Record: **No** — this is an explicit DMA UAF fix, not disguised cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
- Record:
- 1 file: drivers/net/ethernet/amd/pds_core/core.c (+4 net lines in the provided diff; upstream diff also shows cancel_work_sync context)
- Functions modified: pdsc_setup(), pdsc_teardown()
- Scope: single-file, surgical (2 functional lines: pci_set_master,
`pci_clear_master`)
**Step 2.2 — Code flow per hunk**
*Hunk 1 — pdsc_setup()*
- Before: setup proceeds with bus master state unchanged.
- After: explicitly re-enables bus mastering at start of setup.
- Path: init error recovery (pdsc_fw_up() → pdsc_setup(PDSC_SETUP_RECOVERY)), and normal setup after teardown cleared master.
*Hunk 2 — pdsc_teardown()*
- Before: reset → free queues/DMA (pdsc_core_uninit) → uninit device resources.
- After: reset → **disable bus mastering** → free queues/DMA.
- Path: driver remove, setup error paths, firmware-down recovery.
**Step 2.3 — Bug mechanism**
- Record: **Memory safety / DMA UAF**
- pdsc_core_uninit() → pdsc_qcq_free() → dma_free_coherent() on admin/notify queue buffers.
- Without pci_clear_master(), hardware may still perform DMA after buffers are returned to the DMA pool.
- Especially critical on firmware recovery: pdsc_fw_down() calls pdsc_teardown(PDSC_TEARDOWN_RECOVERY) while pci_disable_device() is never called until full driver remove.
**Step 2.4 — Fix quality**
- Record:
- Fix is standard PCI driver practice (many netdev drivers call pci_clear_master() before freeing DMA resources).
- Minimal, obviously correct pairing: clear on teardown, restore on setup.
- Low regression risk; pci_set_master() in setup is needed specifically because teardown now clears it (recovery path).
- On first probe, pci_set_master() is already called in pdsc_probe() — duplicate call in setup is harmless.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
- Record:
- pdsc_teardown() introduced in 523847df1b371 (Shannon Nelson, 2023-04-19) — has never cleared bus master before freeing DMA.
- pdsc_setup() same vintage.
- Bug present since driver introduction in this tree (~2023).
**Step 3.2 — Fixes: tag**
- Record: N/A — no Fixes: tag in commit message.
**Step 3.3 — Related file history**
- Record:
- 2f48b1d854e85 (2023): removed pci_clear_master() from pdsc_remove() error/cleanup paths, arguing pci_disable_device() already clears bus master.
- That removal did **not** address pdsc_teardown(), which runs **before** pci_disable_device() in remove, and runs without pci_disable_device() during FW recovery.
- Recent stable fixes in same driver: UAF (9e0f80fac50ab), deadlock (19ef775c91c6b) — same maintainer/author pattern of backporting pds_core stability fixes.
- Standalone fix; not part of a multi-patch series.
**Step 3.4 — Author context**
- Record: Nikhil P. Rao (AMD) — active pds_core contributor; multiple recent stability fixes already in v6.18.44.
**Step 3.5 — Dependencies**
- Record: No prerequisites. Uses standard pci_clear_master() / pci_set_master() from linux/pci.h, both present in this tree. Applies standalone.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
- Record: b4 dig -c <commit> could not be run — commit is not in this checkout. Link fetch to patch.msgid.link and lore.kernel.org blocked by bot protection. **UNVERIFIED:** full review thread content.
**Step 4.2 — Reviewers**
- Record: **UNVERIFIED** via b4 dig -w. Commit message shows Jakub Kicinski merge only.
**Step 4.3 — Bug report**
- Record: No external bug report or syzbot link in commit message. Bug identified by code analysis (DMA after free).
**Step 4.4 — Related series**
- Record: Standalone 1-commit fix; no series dependency identified.
**Step 4.5 — Stable list history**
- Record: **UNVERIFIED** — lore stable search inaccessible.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
- Record: pdsc_setup(), pdsc_teardown(), pdsc_core_uninit(), pdsc_qcq_free(), pdsc_fw_down(), pdsc_fw_up()
**Step 5.2 — Callers of affected code**
pdsc_teardown() called from:
- pdsc_setup() error path
- pdsc_remove() / init error path (main.c)
- pdsc_fw_down() — firmware failure recovery
- pdsc_fw_up() error path
- pdsc_reset_prepare() → pdsc_fw_down() — PCI reset
pdsc_setup() called from:
- Driver init (main.c)
- pdsc_fw_up() — firmware recovery
**Step 5.3 — Key callees**
- pdsc_teardown() → pdsc_devcmd_reset() (MMIO admin commands), pdsc_core_uninit() → dma_free_coherent(), pdsc_dev_uninit() → pci_free_irq_vectors()
- pdsc_setup() → pdsc_dev_init() (allocates IRQ vectors, may need DMA), pdsc_core_init() (allocates coherent DMA)
**Step 5.4 — Reachability**
- Record:
- **Userspace-reachable** via normal driver lifecycle (module load/unload, PCI hotplug) and **firmware health events** (pdsc_health_thread watchdog detects bad FW → pdsc_fw_down()).
- Recovery path is the clearest trigger: teardown frees DMA while PCI device stays enabled and bus-master capable indefinitely until pdsc_fw_up() succeeds.
**Step 5.5 — Similar patterns**
- Record: Widespread pattern in this tree — igc, ice, bnxt, e1000e, etc. all call pci_clear_master() before teardown/free. Prior pds_core removal of pci_clear_master() from remove path (2f48b1d854e85) left the teardown/recovery gap unaddressed.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code present?**
- Record: **YES.** Local tree is v6.18.44 / 6.18.44. pdsc_teardown() at lines 485–500 has no pci_clear_master(). pdsc_setup() at lines 454–483 has no pci_set_master(). DMA is freed in pdsc_qcq_free() via dma_free_coherent(). Fix not yet applied.
**Step 6.2 — Backport complications**
- Record: **Clean apply expected.** Insert pci_clear_master() after pdsc_devcmd_reset() and before pdsc_core_uninit() in pdsc_teardown(); insert pci_set_master() at start of pdsc_setup().
- Note: upstream diff shows cancel_work_sync(&pdsc->adminqcq.work) in pdsc_teardown(); this tree already drains work inside pdsc_qcq_free() (commit 9e0f80fac50ab). Backport needs only the two PCI master lines, not the work-cancel hunk.
**Step 6.3 — Related fixes already present?**
- Record: No existing fix for DMA quiesce on teardown. Related UAF fix 9e0f80fac50ab addresses workqueue ordering, not bus mastering.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
- Record: drivers/net/ethernet/amd/pds_core — AMD Pensando network device core driver (CONFIG_PDS_CORE). Criticality: **IMPORTANT** (hardware-specific, but stability bugs can cause memory corruption on affected servers).
**Step 7.2 — Activity**
- Record: Actively maintained; multiple stability fixes landed in v6.18.44 in 2026 from same author.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
- Record: Users with CONFIG_PDS_CORE and AMD Pensando/PDS hardware (PF/VF, fwctl, vDPA dependents). Not universal, but real production hardware.
**Step 8.2 — Trigger conditions**
- Record:
- Firmware failure/recovery (pdsc_fw_down/pdsc_fw_up) — **most likely and severe** (no pci_disable_device on this path).
- Driver remove (gap between pdsc_teardown and
`pci_disable_device`).
- Setup error during probe.
- PCI reset prepare path.
- Requires device with active bus mastering — normal after pci_set_master() in probe.
**Step 8.3 — Failure mode severity**
- Record: **HIGH** — DMA write to freed kernel memory → memory corruption, possible crash, potential security impact. Classic DMA- after-free.
**Step 8.4 — Risk vs benefit**
- Record:
- **Benefit: HIGH** for affected hardware — prevents real DMA UAF on common recovery/remove paths.
- **Risk: LOW** — 2-line standard PCI API usage, symmetric restore in setup.
- Ratio: strongly favors backport.
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
*FOR backport:*
- Fixes real DMA use-after-free (memory corruption class bug)
- Small, surgical, standard PCI driver pattern
- Bug exists in v6.18.44 since driver introduction
- Firmware recovery path never disables bus master before freeing DMA
- Same driver already receives stable UAF/deadlock fixes
- pci_set_master() restore is required for recovery path correctness
*AGAINST backport:*
- Driver is hardware-specific (limited audience) — but stable rules allow driver bug fixes
- No syzbot/user report in commit message
- Mailing list review details unverified
*UNRESOLVED:*
- Full lore review thread content
- Whether reviewers explicitly nominated for stable
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — standard API usage; maintainer-merged; no Tested-by but mechanism is clear.
2. Fixes real bug affecting users? **PASS** — DMA UAF on teardown/recovery.
3. Important issue? **PASS** — memory corruption / potential crash (HIGH severity).
4. Small and contained? **PASS** — 2 functional lines.
5. No new features/APIs? **PASS** — uses existing PCI helpers only.
6. Can apply to local tree? **PASS** — code exists; clean apply.
**Step 9.3 — Exception category**
- Record: Hardware driver bug fix (DMA quiesce workaround) — qualifies under stable driver fix criteria.
**Step 9.4 — Decision rationale**
For **v6.18.44**, pdsc_teardown() frees coherent DMA buffers while the PCI function can still act as a bus master. On the firmware recovery path (pdsc_fw_down() → pdsc_teardown()), the device is never pci_disable_device()'d, so bus mastering stays enabled across teardown/setup cycles. The prior removal of pci_clear_master() from pdsc_remove() (2f48b1d854e85) only addressed the final remove path and did not fix the teardown/recovery gap. Adding pci_clear_master() before DMA free and pci_set_master() on setup is the correct, minimal fix.
---
## Verification
- [Phase 1] Parsed commit message: subsystem pds_core, explicit DMA UAF fix, tags listed
- [Phase 2] Diff analysis: pci_clear_master in teardown, pci_set_master in setup; pdsc_core_uninit → dma_free_coherent confirmed in core.c:310-316, core.c:153-159
- [Phase 3] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 3] git blame on pdsc_teardown: introduced 2023-04-19 (523847df1b371), no bus-master clear ever present
- [Phase 3] git show 2f48b1d854e85: removed pci_clear_master only from main.c probe/remove, not teardown
- [Phase 3] Recent pds_core stable fixes present: 9e0f80fac50ab (UAF), 19ef775c91c6b (deadlock)
- [Phase 4] UNVERIFIED: b4 dig and lore fetch blocked (commit not in tree; Anubis bot protection)
- [Phase 5] Callers traced via grep: pdsc_teardown from remove, setup errors, pdsc_fw_down/up, pdsc_reset_prepare
- [Phase 5] pdsc_fw_down at core.c:543-567 calls teardown without pci_disable_device
- [Phase 5] pdsc_probe calls pci_set_master at main.c:381; pci_disable_device only at main.c:461 after teardown
- [Phase 6] Buggy code confirmed present; fix not applied
- [Phase 6] Backport note: work draining already in pdsc_qcq_free (core.c:147-149); only PCI master lines needed
- [Phase 7] CONFIG_PDS_CORE in drivers/net/ethernet/amd/Kconfig:189
- [Phase 8] Failure mode: DMA UAF → memory corruption, severity HIGH
**YES**
drivers/net/ethernet/amd/pds_core/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/amd/pds_core/core.c +4 -0
@@ -455,6 +455,8 @@ int pdsc_setup(struct pdsc *pdsc, bool init) {int err; +pci_set_master (pdsc->pdev); + err =pdsc_dev_init (pdsc);if (err)return err;
@@ -487,6 +489,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)if (!pdsc->pdev->is_virtfn)pdsc_devcmd_reset (pdsc); +pci_clear_master (pdsc->pdev); +pdsc_core_uninit (pdsc);if (removing) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: ralink: RT2X00: init EEPROM properly
In reply to Sasha LevinFrom: Corentin Labbe <[email protected]>
[ Upstream commit 0a2581cbae9e442835f68d22044157db61cdf54d ]
I have an hostapd setup with a
01:00.0 Network controller: Ralink corp. RT2790 Wireless 802.11n 1T/2R PCIe
The setup work fine on 6.18.26-gentoo
It breaks on 6.18.33-gentoo (and still broken on 6.18.37)
I found an hint in dmesg:
On 6.18.26-gentoo I see:
May 31 15:48:45 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0003 detected On 6.18.33-gentoo I see: May 31 15:22:57 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0006 detected
The RF chipset seems badly detected.
The problem was the EEPROM which was badly initialized.
Probably the origin was in some PCI change but unfortunately I couldn't play to bisect/reboot often the board with this card to do it.
---
LLM Generated explanations, may be completely bogus:
The background git log -S "PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE" search finished, but this shallow 6.18.44 checkout only surfaced merge commits — not the original introducing change.
From external history, that quirk came in **7738a7a** (`misc: eeprom:eeprom_93cx6: Add quirk for extra read clock cycle, Oct 2024). That lines up with the regression: rt2x00 PCI drivers never zero-initialized the new quirks` field, so EEPROM reads could be corrupted and RF chipset detection could fail.
The backport analysis stands: **YES** for this 6.18.y tree.
drivers/net/wireless/ralink/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2400pci.c +1 -1
@@ -1429,7 +1429,7 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)*/ static int rt2400pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2500pci.c +1 -1
@@ -1555,7 +1555,7 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)*/ static int rt2500pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2800pci.c +1 -1
@@ -108,7 +108,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom)static int rt2800pci_read_eeprom_pci (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg; reg =rt2x00mmio_register_read (rt2x00dev,E2PROM_CSR );
drivers/net/wireless/ralink/rt2x00/rt61pci.c +1 -1
@@ -2298,7 +2298,7 @@ static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance)*/ static int rt61pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 fuse: set ff->flock only on success
In reply to Sasha LevinFrom: Zhang Tianci <[email protected]>
[ Upstream commit 71947173cef279be5eed209ec28f8c11f9d73159 ]
If FUSE_SETLK fails (e.g., due to EWOULDBLOCK), we shall not set FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release().
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: fuse: set ff->flock only on success
**Local tree:** v6.18.44-1-g2736c32da98b9 (6.18.44 stable, detached from stable/linux-6.18.y)
**Commit under review:** 71947173cef279be5eed209ec28f8c11f9d73159 (mainline; **not yet in this tree**)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [fuse] [set] — set ff->flock only when fuse_setlk() succeeds, so failed flock attempts do not trigger unlock on file release.
### Step 1.2: Parse all commit message tags
**Record:**
- **Reported-by:** Li Yichao <[email protected]> — real-world reporter (ByteDance)
- **Signed-off-by:** Zhang Tianci <[email protected]> (author)
- **Signed-off-by:** Miklos Szeredi <[email protected]> (FUSE maintainer, committer)
- No Fixes:, Cc: stable, Link:, Tested-by:, Reviewed-by:, Acked-by:
Notable: maintainer committed the patch; reporter from production FUSE user.
### Step 1.3: Analyze commit body
**Record:**
- **Bug:** ff->flock = true is set before fuse_setlk(). If FUSE_SETLK fails (e.g. -EWOULDBLOCK for non-blocking flock), ff->flock remains set.
- **Symptom:** On close(), fuse_file_release() sets FUSE_RELEASE_FLOCK_UNLOCK even though no flock was acquired.
- **Failure mode:** Spurious flock unlock sent to the FUSE userspace daemon on file release.
- **Root cause:** Flag tracks intent to lock, not actual lock success.
- No kernel version range mentioned in the message.
### Step 1.4: Detect hidden bug fixes
**Record:** Not disguised — this is an explicit correctness fix for flock release handling. The commit message clearly describes incorrect unlock behavior on the error path.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes **Record:**
- **Files:** fs/fuse/file.c (+2 / -1, net +1 line)
- **Function modified:** fuse_file_flock()
- **Scope:** Single-file, surgical fix (3-line hunk)
### Step 2.2: Code flow change
**Record:**
- **Hunk (fuse_file_flock):**
- **Before:** ff->flock = true unconditionally, then `err =
fuse_setlk(file, fl, 1)`
- **After:** err = fuse_setlk(file, fl, 1) first; ff->flock = true only if !err
- **Path affected:** FUSE flock path when fc->no_flock is false (flock delegated to userspace via FUSE_SETLK)
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic / correctness fix (lock state tracking)
- **Mechanism:** ff->flock gates FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release():
```358:361:fs/fuse/file.c
if (ra && ff->flock) {
ra->inarg.release_flags |= FUSE_RELEASE_FLOCK_UNLOCK;
ra->inarg.lock_owner = fuse_lock_owner_id(ff->fm->fc,
id);
}
```Setting the flag before confirming lock success causes a spurious unlock request on close() after a failed flock(2).
### Step 2.4: Fix quality assessment
**Record:**
- Fix is obviously correct: the flag should reflect a successfully acquired flock, not an attempted one.
- Minimal change; mirrors standard “set state only on success” pattern.
- **Regression risk:** Very low. A successful flock still sets the flag; failed attempts no longer poison release behavior.
- No API, locking, or structural changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the changed lines
**Record:**
- fuse_file_flock() dates to 2007 (a9ff4f87056cd)
- ff->flock = true before fuse_setlk() introduced in 37fb3a30b46237 (“fuse: fix flock”, Aug 2011, Miklos Szeredi)
- Bug has existed since v3.0 era; long-present in stable trees including 6.18.y
### Step 3.2: Follow Fixes: tag
**Record:** No Fixes: tag. The introducing commit is 37fb3a30b46237, which is certainly in this tree.
### Step 3.3: File history for related changes
**Record:**
- Standalone one-patch fix (v1 only on lore)
- Recent FUSE stable activity in this tree includes writeback, virtiofs, and fuse-uring fixes — unrelated to this flock issue
- Commit 71947173cef27 is in origin/master but **not** in stable/linux-6.18.y (confirmed via git log stable/linux-6.18.y..origin/master)
### Step 3.4: Author's other commits
**Record:** Zhang Tianci has other FUSE contributions (e.g. attribute staleness checks). Miklos Szeredi is the FUSE maintainer and applied the patch.
### Step 3.5: Dependencies / prerequisites
**Record:** No dependencies. Uses existing ff->flock, fuse_setlk(), and FUSE_RELEASE_FLOCK_UNLOCK — all present in 6.18.44. git show 71947173cef27 | git apply --check succeeds cleanly.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:**
- **URL:** https://patch.msgid.link/20251225111156.47987-1-
[email protected]
- **Series:** v1 only (no v2/v3)
- **Maintainer response:** Miklos Szeredi: “Applied, thanks.”
- No NAKs or objections found in thread
- No explicit stable nomination in thread
### Step 4.2: Reviewers from b4 dig -w
**Record:** CC'd: [email protected], [email protected], [email protected], reporter Li Yichao, co-worker [email protected]. FUSE maintainer reviewed and applied.
### Step 4.3: Bug report
**Record:** Reported-by from ByteDance engineer; no syzbot/bugzilla link. Production FUSE user hit the issue with failed non-blocking flock
+ file close.
### Step 4.4: Related patches / series **Record:** Standalone patch; no series dependencies.
### Step 4.5: Stable mailing list history
**Record:** Not searched on lore stable list (Anubis bot blocked direct lore fetch). No stable discussion found via b4.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** fuse_file_flock() (modified), fuse_setlk() (called), fuse_file_release() (affected downstream)
### Step 5.2: Callers
**Record:**
- fuse_file_flock is the .flock handler in fuse_file_operations (line 3137)
- Reached from SYSCALL_DEFINE2(flock) in fs/locks.c when file->f_op->flock is set and LOCK_NB is used (F_SETLK vs F_SETLKW)
- Callable by any unprivileged process with a FUSE file descriptor
### Step 5.3: Callees
**Record:** fuse_setlk() → fuse_simple_request() with FUSE_SETLK/FUSE_SETLKW and FUSE_LK_FLOCK flag. Returns errors including -EWOULDBLOCK (mapped from userspace daemon response).
### Step 5.4: Call chain / reachability
**Record:**
``` userspace flock(2) → SYSCALL_DEFINE2(flock) → file->f_op->flock (fuse_file_flock) → fuse_setlk() → [on failure] return error → [on close] fuse_release → fuse_file_release → FUSE_RELEASE_FLOCK_UNLOCK if ff->flock ```
**Reachable from userspace:** Yes, via flock(2) on FUSE-mounted files when fc->no_flock is false.
### Step 5.5: Similar patterns
**Record:** The no_flock fallback path uses locks_lock_file_wait() and does not set ff->flock — only the userspace-delegated flock path is affected. No sibling functions with the same pre-set pattern found.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does the buggy code exist?
**Record:** **Yes.** Current tree at fs/fuse/file.c:2531 still has unconditional ff->flock = true before fuse_setlk(). Bug present since 2011 (37fb3a30b46237).
### Step 6.2: Backport complications
**Record:** Patch applies cleanly (git apply --check passed). No refactoring conflicts expected. Trivial backport.
### Step 6.3: Related fixes already present? **Record:** No equivalent fix in stable/linux-6.18.y. Commit 71947173cef27 is only in mainline (post-6.18.y branch point).
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **fs/fuse** — IMPORTANT. FUSE is widely used (virtio-fs, cloud storage mounts, container/shared filesystems). File locking correctness affects data integrity for multi-process workloads.
### Step 7.2: Subsystem activity
**Record:** FUSE subsystem actively maintained in 6.18.y with multiple recent stable-relevant fixes (writeback, virtiofs UAF, fuse-uring races).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of FUSE filesystems that support flock (i.e. FUSE_FLOCK_LOCKS negotiated, fc->no_flock == 0). Includes virtio-fs and custom FUSE implementations using BSD-style flock.
### Step 8.2: Trigger conditions
**Record:**
1. Open file on FUSE mount with flock support
2. Call flock(fd, LOCK_EX | LOCK_NB) (or LOCK_SH | LOCK_NB) when lock cannot be acquired
3. Close the file descriptor
**Likelihood:** Moderate — non-blocking flock failure is a normal, documented API path. **Unprivileged users can trigger.**
### Step 8.3: Failure mode severity
**Record:** Spurious FUSE_RELEASE_FLOCK_UNLOCK on close after a failed lock attempt. This can corrupt flock state in the userspace filesystem daemon — potentially releasing locks held by other processes or breaking mutual exclusion guarantees. **Severity: HIGH** (data integrity / locking correctness; not a kernel oops, but serious application-visible bug).
### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** HIGH — fixes real lock-handling bug on a common error path
- **Risk:** VERY LOW — 3-line, obviously correct change
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real bug with production reporter (ByteDance)
- FUSE maintainer applied and signed off
- Long-standing bug (since 2011) present in 6.18.44
- Incorrect spurious unlock on failed flock(LOCK_NB) + close()
- Lock correctness / potential data corruption
- Tiny, surgical, applies cleanly
- No dependencies
**AGAINST backport:**
- No kernel crash or oops (correctness bug, not memory safety)
- Affects only FUSE mounts with flock support enabled (not universal)
- No explicit stable nomination in mailing list
**Unresolved:** None material to the decision.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic is self-evident; maintainer applied; reporter verified the scenario
2. Fixes a real bug affecting users? **PASS** — spurious unlock after failed flock
3. Important issue? **PASS** — lock state corruption / data integrity (HIGH)
4. Small and contained? **PASS** — 3 lines, one function
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception categories
**Record:** None (not a device ID, quirk, DT, build, or docs fix). Qualifies on merit as a correctness bug fix.
### Step 9.4: Decision rationale
This commit fixes a real, long-standing logic bug in FUSE flock handling. When a non-blocking flock fails, the kernel incorrectly marks the file as flock-held and sends FUSE_RELEASE_FLOCK_UNLOCK on close, potentially corrupting lock state in the userspace filesystem. The fix is minimal, maintainer-approved, applies cleanly to 6.18.44, and the buggy code is present in this tree. Stable users running FUSE with flock support benefit directly.
---
## Verification
- [Phase 1] git show 71947173cef27: parsed subject, tags (Reported-by, SOBs), body
- [Phase 2] Read fs/fuse/file.c lines 2519–2536, 349–361; confirmed diff mechanics
- [Phase 2] Read fuse_setlk() at lines 2470–2494; confirmed error return path
- [Phase 3] git describe HEAD: v6.18.44 stable tree
- [Phase 3] git blame -L 2519,2536 fs/fuse/file.c: bug introduced 37fb3a30b46237 (2011)
- [Phase 3] git show 37fb3a30b46237: original ff->flock = true placement
- [Phase 3] git log stable/linux-6.18.y..origin/master -- fs/fuse/file.c: fix only in mainline
- [Phase 3] git show 71947173cef27 | git apply --check: clean apply
- [Phase 4] b4 dig -c 71947173cef27: lore URL found
- [Phase 4] b4 dig -c 71947173cef27 -a: v1 only
- [Phase 4] b4 dig -c 71947173cef27 -w: [email protected] CC'd
- [Phase 4] b4 dig -m /tmp/fuse_flock_thread.mbox: Miklos “Applied, thanks”
- [Phase 5] Read fs/locks.c SYSCALL_DEFINE2(flock): confirms VFS → .flock path
- [Phase 5] Read fuse_file_operations: .flock = fuse_file_flock
- [Phase 5] fuse_file_alloc() uses kzalloc: ff->flock starts false
- [Phase 6] Grep confirmed buggy code at line 2531 in current tree
- [Phase 6] git branch --contains 71947173cef27: not in stable/linux-6.18.y
- [Phase 8] Read include/uapi/linux/fuse.h:
FUSE_RELEASE_FLOCK_UNLOCK definition
**YES**The background searches finished and match what the earlier analysis used:
- **Tree:** detached HEAD on stable/linux-6.18.y (6.18.44)
- **Commit:** 71947173cef27 on origin/master — fuse: set ff->flock only on success
- **Status in this tree:** not present yet; patch applies cleanly
**Verdict remains YES** — backport to 6.18.y is warranted. It fixes a real FUSE flock bug where a failed non-blocking flock() still triggers FUSE_RELEASE_FLOCK_UNLOCK on close, which can corrupt lock state in the userspace daemon.
fs/fuse/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c +2 -1
@@ -2528,8 +2528,9 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)struct fuse_file *ff = file->private_data;/* emulate flock with POSIX locks */ - ff->flock = true; err =fuse_setlk (file, fl,1 ); +if (!err) + ff->flock = true; }return err;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rtw88: Add NULL check for chip->edcca_th in rtw_fw_adaptivity_result()
In reply to Sasha LevinFrom: Panagiotis Petrakopoulos <[email protected]>
[ Upstream commit d5e6f353ce1e1c25b8458ea390ed09d2377412c5 ]
It was recently reported that rtw_fw_adaptivity_result() in fw.c dereferences rtwdev->chip->edcca_th without a NULL check. The issue is that devices with the 8821CE chip don't define edcca_th in their chip info. As a result, when rtw_fw_adaptivity_result() tries to dereference it, the kernel triggers an oops.
Add a NULL check for edcca_th before dereferencing it in rtw_fw_adaptivity_result() in fw.c. Placing the check at the function entry avoids logging any garbage values.
This change does not address the root cause for this behavior, but it prevents the NULL dereference and the resulting oops while a more permanent solution is developed.
Tested on a 8822CE chip which defines edcca_th, so this issue is not present on it, but it still uses this driver and I can verify there are no regressions.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [wifi: rtw88] [Add] — Add NULL check for chip->edcca_th in rtw_fw_adaptivity_result().
### Step 1.2: Tags
**Record:**
- **Suggested-by:** Ping-Ke Shih \<[email protected]\> (Realtek rtw88 maintainer)
- **Reported-by:** Oleksandr Havrylov \<[email protected]\> (user hit the bug on RTL8821CE)
- **Closes:** https://bugzilla.kernel.org/show_bug.cgi?id=221286
- **Tested-by:** Oleksandr Havrylov (commit message); also Panagiotis on 8822CE
- **Acked-by:** Ping-Ke Shih (v2/v3 review on lore)
- **Signed-off-by:** Panagiotis Petrakopoulos, Ping-Ke Shih
- **Link:** https://patch.msgid.link/20260415052959.14844-1-
[email protected]
- No **Fixes:** tag (expected for manual review)
- No **Cc: [email protected]** (expected; not a negative signal)
Notable: maintainer **Acked-by**, user **Reported-by** + **Tested-by**, kernel bugzilla filing.
### Step 1.3: Body Analysis
**Record:**
- **Bug:** rtw_fw_adaptivity_result() in fw.c dereferences rtwdev->chip->edcca_th without a NULL check.
- **Symptom:** Kernel oops (and per bugzilla title, system hang) on RTL8821CE when firmware sends C2H_ADAPTIVITY.
- **Root cause (as stated):** rtw8821c_hw_spec does not set .edcca_th, so the pointer is NULL for 8821CE.
- **Fix approach:** Early return at function entry if !edcca_th.
- **Caveat:** Author notes this is a workaround, not a full root-cause fix (maintainer also discussed garbage/malformed C2H as underlying issue).
- **Version info:** Bug reported on Linux 6.19.9; patch dated April 2026.
### Step 1.4: Hidden Bug Fix?
**Record:** Yes — despite "Add NULL check" wording, this is a real NULL pointer dereference crash fix, not cosmetic cleanup.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- **Files:** drivers/net/wireless/realtek/rtw88/fw.c only (v3; phy.c hunk dropped per maintainer review)
- **Scope:** +3 lines, 1 function, single-file surgical fix
- **Function modified:** rtw_fw_adaptivity_result()
### Step 2.2: Code Flow Change
**Record:**
- **Before:** Load edcca_th = rtwdev->chip->edcca_th, then unconditionally use edcca_th[...] in rtw_dbg() arguments (and rtw_read32_mask() calls).
- **After:** After loading edcca_th, if NULL, return immediately; otherwise unchanged.
- **Path affected:** Firmware C2H adaptivity result handling (workqueue context).
### Step 2.3: Bug Mechanism
**Record:** **NULL pointer dereference** — category (e). On 8821CE, chip->edcca_th is NULL; indexing edcca_th[EDCCA_TH_L2H_IDX] reads from address 0. Bitterblue's disassembly analysis on lore confirms movl (%r12), %esi with R12=0.
Note: rtw_dbg() is a no-op when CONFIG_RTW88_DEBUG is unset, but C still evaluates its arguments before the call, so the crash is not debug-only.
### Step 2.4: Fix Quality
**Record:** Obviously correct, minimal, low regression risk. Chips that define edcca_th (8822B/C) are unaffected. Maintainer requested check at function entry (v3) to avoid logging garbage. No API changes.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** rtw_fw_adaptivity_result() and C2H_ADAPTIVITY handling exist at least since ac3fd01e4c1ef (Linux 6.18-rc7), which is an ancestor of HEAD. rtw8821c_hw_spec has never set .edcca_th in this tree (verified at 6.18-rc7 and current HEAD). Git blame in this checkout is flattened (lines attributed to unrelated squash commit); pickaxe search confirms code present since 6.18-rc7.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related File History
**Record:** Recent rtw88 stable fixes in this tree include OOB read fix (01155ded5d4da), PCI AER fix, USB leak fix — unrelated. This NULL- check fix is **not** present in HEAD (verified: no if (!edcca_th) in fw.c).
### Step 3.4: Author Context
**Record:** Panagiotis Petrakopoulos is a community contributor; Ping-Ke Shih (Realtek rtw88 maintainer) reviewed v1→v3, provided **Acked-by**, and guided placement of the NULL check.
### Step 3.5: Dependencies
**Record:** Standalone. v3 is self-contained (1 file, 3 lines). No prerequisite commits required. Final version dropped unnecessary phy.c hunk.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Discussion
**Record:** Thread found via yhbt.net lore mirror at
https://yhbt.net/lore/linux-
wireless/[email protected]/T/ (lore.kernel.org blocked by bot protection; b4 shazam did not find message-id). Series: v1 (fw.c + phy.c) → v2 (entry check, drop phy.c) → v3 (subject/tags per maintainer). v3 is the committed version.
### Step 4.2: Reviewers
**Record:** Ping-Ke Shih (maintainer) CC'd throughout; provided review feedback and **Acked-by** on v2/v3. Reporter Oleksandr Havrylov participated. Bitterblue Smith referenced for deeper root-cause analysis.
### Step 4.3: Bug Report
**Record:** Bugzilla #221286 — "NULL pointer dereference in rtw_fw_adaptivity_result() causes kernel oops and system hang on RTL8821CE". Reported 2026-03-27 by Oleksandr on kernel 6.19.9. Severity:
kernel oops + hang on common laptop WiFi hardware.
### Step 4.4: Series Context
**Record:** 3-patch revision series; v3 is final and applies only to fw.c. Maintainer noted root cause may be malformed C2H packets, but endorsed the workaround to prevent oops.
### Step 4.5: Stable List
**Record:** No explicit "Cc: stable" found in lore thread. Maintainer endorsed resolving bugzilla with this workaround. Absence of stable nomination is not a negative signal per review rules.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** rtw_fw_adaptivity_result() (modified); callers:rtw_fw_c2h_cmd_handle() case C2H_ADAPTIVITY.
### Step 5.2: Callers
**Record:**
- rtw_fw_c2h_cmd_handle() ← rtw_c2h_work() (workqueue)
- rtw_c2h_work queued from fw.c when firmware C2H commands arrive (ieee80211_queue_work)
- Trigger: firmware sends C2H_ADAPTIVITY (0x37) to driver
### Step 5.3: Callees
**Record:** rtw_dbg(), rtw_read32_mask() — the crash is in argument evaluation for register reads via NULL edcca_th.
### Step 5.4: Reachability
**Record:**
- rtw_phy_dynamic_mechanism() → rtw_fw_adaptivity() when firmware advertises FW_FEATURE_ADAPTIVITY (regular watchdog path in main.c)
- Firmware can respond with C2H_ADAPTIVITY → rtw_fw_adaptivity_result()
- RTL8821CE (CONFIG_RTW88_8821CE, rtw8821ce.c) uses rtw8821c_hw_spec which lacks .edcca_th
- Reachable during normal WiFi operation on affected hardware; not an obscure init-only path
### Step 5.5: Similar Patterns
**Record:** rtw_phy_set_edcca_th() in phy.c also dereferences edcca_th without check, but is only called from 8822B/C adaptivity paths that define edcca_th. Maintainer correctly had v3 drop that hunk.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy Code Exists?
**Record:** **YES.** Local tree is **v6.18.43** (git describe HEAD). Current fw.c lines 276–291 show unchecked edcca_th dereference. rtw8821c_hw_spec (lines 1973–2057 of rtw8821c.c) has no .edcca_th field — pointer is NULL for 8821CE.
### Step 6.2: Backport Complications
**Record:** **Clean apply expected.** v3 hunk targets fw.c at lines matching current tree structure (@@ -279,6 +279,9 @@). No conflicting changes observed.
### Step 6.3: Related Fixes Already Present?
**Record:** **NO.** grep confirms if (!edcca_th) is absent from fw.c. Fix not yet in this 6.18.43 tree.
---
## Phase 7: Subsystem and Maintainer Context
### Step 7.1: Subsystem
**Record:** drivers/net/wireless/realtek/rtw88 — **IMPORTANT** (widely deployed USB/PCI WiFi, especially RTL8821CE in laptops).
### Step 7.2: Activity
**Record:** Actively maintained; recent stable backports in this tree (OOB read, USB leaks, PCI fixes) show ongoing rtw88 stable attention.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Users of RTL8821CE (and potentially other 8821C variants) with CONFIG_RTW88_8821CE / rtw88 driver loaded. Driver-specific, but 8821CE is extremely common hardware.
### Step 8.2: Trigger Conditions
**Record:** Firmware sends C2H_ADAPTIVITY command while driver is running. Occurs during normal dynamic mechanism / adaptivity handling. User-visible during regular WiFi use; unprivileged users can trigger WiFi traffic that causes firmware interaction.
### Step 8.3: Failure Mode Severity
**Record:** **CRITICAL** — NULL pointer dereference → kernel oops; bugzilla reports system hang. Workqueue holds rtwdev->mutex during crash, compounding severity.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH — prevents crashes/hangs on very common hardware
- **Risk:** VERY LOW — 3-line guard, maintainer-reviewed, tested on 8822CE for regressions
- **Ratio:** Strongly favors backport
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, reproducible NULL deref → kernel oops/hang
- Affects RTL8821CE, common laptop WiFi
- Tiny, surgical, maintainer-Acked fix
- User-reported with bugzilla, Tested-by from reporter
- Bug present in v6.18.43 tree; fix not yet applied
- Clean apply expected
**AGAINST backport:**
- Workaround only; root cause may be malformed C2H packets (maintainer discussion) — but stable trees routinely take crash-prevention workarounds while root-cause fixes develop
- No explicit stable nomination in lore — not disqualifying
**Unresolved:** Exact mainline merge commit SHA not verified in this checkout (fix not merged here yet). Does not affect backport decision for this tree.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — 3-line NULL guard; Acked-by maintainer; Tested-by on 8822CE and reporter testing on 8821CE
2. Fixes real bug affecting users? **PASS** — bugzilla #221286, user oops on 8821CE
3. Important issue? **PASS** — kernel oops / system hang (CRITICAL)
4. Small and contained? **PASS** — 1 file, +3 lines
5. No new features/APIs? **PASS** — defensive guard only
6. Can apply to local tree? **PASS** — buggy code present, fix not present, clean apply
### Step 9.3: Exception Categories
**Record:** N/A — standard bug fix, not device-ID/quirk/build/doc exception.
### Step 9.4: Decision Rationale
For **Linux 6.18.43**, the unchecked NULL dereference in rtw_fw_adaptivity_result() is present, affects widely deployed RTL8821CE hardware, causes kernel oops/hang, and is fixed by a minimal 3-line patch reviewed and Acked by the rtw88 maintainer. This is textbook stable material.
---
## Verification
- [Phase 1] Parsed subject, tags (Reported-by, Tested-by, Acked-by, Closes bugzilla, Suggested-by)
- [Phase 1] Read commit body; identified NULL deref on 8821CE, workaround nature noted
- [Phase 2] Confirmed v3 diff: +3 lines in fw.c only, early if (!edcca_th) return;
- [Phase 2] Read current fw.c:276-296 — buggy code without NULL check
- [Phase 2] Read rtw8821c_hw_spec — no .edcca_th field (lines 1973-2057)
- [Phase 2] Compared rtw8822b_hw_spec — has .edcca_th = rtw8822b_edcca_th (line 2568)
- [Phase 2] Read debug.h:61-62 — rtw_dbg is empty inline when debug off; args still evaluated in C
- [Phase 3] git describe HEAD → v6.18.43; Makefile VERSION 6.18.43
- [Phase 3] git show ac3fd01e4c1ef:fw.c — same buggy function at 6.18-rc7
- [Phase 3] git show ac3fd01e4c1ef:rtw8821c.c — no edcca_th at 6.18-rc7
- [Phase 3] grep "if (!edcca_th)" fw.c — NOT present in HEAD
- [Phase 3] Pickaxe search: C2H_ADAPTIVITY/rtw_fw_adaptivity_result present since 6.18-rc7
- [Phase 4] Lore thread via yhbt.net mirror — v1/v2/v3 evolution, Ping- Ke Acked-by, review feedback
- [Phase 4] Bugzilla #221286 fetched — oops/hang on RTL8821CE confirmed
- [Phase 4] b4 shazam — lore.kernel.org message not found (bot/cache); used yhbt mirror instead
- [Phase 5] Traced call chain: firmware C2H → rtw_c2h_work → rtw_fw_c2h_cmd_handle → rtw_fw_adaptivity_result
- [Phase 5] main.c:280 — rtw_phy_dynamic_mechanism in watchdog path can trigger adaptivity H2C
- [Phase 5] Verified CONFIG_RTW88_8821CE exists in Kconfig/Makefile
- [Phase 6] Confirmed local tree 6.18.43 has bug, lacks fix, expects clean apply
- [Phase 8] Severity: NULL deref → oops/hang on common hardware
**YES**The pickaxe search finished: C2H_ADAPTIVITY handling and rtw_fw_adaptivity_result() have been in this tree since at least Linux 6.18-rc7, and the bug is still present in v6.18.43 — rtw8821c_hw_spec never sets .edcca_th, but fw.c dereferences it without a check.
**Backport recommendation: YES.** This is a small, maintainer-Acked NULL-deref fix that prevents kernel oops/hangs on RTL8821CE when firmware sends adaptivity C2H commands. It should apply cleanly as a 3-line addition to drivers/net/wireless/realtek/rtw88/fw.c.
drivers/net/wireless/realtek/rtw88/fw.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw88/fw.c +3 -0
@@ -279,6 +279,9 @@ static void rtw_fw_adaptivity_result(struct rtw_dev *rtwdev, u8 *payload,const struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th;struct rtw_c2h_adaptivity *result = (struct rtw_c2h_adaptivity *)payload; +if (!edcca_th) +return ; + rtw_dbg(rtwdev, RTW_DBG_ADAPTIVITY, "Adaptivity: density %x igi %x l2h_th_init %x l2h %x h2l %x option %x\n", result->density, result->igi, result->l2h_th_init, result->l2h,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 hwmon: (corsair-psu) Fix linear11 calculation
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit c6c4234928d2eb4f61fecb61067e612d9bdbd2ff ]
In corsairpsu_linear11_to_int(), the mantissa is extracted using bitwise operations and cast to s16 before being shifted left:
static int corsairpsu_linear11_to_int(const u16 val, const int scale)
{
...
const int mant = (((s16)(val & 0x7ff)) << 5) >> 5;
...
}Due to C integer promotion rules, the masked value (which is always positive) is promoted to a 32-bit integer before the left shift. As a result, the sign bit is never extended to bit 31 of the promoted integer.
When the device hardware reports a negative temperature in Linear11 format (such as an ambient temperature probe reporting sub-zero), the negative mantissa is parsed incorrectly as a massive positive value. For example, -1 becomes 2047, which scales to 2047 degrees Celsius.
Fix the problem by type casting the result of the left shift operation to s16.
Another problem is left-shifting of negative values. In C, the result of left-shifting negative values is undefined. Use a multiplication instead to avoid the problem.
Also use a local s64 variable to store temporary results, change the return value type from int to long, and clamp the final value to LONG_MIN and LONG_MAX to avoid under- and overflow issues while retaining as much information as possible.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: hwmon: (corsair-psu) Fix linear11 calculation
**Local tree:** v6.18.44 (linux-6.18.y, VERSION = 6, PATCHLEVEL = 18, SUBLEVEL = 44)
**Upstream fix commit:** c6c4234928d2e (on master, not yet in this tree)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the Subject Line
**Record:** [hwmon: (corsair-psu)] [fix] [correct LINEAR11 mantissa sign-extension and exponent handling in sensor value conversion]
### Step 1.2: Parse All Commit Message Tags
**Record:**
| Tag | Value | |-----|-------| | Reported-by | Sashiko \<[email protected]\> (AI code review bot, not a user crash report) | | Cc | Wilken Gottwalt \<[email protected]\> (driver author) | | Signed-off-by | Guenter Roeck \<[email protected]\> (hwmon subsystem maintainer) | | Tested-by | Wilken Gottwalt \<[email protected]\> | | Link | https://lore.kernel.org/r/20260804034811.2385506-1-linux@roeck- us.net | | Fixes: | **Absent** (expected for manual review) | | Cc: stable | **Absent** (expected) |
**Notable patterns:** Maintainer-authored fix with hardware-expert Tested-by. Reported-by is an automated AI reviewer, not syzbot or a user bug report.
### Step 1.3: Analyze Commit Body
**Record:**
- **Bug description:** corsairpsu_linear11_to_int() incorrectly extracts the signed 11-bit LINEAR11 mantissa. Casting (val & 0x7ff) to s16 before left-shift fails because the masked value is always non-negative and gets promoted to a 32-bit int without sign extension.
- **Symptom:** Negative temperatures (e.g., sub-zero ambient probe) parse as huge positive values. Example: -1°C → 2047°C.
- **Secondary issues:** Left-shifting negative values is undefined behavior in C; exponent scaling can overflow int.
- **Root cause:** Integer promotion rules + incorrect cast order in mantissa extraction (introduced in 2021 refactor).
- **Version info:** None explicit; bug has existed since Feb 2021.
### Step 1.4: Detect Hidden Bug Fixes
**Record:** Not disguised — explicitly labeled and described as a fix. The overflow/clamp and UB avoidance are genuine correctness improvements bundled with the sign-extension fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the Changes
**Record:**
- **File:** drivers/hwmon/corsair-psu.c — +14 / -9 lines (23 lines total with context)
- **Functions modified:** corsairpsu_linear11_to_int() → renamed corsairpsu_linear11_to_long(); call sites in corsairpsu_get_value()
- **Scope:** Single-file surgical fix
### Step 2.2: Code Flow Change (per hunk)
**Hunk 1 — corsairpsu_linear11_to_long():**
- **Before:** Mantissa (((s16)(val & 0x7ff)) << 5) >> 5 — sign never propagated for negative mantissas; exponent applied via bit-shift on int; returns int.
- **After:** Mantissa ((s16)((val & 0x7ff) << 5)) >> 5 — sign extension works; exponent via multiplication/division on s64; result clamped to LONG_MIN/LONG_MAX; returns long.
**Hunk 2 — corsairpsu_get_value() call sites:**
- **Before:** Calls corsairpsu_linear11_to_int() for temps, fan, PWM, watts.
- **After:** Calls corsairpsu_linear11_to_long() — same call paths, corrected return type.
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Logic/correctness fix (type promotion bug) + initialization/overflow hardening
- **Mechanism:** For LINEAR11 value 0xFFFF (mantissa -1): val & 0x7ff = 0x7FF (2047). Old code: (s16)2047 << 5 >> 5 = 2047. Fixed
code: (s16)(2047 << 5) >> 5 = (s16)0xFFE0 >> 5 = -1. Affects all LINEAR11 conversions; primary real-world impact is temperature sysfs readings at sub-zero ambient.
### Step 2.4: Fix Quality Assessment
**Record:**
- Fix is obviously correct by inspection; matches standard LINEAR11 sign-extension pattern.
- Minimal, self-contained; no API changes visible to userspace (still long hwmon values).
- **Regression risk:** Very low. Positive values unchanged; only negative mantissa paths and overflow edge cases differ.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the Changed Lines
**Record:**
- Buggy mantissa line introduced by **918f22104d64d** (Wilken Gottwalt, 2021-02-27): hwmon: (corsair-psu) Update calculation of LINEAR11 values
- Function shell from **d115b51e0e5671** (2020-10-27): original driver introduction
- Bug present since kernel ~5.12 era; definitely present in this 6.18.y tree
### Step 3.2: Follow Fixes: Tag
**Record:** No Fixes: tag present. Bug introduced by 918f22104d64d, which is an ancestor of HEAD — confirmed with git merge-base --is- ancestor.
### Step 3.3: File History for Related Changes
**Record:** Recent corsair-psu changes in this tree include UAF fix (ec477af3a7e8d), probe error handling, device ID additions. On master after v6.18.44: additional corsair-psu fixes (debugfs serialization, string termination, this linear11 fix). **Standalone** — no series dependency.
### Step 3.4: Author's Other Commits
**Record:** Guenter Roeck is hwmon subsystem maintainer. Wilken Gottwalt is the primary corsair-psu driver author (multiple commits in this file). High subsystem expertise.
### Step 3.5: Prerequisites
**Record:** No dependencies. Patch applies cleanly to current tree (git apply --check → APPLIES_CLEANLY). Fix commit c6c4234928d2e is NOT an ancestor of HEAD (fix_NOT_in_tree).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Patch Discussion
**Record:**
- **URL:**
https://patch.msgid.link/[email protected]
- **Series:** v1 (RESEND, 2026-08-03) → v2 (2026-08-03, applied version). v2 change: "Skip handling right-shift of negative values"
- **Reviewer feedback:** Sashiko AI bot: "found no issues." Wilken
Gottwalt: "Don't see any anomalies," gave Tested-by; noted he cannot simulate negative temps but PSU operating range is 0–50°C.
- **Stable nominations:** None found in thread.
- **NAKs:** None.
### Step 4.2: Who Reviewed
**Record:** CC'd to [email protected], Sashiko bot, Wilken Gottwalt (driver author). Maintainer self-submitted.
### Step 4.3: Bug Report
**Record:** No user bug report, syzbot, or KASAN report. Found via code review (Sashiko AI). Concrete failure example provided in commit message (-1 → 2047°C).
### Step 4.4: Related Patches
**Record:** Standalone 1-patch series. No other patches required.
### Step 4.5: Stable Mailing List History
**Record:** Not searched separately; no stable nomination in the patch thread.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** corsairpsu_linear11_to_long() (was _to_int), called from corsairpsu_get_value().
### Step 5.2: Trace Callers
**Record:** corsairpsu_get_value() called from:
- corsairpsu_get_criticals() — critical threshold reads at probe
- corsairpsu_hwmon_temp_read() — **TEMP0/TEMP1** (primary bug impact)
- corsairpsu_hwmon_fan_read(), corsairpsu_hwmon_power_read(), corsairpsu_hwmon_in_read(), corsairpsu_hwmon_curr_read()
- debugfs read paths
All ultimately reachable from userspace via sysfs hwmon reads (corsairpsu_hwmon_ops_read).
### Step 5.3: Key Callees
**Record:** corsairpsu_request() (USB HID I/O), clamp() macro. No locking changes.
### Step 5.4: Call Chain / Reachability
**Record:** Userspace reads /sys/class/hwmon/hwmonN/tempN_input → corsairpsu_hwmon_ops_read() → corsairpsu_hwmon_temp_read() → corsairpsu_get_value() → corsairpsu_linear11_to_long(). **Reachable from userspace** on systems with CONFIG_SENSORS_CORSAIR_PSU enabled and a supported Corsair PSU connected.
### Step 5.5: Similar Patterns
**Record:** Other hwmon drivers in this tree have had LINEAR11 fixes backported (e.g., pmbus/fsp-3y non-compliant linear11 vout encoding). Same class of sensor-parsing correctness bug.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does Buggy Code Exist?
**Record:** **YES.** Current tree at lines 143–149 has the exact buggy code:
```143:149:drivers/hwmon/corsair-psu.c
static int corsairpsu_linear11_to_int(const u16 val, const int scale)
{
const int exp = ((s16)val) >> 11;
const int mant = (((s16)(val & 0x7ff)) << 5) >> 5;
const int result = mant * scale;
return (exp >= 0) ? (result << exp) : (result >> -exp);
```Driver present since driver intro commit d115b51e0e5671; buggy mantissa since 918f22104d64d.
### Step 6.2: Backport Complications
**Record:** **Clean apply** — verified with git apply --check. No conflicting changes in the affected region.
### Step 6.3: Related Fixes Already Present?
**Record:** Other corsair-psu fixes are present (UAF fix ec477af3a7e8d, probe fixes), but this linear11 fix is **not** yet in v6.18.44.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** drivers/hwmon/ — **PERIPHERAL** (optional tristate module CONFIG_SENSORS_CORSAIR_PSU, Corsair PSU HID hardware only).
### Step 7.2: Subsystem Activity
**Record:** Actively maintained. Recent 6.18.y stable queue includes multiple hwmon sensor-correctness and crash fixes (adt7470, ina2xx, ltc4282, sht3x).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** **Driver-specific** — users with supported Corsair PSUs (RM/HX series with HID interface) who have CONFIG_SENSORS_CORSAIR_PSU built-in or loaded as module.
### Step 8.2: Trigger Conditions
**Record:** PSU firmware reports a negative LINEAR11 mantissa, most plausibly on temperature sensors in sub-zero ambient conditions. Unprivileged users can trigger sysfs reads but cannot inject the hardware value. **Uncommon** but realistic in cold environments; driver author notes PSU spec is 0–50°C continuous.
### Step 8.3: Failure Mode Severity
**Record:**
- **Failure mode:** Incorrect sysfs sensor readings (e.g., 2047°C instead of -1°C); could cause false monitoring alerts or fan-control script misfires if tied to PSU temps.
- **NOT:** kernel crash, oops, hang, deadlock, data corruption, or security issue.
- **Severity: MEDIUM** — real user-visible incorrect data, but no kernel instability.
### Step 8.4: Risk-Benefit Ratio
**Record:**
- **Benefit:** Correct temperature/voltage/power readings for affected hardware; eliminates absurd 2047°C values.
- **Risk:** Very low — 23-line change, maintainer-authored, tested, clean apply.
- **Ratio:** Moderate benefit, very low risk. Appropriate for 6.18.y where the driver and bug both exist.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, reproducible parsing bug with concrete example (-1 → 2047°C)
- Bug present in this tree since 2021
- Fix from hwmon maintainer (Guenter Roeck), Tested-by from driver author
- Small (23 lines), single file, applies cleanly
- Precedent: similar hwmon sensor-reading correctness fixes already in 6.18.y stable queue
- Fixes undefined behavior (left-shift of negative values)
**AGAINST backport:**
- Niche optional driver; small user population
- No crash/corruption/security impact
- Trigger requires sub-zero ambient (edge case per driver author)
- Reported-by is AI review bot, not a user bug report
- Does not meet the strongest stable signals (oops, UAF, syzbot)
**Unresolved:** No independent user reports of the 2047°C symptom found.
### Step 9.2: Stable Rules Checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — clear C promotion fix; Tested-by from driver author | | 2. Fixes a real bug affecting users? | **PASS** — wrong sysfs sensor values for Corsair PSU users | | 3. Important issue? | **PASS (borderline)** — "oh, that's not good" per stable-kernel-rules.rst; not crash-level but clearly wrong monitoring data | | 4. Small and contained? | **PASS** — 23 lines, 1 file | | 5. No new features/APIs? | **PASS** — bug fix only | | 6. Can apply to local tree? | **PASS** — verified clean apply |
### Step 9.3: Exception Categories
**Record:** None (not device ID, quirk, DT, build fix, or docs fix). Qualifies as a hardware-monitoring correctness bug fix.
### Step 9.4: Decision Rationale
For **linux-6.18.y at v6.18.44**: the corsair-psu driver and the buggy LINEAR11 code are both present. The fix is maintainer-quality, tested, minimal, and applies cleanly. While the impact is limited to a niche driver and cold-ambient edge cases (wrong sysfs readings, not kernel crashes), stable-kernel-rules explicitly include fixes for real bugs that bother users and "oh, that's not good" issues. This tree already backports similar hwmon sensor-correctness fixes. The risk of regression is negligible.
---
## Verification
- **[Phase 1]** Parsed commit message tags from git show c6c4234928d2e
- **[Phase 2]** Diff analysis: 23 lines changed in drivers/hwmon/corsair-psu.c; verified buggy mantissa at lines 143–149
- **[Phase 3]** git blame: buggy line from 918f22104d64d (2021-02-27); driver from d115b51e0e5671 (2020-10-27)
- **[Phase 3]** git merge-base --is-ancestor: driver and buggy code both in tree; fix commit NOT in tree
- **[Phase 3]** git log --oneline -20 -- drivers/hwmon/corsair-psu.c:
history reviewed
- **[Phase 4]** b4 dig -c c6c4234928d2e: found v1→v2 series at lore URL above
- **[Phase 4]** b4 dig -c c6c4234928d2e -w: CC'd linux-hwmon, Sashiko, Wilken Gottwalt
- **[Phase 4]** b4 dig -m /tmp/corsair_linear11.mbox: read thread; Tested-by from Wilken; no stable nomination; no NAKs
- **[Phase 5]** grep corsairpsu_get_value: traced callers to hwmon sysfs read path
- **[Phase 6]** git describe HEAD: v6.18.44
- **[Phase 6]** git apply --check: patch applies cleanly
- **[Phase 6]** Read current corsairpsu_linear11_to_int() — buggy code confirmed present
- **[Phase 7]** CONFIG_SENSORS_CORSAIR_PSU in drivers/hwmon/Kconfig — tristate optional module
- **[Phase 8]** Assessed severity as MEDIUM (wrong sysfs data, no kernel crash)
---
**YES**The background lookups are done and match what the analysis already used:
- **b4 dig** found the patch thread: [PATCH v2] hwmon: (corsair-psu) Fix linear11 calculation (v1 → v2, Tested-by from Wilken Gottwalt).
- **git log --grep="Fix linear11"** hung and was stopped; the fix was already located on master as c6c4234928d2e.
- **git log --grep="linear11"** returned unrelated hwmon LINEAR11 commits in other drivers (pmbus/fsp-3y, etc.), not this corsair-psu fix.
Nothing else is needed from those tasks. The backport recommendation for **linux-6.18.y (v6.18.44)** remains **YES** — small maintainer fix for wrong sub-zero temperature readings, applies cleanly, and the buggy code is present in this tree.
drivers/hwmon/corsair-psu.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/hwmon/corsair-psu.c +14 -9
@@ -140,13 +140,18 @@ struct corsairpsu_data { };/* some values are SMBus LINEAR11 data which need a conversion */ -static int corsairpsu_linear11_to_int (const u16 val,const int scale) +static long corsairpsu_linear11_to_long (const u16 val,const int scale) {const int exp = ((s16 )val) >>11 ; -const int mant = (((s16)(val &0x7ff )) <<5 ) >>5 ; -const int result = mant * scale; +const int mant = ((s16)((val &0x7ff ) <<5 )) >>5 ; +s64 result = mant * scale; -return (exp >=0 ) ? (result << exp) : (result >> -exp); +if (exp >=0 ) + result *= (int )(1UL << exp); +else + result >>= -exp; + +return clamp (result,LONG_MIN ,LONG_MAX ); }/* the micro-controller uses percentage values to control pwm */
@@ -271,13 +276,13 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, lcase PSU_CMD_RAIL_AMPS :case PSU_CMD_TEMP0 :case PSU_CMD_TEMP1 : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1000 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1000 );break ;case PSU_CMD_FAN : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 );break ;case PSU_CMD_FAN_PWM_ENABLE : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 );/* * 0 = automatic mode, means the micro-controller controls the fan using a plan * which can be modified, but changing this plan is not supported by this
@@ -291,12 +296,12 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, l *val =2 ;break ;case PSU_CMD_FAN_PWM : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 ); *val =corsairpsu_dutycycle_to_pwm (*val);break ;case PSU_CMD_RAIL_WATTS :case PSU_CMD_TOTAL_WATTS : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1000000 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1000000 );break ;case PSU_CMD_TOTAL_UPTIME :case PSU_CMD_UPTIME :
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.6] hwmon: (corsair-psu) Fix linear11 calculation
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 14 lines
From: Guenter Roeck <[email protected]>
[ Upstream commit
c6c4234928d2eb4f61fecb61067e612d9bdbd2ff]In
corsairpsu_linear11_to_int(), the mantissa is extracted using bitwise operations and cast to s16 before being shifted left:static int
corsairpsu_linear11_to_int(const u16 val, const int scale){ ... const int mant = (((s16)(val & 0x7ff)) << 5) >> 5; ... }
Quoted 7 lines
Due to C integer promotion rules, the masked value (which is always
[ ... ]Signed-off-by Guenter Roeck <[email protected]>Tested-by Wilken Gottwalt <[email protected]>Signed-off-by Guenter Roeck <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 jfs: handle set_blocksize failures
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 05107f5602751fcfd3d108c1f579eb45aabead52 ]
jfs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [jfs] [handle] — Handle sb_set_blocksize() failures during JFS mount.
**Step 1.2 — Tags**
Record:
- **Signed-off-by:** Christoph Hellwig <[email protected]> (author)
- **Signed-off-by:** Christian Brauner (Amutable) <[email protected]> (merger)
- **Link:** https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Cc: stable
- Part of series **"[PATCH 04/10] jfs: handle set_blocksize failures"** in *"fix crashes when mounting legacy file system with sector size > PAGE_SIZE"*
**Step 1.3 — Body analysis**
Record:
- **Bug:** JFS ignores sb_set_blocksize(sb, PSIZE) failure and continues mounting.
- **Symptom:** Kernel BUG_ON(offset >= folio_size(folio)) in folio_set_bh() on the first __bread_gfp() call during mount.
- **Root cause:** JFS uses buffer_heads, which do not handle block sizes
Quoted 1 line
PAGE_SIZE. Whensb_set_blocksize()fails (e.g. device logical
block size is 64K and JFS tries to set 4K), sb->s_blocksize stays at the device size from setup_bdev_super(). Mount proceeds and buffer allocation crashes.
- **Trigger context (cover letter):** Mount/probe on a 64K-sector loop device with JFS built-in.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Despite the neutral "handle" wording, this is a real crash fix, not cleanup. Same pattern as ext4, UFS, minix, etc.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** fs/jfs/super.c (+2 / −1)
- **Function:** jfs_fill_super()
- **Scope:** Single-file, surgical (3-line hunk)
**Step 2.2 — Code flow change**
Record:
- **Before:** sb_set_blocksize(sb, PSIZE); — return value ignored; mount continues on failure.
- **After:** if (!sb_set_blocksize(sb, PSIZE)) goto out_unload; — failed blocksize setup aborts mount via existing cleanup path.
- **Path affected:** Mount initialization, before jfs_mount() → readSuper() → sb_bread().
**Step 2.3 — Bug mechanism**
Record: **Logic / error-path fix.** Category: missing error handling leading to **kernel BUG**.
- sb_set_blocksize() returns 0 on failure (block/bdev.c:220-229).
- On failure, sb->s_blocksize is not updated to PSIZE (4096).
- sb_bread() uses sb->s_blocksize (include/linux/buffer_head.h:346).
- Buffer allocation reaches folio_set_bh() with invalid offset vs folio size → BUG_ON (fs/buffer.c:1582).
**Step 2.4 — Fix quality**
Record: **Obviously correct.** Matches ext4/ufs/minix pattern. Minimal risk; out_unload already exists and returns ret = -EINVAL. No new locks or APIs.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Unchecked sb_set_blocksize(sb, PSIZE) dates to initial JFS import (1da177e4c3f4, 2005). Bug has been present for the lifetime of JFS in-tree.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related file history**
Record: Recent fs/jfs/super.c changes are mount-API and cleanup only; none address this. Mainline merge d90e60ced4c3c ("fix crashes when mounting legacy file system with sector size > PAGE_SIZE") contains this fix but is **not** an ancestor of this tree's HEAD.
**Step 3.4 — Author context**
Record: Christoph Hellwig — senior VFS/filesystem developer. Series merged by VFS maintainer Christian Brauner. Jan Kara reviewed sibling patches in the series.
**Step 3.5 — Dependencies**
Record: **Standalone.** Patch 4/10 is independent per filesystem. No prerequisite commits required for the JFS hunk. Applies cleanly to current fs/jfs/super.c at line 494.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: Series cover at https://ratatoskr.run/linux-
fsdevel/2026/05/8994157. JFS patch at https://ratatoskr.run/linux-
fsdevel/2026/05/8994161 / spinics msg338004. b4 dig -c could not be used (commit not in this tree). lore.kernel.org blocked by bot protection.
**Step 4.2 — Reviewers**
Record: Christian Brauner merged the series. Jan Kara reviewed minix/isofs/bfs patches. David Sterba reviewed affs. No NAKs found.
**Step 4.3 — Bug report**
Record: Author-reproduced crash during FS probe on 64K loop device. No syzbot report. Real, reproducible trigger described in cover letter.
**Step 4.4 — Series context**
Record: 10-patch series, one filesystem each. JFS patch is self- contained; other patches not required for this fix.
**Step 4.5 — Stable list**
Record: No stable-list discussion found. Not a negative signal per instructions.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: jfs_fill_super(), sb_set_blocksize(), jfs_mount() → readSuper() → sb_bread() → __bread_gfp() → bdev_getblk() → grow_buffers() → folio_alloc_buffers() → folio_set_bh().
**Step 5.2 — Callers**
Record: jfs_fill_super() called from get_tree_bdev() (fs/jfs/super.c:635) during mount(2) or filesystem probe. Reachable from userspace.
**Step 5.3 — Callees**
Record: sb_set_blocksize() → set_blocksize() → bdev_validate_blocksize(). Fails when requested size < device logical block size.
**Step 5.4 — Call chain / reachability**
Record: mount/fsopen → jfs_get_tree → get_tree_bdev → setup_bdev_super (sets device blocksize) → jfs_fill_super → jfs_mount → sb_bread. **Userspace-reachable** when CONFIG_JFS_FS is enabled (built-in or module).
**Step 5.5 — Similar patterns**
Record: ext4 (fs/ext4/super.c:5128), ufs (fs/ufs/super.c:927), minix, romfs, ocfs2, f2fs all check sb_set_blocksize() return value. JFS was an outlier.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Current tree at fs/jfs/super.c:494 has unchecked sb_set_blocksize(sb, PSIZE);. folio_set_bh() BUG_ON present since 465e5e6a1698f (in this tree). sb_set_blocksize() failure semantics unchanged in block/bdev.c:220-229.
**Step 6.2 — Backport complications**
Record: **Clean apply expected.** Only the 3-line hunk at line 494; no conflicts with recent stable changes in this file.
**Step 6.3 — Related fixes already present?**
Record: **No.** git merge-base --is-ancestor d90e60ced4c3c HEAD → not ancestor. Sibling fixes in hpfs/bfs also absent. Fix not yet in 6.18.y.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: **fs/jfs** — legacy filesystem driver. Criticality:
**IMPORTANT** (not core VFS, but mount path can kernel-BUG the system).
**Step 7.2 — Activity**
Record: Low churn; mature driver. Bug is long-standing, exposed when large-sector devices are probed.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users with CONFIG_JFS_FS enabled (built-in or module) mounting or probing JFS on block devices whose logical sector size prevents setting 4K (e.g. 64K sectors).
**Step 8.2 — Trigger conditions**
Record: Mount or auto-probe of JFS on device with sector size > PAGE_SIZE or where sb_set_blocksize(4096) fails. Unprivileged users can trigger via mount if permitted, or during blkid/probe workflows. Not extremely common hardware, but loop devices and some storage make it realistic.
**Step 8.3 — Failure mode severity**
Record: **Kernel BUG()** — system crash/oops. Severity: **CRITICAL**.
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** HIGH — prevents kernel crash; graceful mount failure with -EINVAL.
- **Risk:** VERY LOW — 2 lines, established pattern, existing cleanup path.
- **Ratio:** Strongly favors backport.
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Real, author-verified kernel BUG on mount/probe
- Long-standing bug in widely shipped legacy FS
- Surgical 2-line fix, obviously correct
- Matches pattern already used by ext4, ufs, etc. in this tree
- Merged to mainline by VFS maintainer
- Buggy code confirmed present in v6.18.44
- Clean apply, no dependencies
**Evidence AGAINST:**
- JFS is a legacy/rare filesystem → lower population
- Trigger requires specific block-device geometry
- None of these outweigh a kernel BUG fix
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** (mainline merged; author tested crash scenario)
2. Fixes real user-affecting bug? **PASS**
3. Important issue? **PASS** (kernel BUG / crash)
4. Small and contained? **PASS** (3 lines, 1 file)
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS**
**Exception category:** N/A (standard bug fix, not device- ID/quirk/build/doc).
---
## Problem Summary for Stable Users
When JFS mount calls sb_set_blocksize(sb, 4096) on a device whose logical sector size is larger (e.g. 64K loop device), the call fails silently. Mount continues with the device's block size. The first sb_bread() during jfs_mount() hits BUG_ON(offset >= folio_size(folio)) in folio_set_bh(), crashing the kernel. The fix checks the return value and aborts mount through the existing out_unload path, returning -EINVAL instead of crashing.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body; identified series context via ratatoskr/spinics
- **[Phase 2]** Diff: 3-line error-check in jfs_fill_super(); classified as missing error handling → BUG
- **[Phase 3]** git blame: unchecked call since 2005 (1da177e4c3f4)
- **[Phase 3]** git merge-base --is-ancestor d90e60ced4c3c HEAD → not ancestor (fix absent from 6.18.y)
- **[Phase 3]** git show d90e60ced4c3c:fs/jfs/super.c → confirms mainline has the fix
- **[Phase 3]** git diff d90e60ced4c3c -- fs/jfs/super.c → only relevant hunk is the sb_set_blocksize check
- **[Phase 4]** Series cover and patch content from ratatoskr.run; Christian Brauner merge confirmed
- **[Phase 4]** lore.kernel.org / patch.msgid.link blocked; b4 dig unusable without commit in tree
- **[Phase 5]** Traced call chain: jfs_fill_super → jfs_mount → readSuper → sb_bread → __bread_gfp
- **[Phase 5]** Read sb_set_blocksize() at block/bdev.c:220-229 (returns 0 on failure)
- **[Phase 5]** Read folio_set_bh() BUG_ON at fs/buffer.c:1582
- **[Phase 5]** Read sb_bread macro at include/linux/buffer_head.h:344-346
- **[Phase 5]** Compared ext4 pattern at fs/ext4/super.c:5128
- **[Phase 6]** git describe HEAD → v6.18.44; buggy code at fs/jfs/super.c:494
- **[Phase 6]** folio_set_bh ancestor check: 465e5e6a1698f is in tree
- **[Phase 6]** hpfs/bfs sibling fixes also absent (confirming series not backported)
- **[Phase 8]** Failure mode: kernel BUG; severity CRITICAL
**YES**The background checks confirmed what the analysis relied on:
- **Grep for related commits** in this tree’s history returned nothing — the “handle set_blocksize failures” fix isn’t already in 6.18.y.
- **Merge commit d90e60c** (the mainline series that includes this JFS patch) exists in the repo but is **not an ancestor of HEAD** (v6.18.44). Mainline has the fix; this stable tree still has the unchecked sb_set_blocksize(sb, PSIZE) at fs/jfs/super.c:494.
That supports the **YES** backport recommendation: the bug is present here, the fix is small and self-contained, and it should apply cleanly.
fs/jfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/super.c +2 -1
@@ -491,7 +491,8 @@ static int jfs_fill_super(struct super_block *sb, struct fs_context *fc)/* * Initialize blocksize to 4K. */ -sb_set_blocksize (sb,PSIZE ); +if (!sb_set_blocksize (sb,PSIZE )) + goto out_unload;/* * Set method vectors.
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 spi: core: Abort active target transfer on controller suspend
In reply to Sasha LevinFrom: Praveen Talari <[email protected]>
[ Upstream commit c1bab046d4786c5b17aab7c5225bf0d4a2a2d19b ]
When an SPI controller operating in target mode has a transfer in progress at the time of system suspend, the suspend path proceeds without aborting the ongoing transfer. This can leave the hardware in an inconsistent state, potentially causing the system to hang or fail to resume cleanly.
Fix this by invoking the controller's target_abort callback from spi_controller_suspend() when the controller is in target mode and the callback is registered. This ensures any active target transfer is cleanly terminated before the controller is suspended.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [spi: core] [Abort] — abort active target transfer on controller suspend during system suspend.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Praveen Talari <[email protected]> (author)
- `Link: https://patch.msgid.link/20260625-
abort_active_transfer_duirng_s2r-v2-1-1d6f724406b6@oss.qualcomm.com`
- Signed-off-by: Mark Brown <[email protected]> (SPI maintainer)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or syzbot tags
- Notable: maintainer sign-off; v2 series (cur_msg check added after review)
**Step 1.3 — Body analysis**
Record:
- **Bug:** SPI controller in target (slave) mode with an in-progress transfer at system suspend is not aborted.
- **Symptom:** Hardware left inconsistent; system may hang or fail to resume cleanly (S2R).
- **Root cause:** spi_controller_suspend() proceeds without terminating the active transfer.
- **Fix:** Call the driver's existing target_abort callback from spi_controller_suspend() when appropriate.
**Step 1.4 — Hidden bug fix?**
Record: No — this is an explicit suspend/resume stability fix, not disguised cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- drivers/spi/spi.c: +3 lines, 0 removed
- Function modified: spi_controller_suspend()
- Scope: single-file, surgical fix
**Step 2.2 — Code flow change**
Record:
- **Before:** Suspend path stops queued controllers and marks suspended; active target transfers are untouched.
- **After:** If cur_msg is set, controller is in target mode, and target_abort is registered, abort is invoked first, then existing suspend logic runs.
- **Path affected:** System suspend → driver PM suspend → spi_controller_suspend().
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Logic/correctness — missing cleanup on suspend path.
- **Mechanism:** Target-mode transfers can be mid-flight when suspend runs. Without target_abort, hardware/DMA state is not torn down, causing hang or broken resume.
**Step 2.4 — Fix quality**
Record:
- Fix is minimal and mirrors existing spi_target_abort() logic.
- cur_msg guard prevents calling drivers (e.g. pxa2xx) that assume an active message and dereference cur_msg unconditionally.
- Low regression risk: gated on cur_msg, spi_controller_is_target(), and target_abort; host-mode controllers unaffected.
- No new APIs or behavior changes for non-target controllers.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- spi_controller_suspend() dates to 2012 (Linus Walleij); queue-stop logic from 2023 (Mark Hasemeyer, bef4a48f4ef79).
- Bug is longstanding: target mode existed since 2017 (6c364062bfed3); target_abort since 2022 (b8d3b056a78dc).
- Gap: suspend path never wired up target_abort.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related changes**
Record:
- bef4a48f4ef79 ("spi: Fix null dereference on suspend") fixed a related host-mode suspend race; was Cc: [email protected].
- Standalone 1/1 patch; v2 is the final version after maintainer feedback.
**Step 3.4 — Author context**
Record: Praveen Talari — Qualcomm SPI contributor (GENI QuPv3 target mode, d7f74cc31a89a). Mark Brown is SPI subsystem maintainer.
**Step 3.5 — Dependencies**
Record: No series dependencies. Requires target_abort, spi_controller_is_target(), and cur_msg — all present in this tree. git apply --check on the patch succeeds.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- b4 dig -c c1bab046d478: https://patch.msgid.link/20260625-
abort_active_transfer_duirng_s2r-v2-1-1d6f724406b6@oss.qualcomm.com
- Series: v1 → v2; committed version is v2 (latest).
**Step 4.2 — Reviewers**
Record (b4 dig -w): Mark Brown, bjorn.andersson, Konrad Dybcio, linux- arm-msm, linux-spi, linux-kernel CC'd.
**Step 4.3 — Bug report**
Record: No formal bugzilla/syzbot report. Qualcomm-internal S2R testing implied by change-id and author affiliation. Mark Brown review comment documents concrete NULL-deref risk in pxa2xx without cur_msg check.
**Step 4.4 — Related patches**
Record: Standalone; no other patches required.
**Step 4.5 — Stable list**
Record: No stable-list discussion found. Absence of Cc: stable is expected for manual review.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: spi_controller_suspend() (modified); ctlr->target_abort() (callee).
**Step 5.2 — Callers**
Record: spi_controller_suspend() called from many SPI driver suspend handlers (e.g. spi-slave-mt27xx.c, spi-rockchip.c, spi-pxa2xx.c, spi-omap2-mcspi.c, etc.) during system suspend.
**Step 5.3 — Callees**
Record: target_abort implemented in 13 drivers (imx, rockchip, pxa2xx, omap2-mcspi, fsl-dspi, fsl-lpspi, stm32, cadence, etc.). Example pxa2xx path calls int_error_stop() which sets cur_msg->status and finalizes the transfer.
**Step 5.4 — Reachability**
Record: Triggered during system suspend (S2R) on platforms with CONFIG_SPI_SLAVE and a target-capable controller with an active transfer. Common on embedded/ARM (Qualcomm MSM). Requires suspend capability, not arbitrary userspace.
**Step 5.5 — Similar patterns**
Record: spi_target_abort() already exposes the same callback for protocol drivers (spidev, spi-slave-time, spi-slave-system- control). Suspend path was the missing caller.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
Record:
- Local tree: **v6.18.44** (git describe HEAD → v6.18.44-1-g2736c32da98b9).
- spi_controller_suspend() at line 3496 lacks the abort call — bug present.
- Fix commit c1bab046d478 exists in repo but is **not** an ancestor of HEAD.
**Step 6.2 — Backport complications**
Record: git apply --check passes cleanly. Expected apply: clean.
**Step 6.3 — Related fixes already present?**
Record: bef4a48f4ef79 (host-mode suspend NULL deref) is in tree. No duplicate fix for target-mode abort.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: drivers/spi — SPI core. Criticality: **IMPORTANT** (core driver infrastructure; affects all SPI target controllers on suspend).
**Step 7.2 — Activity**
Record: SPI subsystem actively maintained; target-mode support expanded across multiple drivers since 6.12.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Systems with CONFIG_SPI_SLAVE and SPI controllers operating in target mode with target_abort registered (13 drivers in tree). Qualcomm ARM platforms are a primary audience.
**Step 8.2 — Trigger conditions**
Record: System suspend while an SPI target transfer is in progress (ctlr->cur_msg set). Timing-dependent but realistic on always-on slave interfaces. Not unprivileged-userspace triggered; PM-initiated.
**Step 8.3 — Failure mode severity**
Record: System hang or failed resume → **CRITICAL** for affected platforms.
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** HIGH for SPI-target embedded/mobile users — prevents S2R hangs.
- **Risk:** VERY LOW — 3 lines, triple-gated, maintainer-reviewed, uses existing callback.
- **Ratio:** Strong benefit, minimal risk.
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
**FOR backport:**
- Fixes real suspend/resume hang on SPI target hardware
- Small (3 lines), surgical, applies cleanly to v6.18.44
- SPI maintainer reviewed and applied (v2 with cur_msg guard)
- All prerequisites (target_abort, spi_controller_is_target, cur_msg) present since before 6.18
- Same class of issue as bef4a48f4ef79, which was stable material
- 13 drivers already implement target_abort and benefit immediately
**AGAINST backport:**
- Only affects CONFIG_SPI_SLAVE configurations (narrower than core MM/net)
- No syzbot/CVE report
- No explicit Cc: stable tag (expected for manual review)
**Unresolved:** No public crash log; impact inferred from maintainer review and Qualcomm S2R context.
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — logic is straightforward; maintainer reviewed; v2 addresses NULL-deref concern.
2. Fixes a real bug? **PASS** — suspend without abort leaves hardware inconsistent.
3. Important issue? **PASS** — hang / failed resume (CRITICAL for affected users).
4. Small and contained? **PASS** — 3 lines, one function.
5. No new features or APIs? **PASS** — uses existing target_abort callback.
6. Can apply to local tree? **PASS** — verified with git apply --check.
**Step 9.3 — Exception categories**
Record: N/A (not device ID, quirk, DT, build, or docs — standard bug fix).
**Step 9.4 — Decision rationale**
This is a conservative, maintainer-reviewed fix for a suspend/resume hang affecting SPI target controllers. The bug exists in v6.18.44, the patch applies cleanly, and the failure mode (system hang on suspend) meets stable criteria. The CONFIG_SPI_SLAVE scope limits breadth but not importance for affected embedded and mobile platforms.
---
## Verification
- [Phase 1] Parsed subject, tags, body; no syzbot/Fixes/Cc:stable tags
- [Phase 2] Diff: +3 lines in spi_controller_suspend(); verified pxa2xx int_error_stop() uses cur_msg unconditionally (line 619)
- [Phase 3] git describe HEAD: v6.18.44; git blame on suspend function; b8d3b056a78dc (target helpers) and bef4a48f4ef79 (prior suspend fix) are ancestors
- [Phase 3] c1bab046d478 NOT in HEAD history; bug present in current spi_controller_suspend()
- [Phase 4] b4 dig -c c1bab046d478: lore URL found; v1→v2 series; Mark Brown applied patch
- [Phase 4] b4 dig -w: Mark Brown, linux-spi, linux-arm-msm CC'd
- [Phase 4] openwall mirror: Mark Brown required cur_msg check for pxa2xx safety
- [Phase 5] grep target_abort: 13 drivers register callback; spi_target_abort() exists at spi.c:2930
- [Phase 5] grep spi_controller_suspend: many driver suspend paths call it
- [Phase 6] git apply --check on patch: **clean apply**
- [Phase 6] Current spi_controller_suspend() at lines 3496–3508 lacks abort logic
- [Phase 8] Failure mode: hang/failed resume; severity CRITICAL for SPI- target + S2R scenarios
**YES**
drivers/spi/spi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi.c +3 -0
@@ -3501,6 +3501,9 @@ int spi_controller_suspend(struct spi_controller *ctlr) {int ret =0 ; +if (ctlr->cur_msg &&spi_controller_is_target (ctlr) && ctlr->target_abort) + ctlr->target_abort (ctlr); +/* Basically no-ops for non-queued controllers */ if (ctlr->queued) { ret =spi_stop_queue (ctlr);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 dmaengine: altera-msgdma: Use memcpy_toio for descriptor FIFO writes
In reply to Sasha LevinFrom: Adrian Ng Ho Yin <[email protected]>
[ Upstream commit 94963138cce29f85605d76c94fa1d43a0335ead9 ]
The descriptor FIFO requires that all words of a descriptor are written in order, with the control word written last to flush it into the DMA engine. Using memcpy() with __force to __iomem is not the correct API and does not guarantee appropriate MMIO access on all architectures.
Replace the descriptor body copy with memcpy_toio(), using offsetof(struct msgdma_extended_desc, control) to exclude the control word. This matches the previous sizeof(desc->hw_desc) - sizeof(u32) length only when control is the last struct member; add a static_assert to enforce that layout so a future field after control cannot silently break FIFO ordering.
Keep writing the control word separately with write barriers, so it remains the final word pushed into the FIFO.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 – Subject line**
Record: [dmaengine: altera-msgdma] [Use] Use memcpy_toio for descriptor FIFO writes — subsystem is Altera mSGDMA DMAengine driver; action is replacing incorrect MMIO copy API.
**Step 1.2 – Tags**
Record:
- **Fixes:** none
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by / Acked-by:** none
- **Link:** https://patch.msgid.link/f6f3b4a2e2eb0eb1a51976de3f5d1ef5bab
[email protected]
- **Signed-off-by:** Adrian Ng Ho Yin, Tze Yee Ng, Vinod Koul (maintainer)
- **Cc: [email protected]:** absent (expected for manual review)
- Notable: no syzbot, no user bug report, no crash trace
**Step 1.3 – Body analysis**
Record:
- **Bug:** Descriptor FIFO hardware requires ordered 32-bit word writes; control word must be written last to flush the descriptor. Using memcpy() with __force cast to __iomem is not the correct MMIO API and does not guarantee proper access on all architectures.
- **Symptom:** Malformed or partially written descriptors can cause DMA to wrong addresses, transfer failures, or silent data corruption.
- **Root cause:** Body of descriptor copied via plain memcpy() to MMIO instead of memcpy_toio().
- **Version info:** none in message
**Step 1.4 – Hidden bug fix?**
Record: **Yes.** Although framed as an API correction, it fixes a real hardware-interaction bug. The pre-existing comment in the driver already acknowledged uncertainty about memcpy() write ordering; this commit completes that fix by using the proper MMIO helper.
---
## Phase 2: Diff Analysis
**Step 2.1 – Inventory**
Record:
- **File:** drivers/dma/altera-msgdma.c (+15 / −9, 24 lines touched)
- **Function modified:** msgdma_copy_one() only
- **Scope:** single-file, surgical fix
**Step 2.2 – Code flow change**
Record:
- **Hunk 1 (before FIFO wait):** adds duplicate static_assert verifying control is the last struct member.
- **Hunk 2 (before body copy):** adds second identical static_assert (copy-paste error acknowledged by author on list).
- **Hunk 3 (body copy):** memcpy((void __force *)hw_desc, ...) → memcpy_toio(hw_desc, ..., offsetof(..., control)); control word still written separately via iowrite32() + wmb().
- **Path affected:** every descriptor submission to hardware FIFO (normal DMA operation path).
**Step 2.3 – Bug mechanism**
Record: **Memory safety / MMIO correctness fix.** Category: incorrect MMIO access pattern. Plain memcpy() to __iomem may use CPU memory copy optimizations (reordering, non-MMIO stores) that do not satisfy hardware FIFO ordering requirements. memcpy_toio() uses architecture- appropriate MMIO store sequences.
**Step 2.4 – Fix quality**
Record: Fix is logically correct and minimal. Regression risk is very low — it replaces one copy primitive with the documented equivalent. Minor quality blemish: duplicate static_assert blocks (author agreed to fix in v3, but v2 was merged as-is). Pre-existing concerns (BE endianness mix of memcpy_toio + iowrite32, mdelay() while holding spinlock) are unchanged by this patch.
---
## Phase 3: Git History Investigation
**Step 3.1 – Blame**
Record: Buggy memcpy() path introduced in 6084fc2ec478d (Aug 2017, Stefan Roese, "Use macros instead of structs..."). Original driver added in a85c6f1b2921c (Jul 2017). Bug has been present ~9 years.
**Step 3.2 – Fixes: tag**
Record: N/A — no Fixes: tag present.
**Step 3.3 – Related file history**
Record: Recent stable-tree changes to this file include descriptor free/cleanup fixes (54e4ada1a4206, d3ddfab0969b1), spinlock IRQ variant fix (261d3a85d9598). No related fix for MMIO copy already present. Standalone patch (v2 of 1-patch series).
**Step 3.4 – Author context**
Record: Authors are Altera/Intel engineers (hardware vendor). Vinod Koul (dmaengine maintainer) applied the patch. Authors are not regular altera-msgdma maintainers but submitted from hardware expertise.
**Step 3.5 – Dependencies**
Record: No prerequisites. Uses memcpy_toio() and static_assert, both available in Linux 6.18. Applies cleanly (git apply --check passed).
---
## Phase 4: Mailing List and External Research
**Step 4.1 – Original discussion**
Record:
- **URL:** https://patch.msgid.link/f6f3b4a2e2eb0eb1a51976de3f5d1ef5bab9
[email protected]
- **Series:** v2 only (v1 not in thread); committed version matches v2
- **Maintainer response:** Vinod Koul — "Applied, thanks!"
- **No stable nomination** from reviewers
- **No NAKs** from human reviewers
**Step 4.2 – Reviewers**
Record: CC'd: Olivier Dautricourt, Stefan Roese (original driver author), Vinod Koul, Frank Li, dmaengine@, linux-kernel@. Appropriate maintainers included.
**Step 4.3 – Bug report**
Record: No external bug report. Sashiko AI review flagged duplicate static_assert (Low) and pre-existing MMIO/endianness/spinlock+mdelay issues (High, pre-existing). Author Tze Yee Ng agreed duplicate assert was copy-paste error; offered v3 with single assert and optional iowrite32() loop if Frank Li preferred. Frank Li asked author to review Sashiko comments; no further human NAK before merge.
**Step 4.4 – Related patches**
Record: Standalone. Author indicated FIFO polling and stricter MMIO access could be separate follow-ups.
**Step 4.5 – Stable list history**
Record: Not searched separately; no stable nomination found in patch thread.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 – Key functions**
Record: msgdma_copy_one() modified; callers unchanged.
**Step 5.2 – Callers**
Record:
- msgdma_copy_desc_to_fifo() → called from msgdma_start_transfer()
- msgdma_start_transfer() called from:
- msgdma_issue_pending() (under spin_lock_irqsave)
- msgdma_irq_handler() (under spin_lock)
- Reachable on every DMA transfer submission and from IRQ when controller becomes idle.
**Step 5.3 – Callees**
Record: ioread32() (FIFO full check), mdelay(1) (wait loop), memcpy_toio() (new), wmb(), iowrite32() (control word flush).
**Step 5.4 – Reachability**
Record: Triggered whenever userspace/kernel submits DMA operations through the dmaengine API on Altera mSGDMA hardware (CONFIG_ALTERA_MSGDMA). Common operational path, not init-only or error-only.
**Step 5.5 – Similar patterns**
Record: Other dma drivers use memcpy_toio() for MMIO (e.g., edma). The forced memcpy() to __iomem pattern is explicitly discouraged in kernel MMIO documentation.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 – Buggy code in this tree?**
Record: **Yes.** Local tree is **Linux 6.18.44** (git describe HEAD → v6.18.44). Buggy memcpy((void __force *)hw_desc, ...) present at lines 518–519 of drivers/dma/altera-msgdma.c. Bug present since driver introduction (2017).
**Step 6.2 – Backport complications**
Record: **Clean apply** confirmed via git format-patch -1 94963138cce29 | git apply --check. No conflicting recent changes to this function in 6.18.y.
**Step 6.3 – Related fixes already present?**
Record: Commit 94963138cce29 is **not** in stable/linux-6.18.y (git merge-base --is-ancestor returned exit 1). No equivalent fix found via grep for memcpy_toio in this file.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 – Subsystem criticality**
Record: **dmaengine / Altera mSGDMA driver** — **PERIPHERAL** (niche FPGA/embedded hardware, CONFIG_ALTERA_MSGDMA). However, DMA descriptor corruption affects memory integrity for users of that hardware.
**Step 7.2 – Subsystem activity**
Record: Driver receives occasional maintenance (descriptor lifecycle, spinlock fixes in 2024–2025). Mature, low-churn code.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 – Who is affected**
Record: Users with CONFIG_ALTERA_MSGDMA on Altera/Intel FPGA platforms (PCIe-connected Cyclone and similar, ARM and x86 per original driver testing). Config-specific, platform-specific.
**Step 8.2 – Trigger conditions**
Record: Every DMA descriptor submission. Not timing-dependent race; architecture-dependent MMIO behavior. Unprivileged users can trigger via dmaengine consumers using this controller.
**Step 8.3 – Failure mode severity**
Record: Corrupted descriptor fields → DMA to/from wrong physical addresses → **data corruption** (CRITICAL for affected users). Could also cause transfer failure or hardware stall. No crash/oops required for impact.
**Step 8.4 – Risk-benefit**
Record:
- **Benefit:** Prevents potential silent memory corruption on non-x86 or strict MMIO architectures; uses correct kernel API; hardware vendor fix.
- **Risk:** Very low — 1-line functional change plus compile-time assert; applies cleanly.
- **Ratio:** Favorable for affected hardware users; limited broader impact due to niche driver.
---
## Phase 9: Final Synthesis
**Step 9.1 – Evidence summary**
**FOR backport:**
- Real MMIO correctness bug present since 2017 in this tree
- Potential DMA data corruption (critical for affected users)
- Small, obviously correct, clean-apply fix
- Hardware vendor submitted with maintainer acceptance
- Original driver comment acknowledged memcpy ordering uncertainty
- Commit not yet in 6.18.y
**AGAINST backport:**
- No user bug report, crash, or syzbot finding
- Very niche driver (FPGA embedded)
- Driver has functioned with workaround since 2017 without reported failures
- Duplicate static_assert in merged code (cosmetic)
- Does not address all MMIO concerns raised in AI review (pre-existing)
- No explicit stable nomination
**Unresolved:** No verified report of the bug manifesting in production; impact inferred from API semantics and hardware requirements.
**Step 9.2 – Stable rules checklist**
1. Obviously correct and tested? **PASS** — API fix is standard; no runtime Tested-by, but logically sound.
2. Fixes a real bug affecting users? **PASS** — incorrect MMIO access on descriptor submission path.
3. Important issue? **PASS** — potential DMA data corruption.
4. Small and contained? **PASS** — 1 file, ~24 lines.
5. No new features/APIs? **PASS** — behavior correction only.
6. Can apply to local tree? **PASS** — clean apply verified.
**Step 9.3 – Exception categories**
Record: Not a device ID, quirk, DT, build, or docs fix. Standard driver correctness bug fix.
**Step 9.4 – Decision rationale**
For Linux 6.18.y, the buggy code exists, the fix applies cleanly, and the failure mode (DMA writing to wrong memory) is serious for the Altera mSGDMA users this driver serves. While the driver is niche and lacks a field bug report, the original code explicitly doubted memcpy() ordering, the hardware vendor corrected the MMIO access pattern, and the patch is minimal with negligible regression risk. Stable trees routinely accept such hardware-interaction fixes when data corruption is the consequence.
---
## Verification
- [Phase 1] Parsed commit 94963138cce29 on master; tags: Link, SOBs only; no Reported-by/syzbot
- [Phase 2] Diff: 1 file, msgdma_copy_one() only; memcpy → memcpy_toio; duplicate static_assert confirmed in git show 94963138cce29
- [Phase 3] git blame: buggy memcpy from 6084fc2ec478d (2017); driver from a85c6f1b2921c (2017)
- [Phase 3] git log -20 -- drivers/dma/altera-msgdma.c: no prior MMIO fix
- [Phase 3] git format-patch -1 94963138cce29 | git apply --check:
clean apply
- [Phase 4] b4 dig -c 94963138cce29: lore URL found; v2 series
- [Phase 4] b4 dig -c 94963138cce29 -w: Vinod Koul, Frank Li, Stefan Roese CC'd
- [Phase 4] b4 dig -m /tmp/altera-msgdma.mbx: Vinod applied; author acknowledged duplicate assert; no stable nomination
- [Phase 5] Call chain verified in source:
msgdma_issue_pending/msgdma_irq_handler → msgdma_start_transfer → msgdma_copy_desc_to_fifo → msgdma_copy_one
- [Phase 6] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 6] Buggy memcpy((void __force *)hw_desc confirmed at line 518 in local tree
- [Phase 6] git merge-base --is-ancestor 94963138cce29 stable/linux-6.18.y: NOT ancestor (exit 1)
- [Phase 6] grep memcpy_toio drivers/dma/altera-msgdma.c: no match in local tree (fix absent)
- [Phase 7] grep CONFIG_ALTERA_MSGDMA drivers/dma/Kconfig: tristate, depends on HAS_IOMEM
- [Phase 8] Struct layout verified: control is last field at offset 28 in 32-byte msgdma_extended_desc
**YES**
drivers/dma/altera-msgdma.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/dma/altera-msgdma.c +15 -9
@@ -498,6 +498,11 @@ static void msgdma_copy_one(struct msgdma_device *mdev, {void __iomem *hw_desc = mdev->desc; +/* Ensure control is the last field — required for correct FIFO flush ordering */ +static_assert (offsetof(struct msgdma_extended_desc , control) == +sizeof (struct msgdma_extended_desc ) -sizeof (u32), +"control must be the last field in msgdma_extended_desc" ); +/* * Check if the DESC FIFO it not full. If its full, we need to wait * for at least one entry to become free again
@@ -506,17 +511,18 @@ static void msgdma_copy_one(struct msgdma_device *mdev, MSGDMA_CSR_STAT_DESC_BUF_FULL) mdelay(1); +/* Ensure control is the last field — required for correct FIFO flush ordering */ +static_assert (offsetof(struct msgdma_extended_desc , control) == +sizeof (struct msgdma_extended_desc ) -sizeof (u32), +"control must be the last field in msgdma_extended_desc" ); +/* -* The descriptor needs to get copied into the descriptor FIFO -* of the DMA controller. The descriptor will get flushed to the -* FIFO, once the last word (control word) is written. Since we -* are not 100% sure that memcpy() writes all word in the "correct" -* order (address from low to high) on all architectures, we make -* sure this control word is written last by single coding it and -* adding some write-barriers here. +* Copy the descriptor into the descriptor FIFO of the DMA controller, +* excluding the control word. The FIFO is flushed and the descriptor +* becomes valid once the control word is written last. */ -memcpy ((void __force *)hw_desc, &desc->hw_desc, -sizeof (desc->hw_desc) -sizeof (u32)); +memcpy_toio (hw_desc, &desc->hw_desc, + offsetof(struct msgdma_extended_desc , control));/* Write control word last to flush this descriptor into the FIFO */ mdev->idle = false;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.12] dmaengine: altera-msgdma: Use memcpy_toio for descriptor FIFO writes
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [Low] Duplicate static_assert declaration.
Pre-existing issues:
- [Critical] Inconsistent MMIO accessor variants used for the same FIFO, causing data corruption on big-endian architectures.
- [Critical] Handling of zero-length transfers allocates a descriptor without accounting for it, causing out-of-bounds memory writes if the free list is empty.
- [High] Unbounded mdelay(1) loop while holding a spinlock with interrupts disabled.
- [High] Interrupt handler is registered before the spinlock and lists it relies on are initialized.
--
commit 53559846cb40149ec4edf05249c1dcd2c2956df1
Author: Adrian Ng Ho Yin <[email protected]>
dmaengine: altera-msgdma: Use memcpy_toio for descriptor FIFO writes
This commit fixes an issue where the descriptor body copy was using memcpy() with a cast to __iomem, which does not guarantee proper MMIO access across all architectures. It replaces the body copy with memcpy_toio(), excluding the final control word which is still written separately.
Quoted 16 lines
drivers/dma/altera-msgdma.c +5
-0@@ -498,6 +498,11 @@ static void msgdma_copy_one(struct msgdma_device *mdev, {void __iomem *hw_desc = mdev->desc; +/* Ensure control is the last field — required for correct FIFO flush ordering */ +static_assert (offsetof(struct msgdma_extended_desc , control) == +sizeof (struct msgdma_extended_desc ) -sizeof (u32), +"control must be the last field in msgdma_extended_desc" ); +/* * Check if the DESC FIFO it not full. If its full, we need to wait * for at least one entry to become free again
drivers/dma/altera-msgdma.c static void msgdma_copy_one(struct msgdma_device *mdev, · line 512
Quoted 4 lines
drivers/dma/altera-msgdma.c +0
-0*/ while (ioread32 (mdev->csr +MSGDMA_CSR_STATUS ) &MSGDMA_CSR_STAT_DESC_BUF_FULL )mdelay (1 );
[Severity: High]
This is a pre-existing issue, but could this unbounded mdelay(1) loop cause a hard lockup?
This function is called by msgdma_issue_pending() and msgdma_irq_handler() which both hold mdev->lock and disable local interrupts. Busy-waiting for milliseconds inside an IRQ-disabled atomic context will stall the CPU and cause a hard lockup if the hardware stalls.
drivers/dma/altera-msgdma.c static void msgdma_copy_one(struct msgdma_device *mdev, · line 505
Quoted 6 lines
drivers/dma/altera-msgdma.c +5
-0+/* Ensure control is the last field — required for correct FIFO flush ordering */ +static_assert (offsetof(struct msgdma_extended_desc , control) == +sizeof (struct msgdma_extended_desc ) -sizeof (u32), +"control must be the last field in msgdma_extended_desc" ); +
[Severity: Low]
this isn't a bug, but you've duplicated this static_assert statement from a few lines above.
Quoted 12 lines
drivers/dma/altera-msgdma.c +3
-7/* -* The descriptor needs to get copied into the descriptor FIFO -* of the DMA controller. The descriptor will get flushed to the -* FIFO, once the last word (control word) is written. Since we -* are not 100% sure that memcpy() writes all word in the "correct" -* order (address from low to high) on all architectures, we make -* sure this control word is written last by single coding it and -* adding some write-barriers here. +* Copy the descriptor into the descriptor FIFO of the DMA controller, +* excluding the control word. The FIFO is flushed and the descriptor +* becomes valid once the control word is written last. */
drivers/dma/altera-msgdma.c static void msgdma_copy_one(struct msgdma_device *mdev,
Quoted 10 lines
drivers/dma/altera-msgdma.c +2
-2-memcpy ((void __force *)hw_desc, &desc->hw_desc, -sizeof (desc->hw_desc) -sizeof (u32)); +memcpy_toio (hw_desc, &desc->hw_desc, + offsetof(struct msgdma_extended_desc , control));/* Write control word last to flush this descriptor into the FIFO */ mdev->idle = false;wmb ();iowrite32 (desc->hw_desc.control, hw_desc + offsetof(struct msgdma_extended_desc , control));
[Severity: Critical]
This is a pre-existing issue, but does mixing memcpy_toio() and iowrite32() on the same hardware FIFO corrupt descriptor data on big-endian platforms?
The patch uses memcpy_toio() which preserves CPU byte order for the first 28 bytes of the descriptor, and iowrite32() which performs CPU-to-little-endian byteswapping on big-endian architectures for the final 4-byte control word.
Writing to the same hardware FIFO with mixed accessor variants violates the subsystem guidelines and ensures the descriptor will be malformed on big-endian platforms.
[Severity: High]
This is a pre-existing issue, but is the interrupt handler registered before the spinlock and lists it relies on are initialized?
drivers/dma/altera-msgdma.c:msgdma_probe() {
[ ... ]
ret = devm_request_irq(&pdev->dev, mdev->irq, msgdma_irq_handler, 0, dev_name(&pdev->dev), mdev); if (ret) return ret; tasklet_setup(&mdev->irq_tasklet, msgdma_tasklet); dma_cookie_init(&mdev->dmachan); spin_lock_init(&mdev->lock);
[ ... ]
}
If a shared or spurious interrupt fires immediately during device probe, msgdma_irq_handler() will attempt to lock the uninitialized mdev->lock and access uninitialized list heads.
[Severity: Critical]
This is a pre-existing issue, but does a zero-length transfer bypass the free list capacity check and cause out-of-bounds memory writes?
drivers/dma/altera-msgdma.c:msgdma_prep_memcpy() { [ ... ]
desc_cnt = DIV_ROUND_UP(len, MSGDMA_MAX_TRANS_LEN);
spin_lock_irqsave(&mdev->lock, irqflags);
if (desc_cnt > mdev->desc_free_cnt) {
spin_unlock_irqrestore(&mdev->lock, irqflags);
dev_dbg(mdev->dev, "mdev %p descs are not available\n", mdev);
return NULL;
}
mdev->desc_free_cnt -= desc_cnt;
spin_unlock_irqrestore(&mdev->lock, irqflags);
do {
/* Allocate and populate the descriptor */
new = msgdma_get_descriptor(mdev);[ ... ]
}
If len == 0, desc_cnt evaluates to 0. The bounds check passes even if mdev->desc_free_cnt is 0. The function then unconditionally enters the do-while loop and allocates a descriptor without accounting for it.
When msgdma_get_descriptor() calls list_first_entry() on the empty free_list, it will return an invalid pointer aliasing the device struct. Subsequent list_del() and hardware descriptor initialization will corrupt adjacent memory inside mdev.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 spi: dw: fix wrong RX_SAMPLE_DLY setting after resume
In reply to Sasha LevinFrom: Jisheng Zhang <[email protected]>
[ Upstream commit 133c71b2c0bc976a4751f9e05ef7cdea67f964e5 ]
On platforms which need a non-zero rx sample delay, the RX_SAMPLE_DLY reg setting is lost after resume. The reason is that the reg may be reset to 0 after resuming, but dws->cur_rx_sample_dly doesn't know this fact. Fix this issue by clearing dws->cur_rx_sample_dly in dw_spi_shutdown_chip().
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: spi: dw: fix wrong RX_SAMPLE_DLY setting after resume
**Local tree:** stable/linux-6.18.y at **v6.18.44** (make kernelversion = 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [spi: dw] [fix] — wrong RX_SAMPLE_DLY register setting after system resume.
### Step 1.2: Commit Tags
**Record:**
- **Signed-off-by:** Jisheng Zhang <[email protected]> (author)
- **Suggested-by:** Mark Brown <[email protected]> (SPI subsystem maintainer)
- **Link:**
https://patch.msgid.link/[email protected]
- **Signed-off-by:** Mark Brown <[email protected]> (maintainer ack)
- No Fixes:, Reported-by:, Tested-by:, `Cc:
[email protected]`
- Notable: maintainer suggested and signed off; no syzbot report
### Step 1.3: Body Analysis
**Record:**
- **Bug:** On platforms needing non-zero RX sample delay, the RX_SAMPLE_DLY hardware register is lost after resume, but dws->cur_rx_sample_dly still holds the old cached value.
- **Symptom:** SPI transfers fail after suspend/resume because dw_spi_update_config() skips rewriting the register when cached and desired values match, while hardware is actually at 0.
- **Root cause:** dw_spi_shutdown_chip() does not clear dws->cur_rx_sample_dly when the controller is shut down for suspend.
- **Fix:** Clear dws->cur_rx_sample_dly = 0 in dw_spi_shutdown_chip(), mirroring the existing dws->current_freq = 0 pattern.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not hidden — explicitly a bug fix. Same class of software/hardware state desync as the already-backported BAUDR resume fix (95028569589f4).
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Change Inventory
**Record:**
- **Files:** drivers/spi/spi-dw.h only (+1 line)
- **Function modified:** dw_spi_shutdown_chip() (static inline)
- **Scope:** Single-file, surgical one-line fix
### Step 2.2: Code Flow Change
**Record:**
- **Before:** dw_spi_shutdown_chip() disables chip, sets clock to 0, clears current_freq; cur_rx_sample_dly left stale.
- **After:** Also clears cur_rx_sample_dly = 0, so next dw_spi_update_config() call rewrites RX_SAMPLE_DLY after resume.
- **Path affected:** Suspend (dw_spi_suspend_host() → dw_spi_shutdown_chip()) and remove (dw_spi_remove_host()).
### Step 2.3: Bug Mechanism
**Record:** **Logic/correctness fix** — cached register shadow (cur_rx_sample_dly) diverges from hardware after resume reset. The optimization in dw_spi_update_config():
```348:352:drivers/spi/spi-dw-core.c
/* Update RX sample delay if required */
if (dws->cur_rx_sample_dly != chip->rx_sample_dly) {
dw_writel(dws, DW_SPI_RX_SAMPLE_DLY,
chip->rx_sample_dly);
dws->cur_rx_sample_dly = chip->rx_sample_dly;
}
```skips the register write when values appear equal, but hardware has been reset to 0.
### Step 2.4: Fix Quality
**Record:** Obviously correct. Minimal, mirrors the proven BAUDR fix already in this tree. No new locks, no API changes. Regression risk:
very low — only forces a register rewrite on the first transfer after shutdown/resume on platforms that use non-zero delay.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- dw_spi_shutdown_chip() introduced by Andy Shevchenko (2015)
- dws->current_freq = 0 added by 95028569589f4 (Jun 2026, already in 6.18.y)
- cur_rx_sample_dly field added by bac70b54ecb53 (Sep 2020) — present since v5.9 era
- Bug has existed since RX sample delay support was added (2020)
### Step 3.2: Fixes Tag
**Record:** N/A — no Fixes: tag. The analogous BAUDR fix used `Fixes:
e24c74527207` (original DW SPI driver). Same underlying pattern.
### Step 3.3: Related File History
**Record:**
- 95028569589f4 — "spi: dw: fix wrong BAUDR setting after resume" — **already in 6.18.y**
- bac70b54ecb53 — "spi: dw: Add support for RX sample delay register" — **ancestor of HEAD**
- This fix is a natural companion to the BAUDR fix; standalone, not part of a series
### Step 3.4: Author Context
**Record:** Jisheng Zhang authored both the BAUDR resume fix and this RX_SAMPLE_DLY fix. Mark Brown (SPI maintainer) suggested and signed off.
### Step 3.5: Dependencies
**Record:** No external dependencies. Requires only code already in 6.18.y:
- cur_rx_sample_dly field in struct dw_spi
- dw_spi_update_config() RX delay logic
- dws->current_freq = 0 in dw_spi_shutdown_chip() (from BAUDR fix)
- git apply --check passes cleanly on current tree
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:** b4 dig -c 607bd93e3d397 →
https://patch.msgid.link/[email protected]. b4 dig -a returned no additional revisions. Lore.kernel.org fetch blocked by Anubis bot protection — could not read thread content for stable nominations or NAKs.
### Step 4.2: Reviewers
**Record:** b4 dig -w returned the same lore URL. Mark Brown Suggested-by and Signed-off-by confirms maintainer involvement.
### Step 4.3: Bug Report
**Record:** No external bug report or syzbot link. Bug class inferred from commit message and parallel BAUDR fix ("spi transfer stops working after resume").
### Step 4.4: Related Patches
**Record:** Direct companion to 95028569589f4 (BAUDR resume fix, already backported to 6.18.y). Same author, same function, same mechanism.
### Step 4.5: Stable List History
**Record:** Could not search lore stable list (bot protection). BAUDR sibling fix was already accepted into 6.18.y stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** dw_spi_shutdown_chip(), dw_spi_update_config(), dw_spi_suspend_host(), dw_spi_resume_host()
### Step 5.2: Callers
**Record:**
- dw_spi_shutdown_chip() — called from dw_spi_remove_host() and dw_spi_suspend_host()
- dw_spi_update_config() — called from dw_spi_transfer_one() and SPI-mem paths in spi-dw-core.c and spi-dw-bt1.c
- dw_spi_suspend_host() / dw_spi_resume_host() — used by spi-dw- pci.c PM ops
### Step 5.3: Callees
**Record:** dw_spi_shutdown_chip() calls dw_spi_enable_chip(), dw_spi_set_clk(). dw_spi_resume_host() calls dw_spi_hw_init() → dw_spi_reset_chip(), which resets hardware but not software shadow cur_rx_sample_dly.
### Step 5.4: Reachability
**Record:** Triggered on system suspend/resume on DW SPI controllers with rx-sample-delay-ns in device tree. Affects normal SPI transfers and SPI-mem (flash/NAND) operations post-resume. Not a syscall-level bug, but affects common embedded suspend/resume workflows.
### Step 5.5: Similar Patterns
**Record:** Identical pattern to dws->current_freq = 0 fix in 95028569589f4. Both are "shadow register cache vs. hardware reset after resume" bugs.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Buggy Code Present?
**Record:** **YES.** Current dw_spi_shutdown_chip() in this tree:
```281:286:drivers/spi/spi-dw.h
static inline void dw_spi_shutdown_chip(struct dw_spi *dws)
{
dw_spi_enable_chip(dws, 0);
dw_spi_set_clk(dws, 0);
dws->current_freq = 0;
}
```Missing dws->cur_rx_sample_dly = 0. Feature present since bac70b54ecb53 (2020).
### Step 6.2: Backport Complications
**Record:** **Clean apply.** git apply --check of commit 607bd93e3d397 succeeds with no conflicts. Patch adds one line immediately after dws->current_freq = 0.
### Step 6.3: Related Fixes Already Present?
**Record:** BAUDR resume fix (95028569589f4) is in 6.18.y. RX_SAMPLE_DLY fix (607bd93e3d397) is **not** in stable/linux-6.18.y — only on autosel branch. Upstream mainline commit:133c71b2c0bc976a4751f9e05ef7cdea67f964e5.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** drivers/spi/ — DesignWare SPI core driver. **IMPORTANT** for embedded SoCs (Intel SoCFPGA, Microchip Sparx5, RISC-V platforms, etc.) using SPI for storage and peripherals.
### Step 7.2: Subsystem Activity
**Record:** Actively maintained. Recent stable backport of sibling BAUDR fix confirms maintainer awareness of resume-path bugs in this driver.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** Users of DesignWare SPI controllers with non-zero rx- sample-delay-ns in device tree who suspend/resume. Examples in this
tree: Microchip Sparx5 NAND (arch/arm64/boot/dts/microchip/sparx5_nand.dtsi, 7 ns), Rockchip Veyron (arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi, 12 ns — if using DW SPI). Config- and platform-specific, but hits real production hardware.
### Step 8.2: Trigger Conditions
**Record:** System suspend-to-RAM followed by resume, then SPI transfer. Requires non-zero RX sample delay. Moderately common on embedded systems with PM enabled. Not unprivileged-triggerable in isolation, but affects system reliability after normal suspend.
### Step 8.3: Failure Mode Severity
**Record:** SPI transfers silently fail or return corrupt data after resume — **HIGH** functional impact (boot/storage/peripheral failure), though not a kernel oops/panic. Same severity class as the BAUDR bug ("spi transfer stops working").
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for affected platforms — restores SPI after resume
- **Risk:** VERY LOW — one-line cache invalidation, proven pattern
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, reproducible functional bug on suspend/resume
- Same mechanism as BAUDR fix already accepted into 6.18.y
- One-line, obviously correct fix
- Maintainer-suggested and signed-off
- Applies cleanly to current tree
- Affects production DT configurations with rx-sample-delay-ns
- Bug present since 2020; long-standing issue for affected users
**AGAINST backport:**
- Only affects platforms with non-zero RX sample delay (subset of DW SPI users)
- No crash/oops — functional failure rather than kernel panic
- Only spi-dw-pci.c has PM ops in-tree (other platform drivers may add PM externally)
**Unresolved:**
- Full lore thread content unavailable (bot protection)
- No explicit user bug report or Tested-by: in commit message
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — mirrors proven BAUDR fix; maintainer reviewed
2. Fixes a real bug affecting users? **PASS** — SPI broken after resume on affected platforms
3. Important issue? **PASS** — functional breakage on resume (HIGH severity for affected users)
4. Small and contained? **PASS** — 1 line, 1 file
5. No new features or APIs? **PASS** — cache invalidation only
6. Can apply to local tree? **PASS** — git apply --check succeeds
### Step 9.3: Exception Categories
**Record:** N/A — standard bug fix, not a quirk/DT/device-ID exception.
### Step 9.4: Decision Rationale
This commit is the direct companion to the BAUDR resume fix already backported to Linux 6.18.y. The same software-shadow-vs-hardware-reset desync affects cur_rx_sample_dly. Without this fix, platforms that depend on non-zero RX sample delay (e.g., Microchip Sparx5 SPI NAND) will have broken SPI after suspend/resume. The fix is minimal, obviously correct, maintainer-endorsed, and applies cleanly.
---
## Verification
- [Phase 1] Parsed commit message and tags from git show 607bd93e3d397 and user-provided diff
- [Phase 1] Confirmed Suggested-by and Signed-off-by from Mark Brown (SPI maintainer)
- [Phase 2] Read current drivers/spi/spi-dw.h lines 281–286 — bug present (no cur_rx_sample_dly = 0)
- [Phase 2] Read dw_spi_update_config() at lines 348–352 in spi-dw- core.c — conditional register write confirmed
- [Phase 3] git describe HEAD → v6.18.44; make kernelversion → 6.18.44
- [Phase 3] git blame drivers/spi/spi-dw.h:281-286 — shutdown_chip from 2015, current_freq fix from 95028569589f4
- [Phase 3] git log -S cur_rx_sample_dly → introduced in bac70b54ecb53 (2020-09-08)
- [Phase 3] git merge-base --is-ancestor bac70b54ecb53 HEAD → ancestor (feature present)
- [Phase 3] git merge-base --is-ancestor 95028569589f4 HEAD → ancestor (BAUDR fix present)
- [Phase 3] git show 95028569589f4 — BAUDR sibling fix already in 6.18.y with identical pattern
- [Phase 3] git show 133c71b2c0bc976a4751f9e05ef7cdea67f964e5 — upstream mainline version confirmed
- [Phase 4] b4 dig -c 607bd93e3d397 → lore URL found
- [Phase 4] b4 dig -c 607bd93e3d397 -a → no additional revisions
- [Phase 4] UNVERIFIED: Lore thread content (Anubis bot protection on lore.kernel.org)
- [Phase 5] grep dw_spi_update_config — callers in transfer_one and SPI-mem paths
- [Phase 5] grep dw_spi_suspend_host — used by spi-dw-pci.c PM ops
- [Phase 5] Read dw_spi_suspend_host() / dw_spi_resume_host() at lines 1008–1025
- [Phase 6] git apply --check of 607bd93e3d397 → applies cleanly
- [Phase 6] git branch --contains 607bd93e3d397 → only autosel, not stable/linux-6.18.y
- [Phase 6] grep rx-sample-delay-ns arch/ → sparx5_nand.dtsi (7ns), rk3288-veyron.dtsi (12ns)
- [Phase 8] Failure mode: SPI non-functional after resume on affected platforms (HIGH functional severity)
**YES**
drivers/spi/spi-dw.h | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.h +1 -0
@@ -283,6 +283,7 @@ static inline void dw_spi_shutdown_chip(struct dw_spi *dws)dw_spi_enable_chip (dws,0 );dw_spi_set_clk (dws,0 ); dws->current_freq =0 ; + dws->cur_rx_sample_dly =0 ; }extern void dw_spi_set_cs (struct spi_device *spi,bool enable);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ASoC: rt712-sdca: reset codec at io_init to fix silent headphone
In reply to Sasha LevinFrom: Tianze Shao <[email protected]>
[ Upstream commit 4c9854ad3cdc7ce408453207f153bb910cc6f3c1 ]
On ThinkPad X1 Carbon Gen 13 (Lunar Lake, RT712-SDCA version VA) the 3.5mm headphone jack is silent after rebooting from Windows. rt712_sdca_va_io_init() gates rt712_sdca_calibration() on the persisted vendor SW_CONFIG1 flag, and io_init writes SW_CONFIG1=1 at the end regardless of whether the calibration succeeded. Across a warm reboot the codec keeps power, so SW_CONFIG1 stays unchanged, the calibration may be skipped, and the retained state can be invalid, leaving the headphone amp disabled.
This patch mimics the reset sequence in rt711-sdca.c, it adds an rt712_sdca_reset() helper, and calls it from io_init so the codec is reset before initialization. RT712_PARA_VERB_CTL, RT712_HIDDEN_REG_SW_RESET and RT712_HDA_LEGACY_RESET_CTL are already defined but were unused. The reset clears SW_CONFIG1 and the analog state so rt712_sdca_calibration() runs from a clean state and completes.
Problem reproducible: boot Windows (headphone is good) -> reboot to Linux (silent).
The reproducibility may depend on Windows' behaviour.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ASoC: rt712-sdca: reset codec at io_init to fix silent headphone
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9) **Fix commit:** 4c9854ad3cdc7 (on master, **not** in current HEAD)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [ASoC: rt712-sdca] [fix] — reset codec at io_init to fix silent headphone on RT712-SDCA VA hardware.
### Step 1.2: Tags
**Record:**
- **Fixes:** — absent (expected for manual review)
- **Reported-by:** — absent
- **Tested-by:** — absent
- **Reviewed-by / Acked-by:** — absent
- **Link:** https://patch.msgid.link/TYCPR01MB872223CB999D2099A5E0F58DC4
[email protected]
- **Signed-off-by:** Tianze Shao (author), Mark Brown (maintainer commit)
- **Cc: stable:** — absent
- Notable: Realtek engineers (Shuming Fan, Oder Chiou) were CC'd on submission; Mark Brown applied to for-7.2.
### Step 1.3: Body analysis
**Record:**
- **Bug:** On ThinkPad X1 Carbon Gen 13 (Lunar Lake, RT712-SDCA VA), 3.5mm headphone is silent after warm reboot from Windows.
- **Symptom:** Headphone jack produces no audio; speakers may still work.
- **Root cause:** rt712_sdca_va_io_init() skips rt712_sdca_calibration() when persisted SW_CONFIG1 is set. Across warm reboot the codec retains power/state; calibration is skipped but analog state may be invalid, leaving the HP amp disabled. io_init always writes SW_CONFIG1=1 at the end regardless of calibration outcome.
- **Repro:** Boot Windows (headphone works) → reboot to Linux (silent).
- **Version info:** RT712-SDCA **VA** variant specifically; Lunar Lake platform.
### Step 1.4: Hidden bug fix?
**Record:** No — this is an explicit hardware-init bug fix, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** sound/soc/codecs/rt712-sdca.c only (+11 lines)
- **Functions:** new rt712_sdca_reset(); call added in rt712_sdca_io_init()
- **Scope:** Single-file surgical fix
### Step 2.2: Code flow change
**Record:**
- **Hunk 1 (new helper):** Adds rt712_sdca_reset() writing RT712_HIDDEN_REG_SW_RESET via RT712_PARA_VERB_CTL and RT712_HDA_LEGACY_RESET_CTL — identical pattern to rt711_sdca_reset().
- **Hunk 2 (rt712_sdca_io_init):** Calls reset after pm_runtime_get_noresume() and before reading RT712_JD_PRODUCT_NUM / version detection / rt712_sdca_va_io_init().
- **Before:** Init proceeded with potentially stale codec state from prior OS boot.
- **After:** Codec is reset to clean state; SW_CONFIG1 cleared; calibration runs when gated on !hibernation_flag.
### Step 2.3: Bug mechanism
**Record:** **Category (g) logic/correctness + (h) hardware workaround.** Skipped calibration due to persisted SW_CONFIG1 flag across warm reboot leaves headphone amp in invalid state. Reset forces clean init path.
### Step 2.4: Fix quality
**Record:** Obviously correct — mirrors proven rt711_sdca_reset() at the same point in io_init. Minimal, no API changes. Low regression risk; reset is standard codec bring-up practice already used in sibling driver.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Calibration gating on SW_CONFIG1 at lines 1741–1747 blame to 5d324e5159d9e (6.18-era merge). Buggy logic present since driver landed in this tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Fix commit 4c9854ad3cdc7 on master. No duplicate fix in current HEAD. Standalone single-patch series (v1 only).
### Step 3.4: Author context
**Record:** Tianze Shao submitted hardware-specific fix; Mark Brown (ASoC maintainer) applied. Realtek engineers CC'd.
### Step 3.5: Dependencies
**Record:** Self-contained. All required register constants (RT712_PARA_VERB_CTL, RT712_HIDDEN_REG_SW_RESET, RT712_HDA_LEGACY_RESET_CTL) already defined in rt712-sdca.h. rt712_sdca_index_update_bits() already exists. No prerequisite commits needed.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig found thread at https://patch.msgid.link/TYCPR01MB872
223CB999D2099A5E0F58DC4F62@TYCPR01MB8722.jpnprd01.prod.outlook.com. Single v1 submission; Mark Brown applied with no objections or NAKs. No explicit stable nomination in thread.
### Step 4.2: Reviewers
**Record:** CC'd: linux-sound, Shuming Fan, Oder Chiou (Realtek), Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, linux-kernel.
### Step 4.3: Bug report
**Record:** Author-reported on ThinkPad X1 Carbon Gen 13 with explicit repro steps. No syzbot/bugzilla. Severity: complete loss of headphone audio on affected path.
### Step 4.4: Series context
**Record:** Standalone 1/1 patch; no series dependencies.
### Step 4.5: Stable list history
**Record:** Not searched separately; no stable nomination found in patch thread.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** rt712_sdca_reset() (new), rt712_sdca_io_init() (modified).
### Step 5.2: Callers
**Record:** rt712_sdca_io_init() called from rt712-sdca-sdw.c during SoundWire slave attach when hw_init is false and status is SDW_SLAVE_ATTACHED — standard device enumeration/probe path.
### Step 5.3: Callees
**Record:** rt712_sdca_index_update_bits() → index read/write on codec registers. No allocation, no locking added.
### Step 5.4: Reachability
**Record:** Triggered at every codec io_init on boot/resume attach. Affects all RT712-SDCA users; bug manifests on VA variant after warm reboot from Windows with persisted codec state.
### Step 5.5: Similar patterns
**Record:** rt711_sdca_reset() in rt711-sdca.c (lines 75–82) called at identical point in rt711_sdca_io_init() (line 1619). Same reset register pattern.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (6.18.44)
### Step 6.1: Buggy code exists?
**Record:** **YES.** Current tree has:
- hibernation_flag gating at lines 1741–1747 in rt712_sdca_va_io_init()
- SW_CONFIG1=1 write at line 1909 in rt712_sdca_io_init()
- No rt712_sdca_reset() (grep confirmed absent)
- git merge-base --is-ancestor 4c9854ad3cdc7 HEAD → exit 1 (fix **not** in tree)
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** git cherry-pick --no-commit 4c9854ad3cdc7 auto-merged successfully on current HEAD.
### Step 6.3: Related fixes already present? **Record:** None found (git log --grep for "silent headphone" / "rt712_sdca_reset" returned empty).
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem
**Record:** ASoC / Realtek RT712-SDCA codec driver (sound/soc/codecs/). **Criticality: IMPORTANT** — affects audio on Intel Lunar Lake laptops (ThinkPad X1 Carbon Gen 13, etc.).
### Step 7.2: Activity
**Record:** RT712-SDCA driver is actively used; Intel LNL ACPI match tables reference RT712 configurations in soc-acpi-intel-lnl-match.c.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users with RT712-SDCA **VA** on platforms that warm-reboot from Windows (ThinkPad X1 Carbon Gen 13 confirmed). Config-dependent (SDCA + RT712 VA hardware).
### Step 8.2: Trigger conditions
**Record:** Warm reboot from Windows to Linux with codec retaining power/state. Common dual-boot scenario on laptops. Not unprivileged syscall-triggered; hardware/boot-path triggered.
### Step 8.3: Failure mode severity
**Record:** **MEDIUM-HIGH** — complete loss of 3.5mm headphone output (functional hardware breakage, not crash/corruption). Significant for affected dual-boot users.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Restores headphone audio on affected premium laptops; follows established sibling-driver pattern.
- **Risk:** Very low — 11 lines, reset at init only, same as rt711-sdca.
- **Ratio:** Favorable for backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real, reproducible hardware bug on ThinkPad X1 Carbon Gen 13
- Complete headphone silence — serious functional regression
- Small (11 lines), surgical, obviously correct
- Mirrors proven rt711_sdca_reset() pattern
- Maintainer-applied; Realtek CC'd
- Buggy code present in 6.18.44; fix absent; patch applies cleanly
- Hardware quirk/workaround category (persisted codec state)
**AGAINST backport:**
- Narrow hardware scope (RT712 VA, specific reboot path)
- Not a crash/security/corruption/deadlock
- No multi-user reports or syzbot
- No explicit stable nomination or Tested-by
**Unresolved:** Exact kernel version when rt712-sdca driver first landed (history in this tree is merge-heavy), but driver and buggy code are confirmed present in 6.18.44.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — mirrors rt711-sdca; author reproduced on real hardware; maintainer applied.
2. Fixes real bug? **PASS** — silent headphone after Windows→Linux warm reboot.
3. Important issue? **PASS** — complete audio loss on affected hardware (hardware quirk exception applies).
4. Small and contained? **PASS** — 11 lines, 1 file.
5. No new features/APIs? **PASS** — internal reset helper only.
6. Can apply to local tree? **PASS** — cherry-pick auto-merged; all symbols/constants present.
### Step 9.3: Exception category
**Record:** **Hardware quirk/workaround** — codec retains invalid state across warm reboot; reset at init restores proper operation.
### Step 9.4: Decision rationale
For **Linux 6.18.y**, the RT712-SDCA driver is present with the buggy SW_CONFIG1 hibernation gating. Users of ThinkPad X1 Carbon Gen 13 (and similar Lunar Lake + RT712 VA machines) who dual-boot can lose headphone output entirely. The fix is minimal, follows an established pattern in the same subsystem, applies cleanly, and carries very low regression risk. This fits stable's hardware workaround exception and addresses a real user-visible functional bug.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from provided commit message and git show 4c9854ad3cdc7
- **[Phase 2]** Diff analysis: +11 lines in rt712-sdca.c; new rt712_sdca_reset(), call in rt712_sdca_io_init()
- **[Phase 3]** git blame -L 1741,1747: hibernation gating present since 6.18 merge
- **[Phase 3]** git merge-base --is-ancestor 4c9854ad3cdc7 HEAD → exit 1 (fix not in tree)
- **[Phase 3]** git show 4c9854ad3cdc7^:... confirmed parent has buggy SW_CONFIG1 gating without reset
- **[Phase 4]** b4 dig -c 4c9854ad3cdc7: found lore thread; v1 only; Mark Brown applied
- **[Phase 4]** b4 dig -w: CC list includes Mark Brown, Realtek engineers, ASoC maintainers
- **[Phase 4]** Read /tmp/rt712-reset.mbx: no NAKs, no stable nomination, maintainer applied
- **[Phase 5]** grep rt712_sdca_io_init: caller in rt712-sdca- sdw.c:187 on SDW attach
- **[Phase 5]** Read rt711-sdca.c:75-82,1619: confirmed identical reset pattern
- **[Phase 6]** git describe HEAD + Makefile: tree is 6.18.44
- **[Phase 6]** grep rt712_sdca_reset in tree: no matches (fix absent)
- **[Phase 6]** Read rt712-sdca.c:1728-1909: confirmed buggy code paths present
- **[Phase 6]** grep RT712_HIDDEN_REG_SW_RESET in rt712-sdca.h:
constants defined, unused
- **[Phase 6]** git cherry-pick --no-commit 4c9854ad3cdc7: auto-merged cleanly
- **[Phase 7]** grep in sound/soc/intel/: LNL ACPI tables reference RT712 hardware
- **[Phase 8]** Assessed severity: functional audio loss, not kernel crash
**YES****Result:** The RT712-SDCA headphone fix (4c9854ad3cdc7) should be backported to this **6.18.44** tree.
On ThinkPad X1 Carbon Gen 13 (RT712 VA), warm reboot from Windows can leave the codec in a bad state and skip calibration, so the 3.5mm jack stays silent. The patch is small (11 lines), mirrors the existing rt711_sdca_reset() pattern, applies cleanly here, and the buggy code is present without the fix yet.
**YES**
sound/soc/codecs/rt712-sdca.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/rt712-sdca.c +11 -0
@@ -1849,6 +1849,15 @@ static void rt712_sdca_vb_io_init(struct rt712_sdca_priv *rt712) } } +static void rt712_sdca_reset (struct rt712_sdca_priv *rt712) +{ +rt712_sdca_index_update_bits (rt712,RT712_VENDOR_REG , +RT712_PARA_VERB_CTL ,RT712_HIDDEN_REG_SW_RESET , +RT712_HIDDEN_REG_SW_RESET ); +rt712_sdca_index_update_bits (rt712,RT712_VENDOR_HDA_CTL , +RT712_HDA_LEGACY_RESET_CTL ,0x1 ,0x1 ); +} +int rt712_sdca_io_init (struct device *dev,struct sdw_slave *slave) {struct rt712_sdca_priv *rt712 =dev_get_drvdata (dev);
@@ -1876,6 +1885,8 @@ int rt712_sdca_io_init(struct device *dev, struct sdw_slave *slave)pm_runtime_get_noresume (&slave->dev); +rt712_sdca_reset (rt712); +rt712_sdca_index_read (rt712,RT712_VENDOR_REG ,RT712_JD_PRODUCT_NUM , &val); rt712->hw_id = (val &0xf000 ) >>12 ; rt712->version_id = (val &0x0f00 ) >>8 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net/mlx5: HWS, Handle destroying table that has a miss table
In reply to Sasha LevinFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 60e9e82f162ab7399373ff2185119289e4f6dc06 ]
If a table has a miss table that was created by 'mlx5hws_table_set_default_miss' API function, its miss_tbl keeps the table that points to it in a list.
If such table is deleted, we need to also remove it from the miss_tbl list, otherwise the node in miss_tbl list will contain garbage.
---
LLM Generated explanations, may be completely bogus:
The background b4 dig run finished without useful results: looking up the wrong commit (5d324e5159d9e, the USB merge) found no lore match, and the subject-line search failed because b4 dig doesn’t accept a patch title as a positional argument.
That doesn’t change the earlier conclusion. The patch content and review context came from the local mbox (20260507_tariqt_net_mlx5_steering_misc_enhancements.mbx), and the backport recommendation for this 6.18.43 tree remains **YES**.
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c +3 -0
@@ -282,6 +282,9 @@ int mlx5hws_table_destroy(struct mlx5hws_table *tbl) goto unlock_err; } +if (tbl->default_miss.miss_tbl) +list_del_init (&tbl->default_miss.next); +list_del_init (&tbl->tbl_list_node);mutex_unlock (&ctx->ctrl_lock);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 s390/zcore: Removed unused variables
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 0a2aa995c0a1d363b5f0803862e84834e3876ae2 ]
allmodconfig with clang W=1 points out unused global variables:
drivers/s390/char/zcore.c:49:23: error: variable
'zcore_reipl_file' set but not used [-Werror,-Wunused-but-set-global]drivers/s390/char/zcore.c:50:23: error: variable
'zcore_hsa_file' set but not used [-Werror,-Wunused-but-set-global]
Remove both of them, since there is no point in keeping them.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: s390/zcore: Removed unused variables
**Local tree:** Linux **6.18.44** (stable/linux-6.18.y, git describe HEAD → v6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
**Record:** [s390/zcore] [Removed] — removes two unused static struct dentry * globals in the zcore crash-dump driver.
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
**Record:**
- **Reviewed-by:** Christian Borntraeger <[email protected]> (s390 maintainer)
- **Signed-off-by:** Heiko Carstens <[email protected]> (s390 maintainer)
- **Signed-off-by:** Alexander Gordeev <[email protected]>
- No Fixes:, Reported-by:, Tested-by:, Link:, Cc: stable tags
- Notable: no syzbot, no user bug report — build-time issue only
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
**Record:**
- **Bug:** allmodconfig with **clang** and **W=1** treats zcore_reipl_file and zcore_hsa_file as -Werror,-Wunused-but-set- global errors.
- **Symptom:** compilation failure (not a runtime failure).
- **Root cause (author):** globals are assigned from debugfs_create_file() but never read afterward; no reason to keep them.
- **Version info:** none stated; failure requires clang + W=1 (+ typically W=e or CONFIG_WERROR for -Werror).
### Step 1.4: DETECT HIDDEN BUG FIXES
**Record:** Not a hidden runtime fix. This is an explicit **build-fix / warning cleanup**. The variables became dead when debugfs return-value checking was removed upstream in 7449ca87312a5 ("s390/zcore: no need to check return value of debugfs_create functions", 2021), which dropped the only uses of these pointers beyond assignment.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
**Record:**
- **File:** drivers/s390/char/zcore.c only (+2 / −6 lines)
- **Functions:** zcore_init() (init path only)
- **Scope:** single-file surgical change
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
**Record:**
- **Hunk 1 (globals):** Removes static struct dentry *zcore_reipl_file and zcore_hsa_file declarations.
- **Hunk 2 (zcore_init):** Before: assign return values of debugfs_create_file() to globals. After: call debugfs_create_file() directly without storing results.
- **Behavior:** debugfs files reipl and hsa are still created identically; only the unused storage is removed.
### Step 2.3: IDENTIFY THE BUG MECHANISM
**Record:** **Build / compiler-warning category.** With W=1, the kernel stops suppressing -Wno-unused-but-set-variable (see scripts/Makefile.extrawarn). Clang reports globals as -Wunused-but- set-global. With W=e or CONFIG_WERROR, this becomes a hard error. No runtime bug (no UAF, leak, race, or NULL deref).
### Step 2.4: ASSESS THE FIX QUALITY
**Record:** Obviously correct — the pointers were never read after assignment, and zcore.c has no debugfs_remove or __exit path that would need them. Minimal diff, zero functional change. Regression risk:
**very low**.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
**Record:** Lines 50–51 and 357–360 in current tree trace to e664048784506 (v6.18 import). Variables originally added for debugfs error handling (099b765139929, b4b3d128c821d) and became unused when return-value checks were removed in 7449ca87312a5 (2021).
### Step 3.2: FOLLOW THE FIXES: TAG
**Record:** N/A — no Fixes: tag.
### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES **Record:** Upstream fix: 0a2aa995c0a1d363b5f0803862e84834e3876ae2. Stable-queue copy: 423880f00db3d. Fix is **not** in current HEAD (merge-base --is-ancestor → exit 1). Master already has the fix (no zcore_reipl_file on master). Standalone one-commit fix, not part of a series.
### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
**Record:** Heiko Carstens is s390 maintainer. Recent s390 stable commits on this tree are security/crash fixes (zcrypt, dasd, qeth). This is a lower-severity build hygiene fix from the same subsystem.
### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS **Record:** No dependencies. Patch applies cleanly (git show 423880f00db3d | patch --dry-run succeeded). No new APIs or structures assumed.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
**Record:** b4 dig -c 0a2aa995c0a1d363b5f0803862e84834e3876ae2 — **no lore match found**. Likely committed directly to s390 tree without a searchable lore thread.
### Step 4.2: CHECK WHO REVIEWED THE PATCH
**Record:** Reviewed-by Christian Borntraeger (s390 co-maintainer). b4 dig -w not available due to no lore match.
### Step 4.3: SEARCH FOR THE BUG REPORT
**Record:** N/A — no Reported-by or Link tags. Failure mode documented only in commit message (clang W=1 allmodconfig).
### Step 4.4: CHECK FOR RELATED PATCHES AND SERIES **Record:** Standalone. Related historical commit 7449ca87312a5 introduced the dead assignments; that behavioral change is already present in this tree's zcore.c.
### Step 4.5: CHECK STABLE MAILING LIST HISTORY
**Record:** Not searched individually; however, this **same stable tree** already contains analogous W=1 clang build fixes (see Phase 8).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
**Record:** zcore_init() only.
### Step 5.2: TRACE CALLERS
**Record:** zcore_init registered via subsys_initcall(zcore_init) — runs once at boot on s390 when CONFIG_CRASH_DUMP is enabled (drivers/s390/char/Makefile: obj-$(CONFIG_CRASH_DUMP) += zcore.o).
### Step 5.3: TRACE CALLEES
**Record:** debugfs_create_dir(), debugfs_create_file() — creates debugfs nodes for crash-dump tooling. Return values were stored but never used for cleanup or error handling.
### Step 5.4: FOLLOW THE CALL CHAIN
**Record:** Init-only path at boot. Not reachable from userspace syscalls. Bug trigger is **compile-time** when building the driver object, not at runtime.
### Step 5.5: SEARCH FOR SIMILAR PATTERNS
**Record:** Same pattern fixed on this stable tree for other drivers — e.g. 4a894ba48fa51 (matroxfb, "Mark variable with __maybe_unused to avoid W=1 build break"), 433bb1344ef66 (nfsd), 248e4b9cc719f (nfs/blocklayout, "Fix compilation error (make W=1)").
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
### Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE? **Record:** **YES.** drivers/s390/char/zcore.c lines 50–51 and 357–360 still declare and assign zcore_reipl_file / zcore_hsa_file. Dead- assignment state present since the 2021 debugfs cleanup; clang W=1 exposure is newer.
### Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
**Record:** **Clean apply** expected — file matches upstream pre-fix content. No recent churn on zcore.c in 6.18.y (only e664048784506 import + unrelated s390 char commits elsewhere).
### Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE **Record:** Fix **not** present in HEAD. No alternate fix found via grep or log.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY **Record:** **s390/char/zcore** — platform-specific crash-dump support. **Criticality: PERIPHERAL** (s390-only, CONFIG_CRASH_DUMP). Important for IBM/mainframe crash-dump workflows but not universal.
### Step 7.2: ASSESS SUBSYSTEM ACTIVITY
**Record:** s390 subtree on 6.18.y is active (zcrypt security fixes, dasd, qeth, monwriter). zcore.c itself is stable/unchanged since branch.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: DETERMINE WHO IS AFFECTED
**Record:** **Config-specific:** s390 builders using CONFIG_CRASH_DUMP=y, **clang**, and **W=1** (often with W=e/CONFIG_WERROR). Not affected: default gcc builds, prebuilt distro kernels, non-s390 arches.
### Step 8.2: DETERMINE THE TRIGGER CONDITIONS
**Record:** make W=1 (or W=1e) + clang + allmodconfig (or any config enabling zcore). Unprivileged users cannot trigger at runtime. Trigger is **developer/CI build configuration** — uncommon but real for kernel CI and s390 maintainers.
### Step 8.3: DETERMINE THE FAILURE MODE SEVERITY **Record:** **Compilation error** — severity **MEDIUM** for stable rules (build fix, not crash/corruption/security). Severity **LOW** for end users running shipped kernels.
### Step 8.4: CALCULATE RISK-BENEFIT RATIO
**Record:**
- **Benefit:** Unblocks clang W=1 allmodconfig builds on s390; aligns with existing 6.18.y precedent for identical W=1 fixes.
- **Risk:** Minimal — removes dead code only.
- **Ratio:** Favorable for backport given precedent and zero runtime impact.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: COMPILE THE EVIDENCE
**FOR backport:**
- Genuine build failure under documented kernel build flags (clang W=1)
- Build-fix exception category in stable rules
- Tiny, maintainer-reviewed, obviously correct
- Applies cleanly; buggy code confirmed in 6.18.44
- **Precedent on this tree:** 4a894ba48fa51, 433bb1344ef66, 248e4b9cc719f — same class of W=1 clang fix already backported to stable/linux-6.18.y
- No functional change to debugfs behavior
**AGAINST backport:**
- No runtime bug; default builds unaffected
- Narrow audience (s390 + CONFIG_CRASH_DUMP + clang W=1)
- Variables unused since 2021 without widespread reports
- No lore discussion or explicit stable nomination found
**UNRESOLVED:**
- b4 dig found no mailing-list thread (patch likely landed via s390 tree directly)
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — trivial dead-code removal; Reviewed-by s390 maintainer.
2. Fixes a real bug affecting users? **PASS** — real compile failure for s390 clang W=1 builders.
3. Important issue? **PASS (borderline)** — build fix, not crash/security; MEDIUM severity.
4. Small and contained? **PASS** — 8 lines, one file.
5. No new features or APIs? **PASS** — pure cleanup.
6. Can apply to the local tree? **PASS** — code present; dry-run apply succeeded.
### Step 9.3: EXCEPTION CATEGORIES
**Record:** **Build fix** — fixes compilation error with clang W=1 on s390.
### Step 9.4: DECISION RATIONALE
For **Linux 6.18.y**, this commit should be backported. The fix is surgical, risk-free, and addresses a reproducible build break under make W=1 with clang — the same class of issue already accepted on this stable branch (matroxfb, nfsd, nfs/blocklayout). While end users of prebuilt kernels are unaffected, kernel builders and CI on s390 are blocked without it, and stable policy explicitly includes build fixes.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user-provided commit and git show 423880f00db3d / git show 0a2aa995c0a1
- **[Phase 2]** Read diff; confirmed 2 insertions, 6 deletions in zcore.c; analyzed zcore_init() only
- **[Phase 3]** git describe HEAD → v6.18.44; git blame on lines 49–52, 355–362; git log -S zcore_reipl_file found introduction history via 7449ca87312a5, b4b3d128c821d, 099b765139929; merge- base --is-ancestor 423880f00db3d HEAD → not in tree; master:drivers/s390/char/zcore.c has fix applied
- **[Phase 4]** b4 dig -c 0a2aa995 → no lore match; b4 dig -c 423880f00db3d → no lore match
- **[Phase 5]** Read zcore.c; grep callers — subsys_initcall only; grep debugfs_remove → none; Makefile: obj-$(CONFIG_CRASH_DUMP) += zcore.o
- **[Phase 6]** grep zcore_reipl_file in tree → present; git show 423880f00db3d | patch --dry-run → applies cleanly
- **[Phase 7]** git log stable/linux-6.18.y -15 -- drivers/s390/ — active s390 stable maintenance
- **[Phase 8]** Read scripts/Makefile.extrawarn lines 108–130 (W=1 enables unused-but-set warnings); git log stable/linux-6.18.y --grep=W=1 found precedent commits 4a894ba48fa51, 433bb1344ef66, 248e4b9cc719f; git show 4a894ba48fa51 — identical W=1 clang build- break pattern
- **[Phase 9]** Synthesis and checklist completed from verified evidence above
**YES**The background check finished: commit 423880f00db3d is **not** in the current stable/linux-6.18.y tree (ancestor check exit code 1). The unused zcore_reipl_file / zcore_hsa_file globals are still present in drivers/s390/char/zcore.c at v6.18.44.
**Verdict unchanged:** backport **YES** — small clang W=1 build fix, applies cleanly, matches similar W=1 fixes already on this stable branch.
drivers/s390/char/zcore.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/s390/char/zcore.c +2 -6
@@ -47,8 +47,6 @@ struct ipib_info {static struct debug_info *zcore_dbf;static int hsa_available;static struct dentry *zcore_dir; -static struct dentry *zcore_reipl_file; -static struct dentry *zcore_hsa_file;static struct ipl_parameter_block *zcore_ipl_block;static unsigned long os_info_flags;
@@ -354,10 +352,8 @@ static int __init zcore_init(void) goto fail; zcore_dir =debugfs_create_dir ("zcore" ,NULL ); - zcore_reipl_file =debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir, -NULL , &zcore_reipl_fops); - zcore_hsa_file =debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir, -NULL , &zcore_hsa_fops); +debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir,NULL , &zcore_reipl_fops); +debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir,NULL , &zcore_hsa_fops);register_reboot_notifier (&zcore_reboot_notifier);atomic_notifier_chain_register (&panic_notifier_list, &zcore_on_panic_notifier);
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] s390/zcore: Removed unused variables
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines
From: Heiko Carstens <[email protected]>
[ Upstream commit
0a2aa995c0a1d363b5f0803862e84834e3876ae2]allmodconfig with clang W=1 points out unused global variables:
drivers/s390/char/zcore.c:49:23: error: variable
'zcore_reipl_file' set but not used [-Werror,-Wunused-but-set-global]drivers/s390/char/zcore.c:50:23: error: variable
'zcore_hsa_file' set but not used [-Werror,-Wunused-but-set-global]
Quoted 6 lines
Remove both of them, since there is no point in keeping them.
Reviewed-by Christian Borntraeger <[email protected]>Signed-off-by Heiko Carstens <[email protected]>Signed-off-by Alexander Gordeev <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 dm-raid: only requeue bios when dm is suspending
In reply to Sasha LevinFrom: Benjamin Marzinski <[email protected]>
[ Upstream commit 97cb8be0fd4c50d310988e0822f7e91d1711e6f8 ]
returning DM_MAPIO_REQUEUE from the target map() function only requeues the bio during noflush suspends. During regular operations or during flushing suspends, it fails the bio. Failing the bio during flushing suspends is the correct behavior here. We cannot handle the bio, and we cannot suspends while it is outstanding. But during normal operations, we should not push the bio back to dm. Instead, wait for the reshape to be resumed.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: dm-raid: only requeue bios when dm is suspending
**Local tree:** Linux **6.18.43** (v6.18.43-1-gc7f0dac02d232)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [dm-raid] [fix/implied] — Only requeue bios when DM is suspending (reshape-interrupted I/O path).
### Step 1.2: Tags
**Record:**
- **Fixes:** — none
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** — none
- **Acked-by:** — none
- **Link:** — none
- **Cc: stable:** — none (expected for manual review)
- **Signed-off-by:** Benjamin Marzinski <[email protected]>, Mikulas Patocka <[email protected]>
No syzbot, no user bug reports in the message. Authors are dm/md maintainers.
### Step 1.3: Body analysis
**Record:**
- **Bug:** STRIPE_WAIT_RESHAPE in raid456 causes raid_map() to return DM_MAPIO_REQUEUE. That only requeues during **noflush** suspend; otherwise DM fails the bio with BLK_STS_IOERR.
- **Symptom:** Spurious I/O failures on dm-raid456 when reshape is interrupted and I/O crosses the reshape position during **normal** operation (not suspend).
- **Correct behavior:** During normal ops, wait on wait_for_reshape for reshape to resume. During suspend, abort/wake I/O so suspend can complete (deadlock avoidance).
- **Root cause:** STRIPE_WAIT_RESHAPE is returned unconditionally when reshape_interrupted(), without distinguishing suspend vs. normal operation.
### Step 1.4: Hidden bug fix?
**Record:** No — explicitly described as correcting when bios are requeued vs. failed. Real I/O-path bug fix, not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
| File | Change | |------|--------| | `drivers/md/md.h` | +1 enum flag `MD_DM_SUSPENDING`, doc comment | | `drivers/md/dm-raid.c` | Set/clear `MD_DM_SUSPENDING` in presuspend/postsuspend (+12 lines) | | `drivers/md/raid5.c` | Gate `STRIPE_WAIT_RESHAPE` on dm+suspending (+4 lines net) |
**Functions:** raid_presuspend, raid_presuspend_undo, raid_postsuspend, make_stripe_request **Scope:** Small, 3-file surgical fix.
### Step 2.2: Code flow (per hunk)
**Hunk 1 — raid_presuspend:** Before → only set RT_FLAG_RS_FROZEN. After → also set_bit(MD_DM_SUSPENDING) so raid5 knows DM suspend is in progress.
**Hunk 2 — raid_presuspend_undo:** Clears MD_DM_SUSPENDING if presuspend is rolled back.
**Hunk 3 — raid_postsuspend:** Clears MD_DM_SUSPENDING after suspend completes.
**Hunk 4 — make_stripe_request out path:** Before → always convert STRIPE_SCHEDULE_AND_RETRY + reshape_interrupted() to STRIPE_WAIT_RESHAPE. After → only convert when **not** dm-raid, **or** dm-raid **and** MD_DM_SUSPENDING is set. Otherwise keep STRIPE_SCHEDULE_AND_RETRY → caller waits on wait_for_reshape.
### Step 2.3: Bug mechanism
**Record:** **Logic/correctness fix** in dm-raid456 reshape I/O handling.
Broken path (present in 6.18.43):
1. Reshape interrupted; I/O crosses reshape position.
2. make_stripe_request → STRIPE_WAIT_RESHAPE.
3. raid5_make_request → md_free_cloned_bio, returns false.
4. md_handle_request (no gendisk, has prepare_suspend) → returns false.
5. raid_map → DM_MAPIO_REQUEUE.
6. dm_handle_requeue — not noflush suspending → BLK_STS_IOERR (bio failed).
Fix: During normal dm-raid ops, stay in STRIPE_SCHEDULE_AND_RETRY wait loop. Only take abort path during actual DM suspend.
### Step 2.4: Fix quality
**Record:** Obviously correct, minimal, matches existing prepare_suspend/wait_for_reshape design. Low regression risk — only narrows when STRIPE_WAIT_RESHAPE fires for dm-raid. Complements ff6b93410192b ("md: wake raid456 reshape waiters before suspend") already in this tree.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Buggy lines at raid5.c:6056-6059 blame to 19eef1d98eeda (tree import point; granular upstream history not available in this stable checkout). STRIPE_WAIT_RESHAPE and reshape_interrupted handling are present in 6.18.43.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:**
- ff6b93410192b — related suspend deadlock fix for native md (already in 6.18.43).
- raid_presuspend + prepare_suspend infrastructure present in current dm-raid.c.
- Commit under review **not** in this tree (MD_DM_SUSPENDING absent).
### Step 3.4: Author context
**Record:** Marzinski/Patocka are dm/md maintainers. Web search found prior dm-raid456 reshape deadlock/requeue discussion in the v6.7 regression series (Benjamin Marzinski proposing dm-raid requeue during suspend).
### Step 3.5: Dependencies
**Record:** Self-contained. Requires existing STRIPE_WAIT_RESHAPE, reshape_interrupted(), raid_presuspend/prepare_suspend — all present in 6.18.43. No series dependency.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig -c <hash> — **failed** (commit not in local git). b4 dig with author email — **failed**. No matching .mbx in workspace. lore.kernel.org — **blocked** (Anubis bot protection).
### Step 4.2: Reviewers
**Record:** UNVERIFIED — could not fetch mailing list thread.
### Step 4.3: Bug reports
**Record:** No Reported-by/Link in commit. Web search found related dm-raid456 reshape test failures (lvconvert-raid-reshape-stripes-load- reload.sh, lvconvert-repair-raid.sh) in the v6.7 regression thread — contextual, not a direct report for this exact patch.
### Step 4.4: Series context
**Record:** Part of ongoing dm-raid456 reshape I/O fixes. Standalone; does not require other unmerged patches.
### Step 4.5: Stable list
**Record:** UNVERIFIED — lore stable list inaccessible.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** make_stripe_request, raid5_make_request, md_handle_request, raid_map, dm_handle_requeue, raid_presuspend, raid5_prepare_suspend.
### Step 5.2: Callers
**Record:**
- raid_map ← dm target map (all dm-raid I/O)
- raid5_make_request ← md_handle_request ← raid_map
- raid_presuspend ← dm suspend path
All common block-I/O and device-mapper admin paths.
### Step 5.3: Callees
**Record:** wait_woken(&wait_for_reshape), prepare_suspend → wake_up(&conf->wait_for_reshape), dm_handle_requeue → __noflush_suspending().
### Step 5.4: Reachability
**Record:** Triggered when dm-raid456 reshape is interrupted and I/O hits the reshape boundary — realistic during lvconvert, table reload, reshape freeze. Userspace block I/O is the trigger. Not obscure or init- only.
### Step 5.5: Similar patterns
**Record:** mddev_is_dm() checks exist elsewhere in raid5.c. DM_MAPIO_REQUEUE only requeues under noflush suspend (dm.c:929-939). Same pattern as other dm-raid reshape fixes.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **YES.** Current tree at raid5.c:6056-6059:
```6056:6059:drivers/md/raid5.c
if (ret == STRIPE_SCHEDULE_AND_RETRY &&
reshape_interrupted(mddev)) {
bi->bi_status = BLK_STS_RESOURCE;
ret = STRIPE_WAIT_RESHAPE;
pr_err_ratelimited("dm-raid456: io across reshape
position while reshape can't make progress");
```MD_DM_SUSPENDING **not** present. raid_presuspend has prepare_suspend call but no suspending flag.
### Step 6.2: Backport difficulty
**Record:** **Clean apply** expected — small additive change, no conflicting refactors in these functions.
### Step 6.3: Duplicate fix?
**Record:** **None.** ff6b93410192b fixes native-md suspend deadlock; does not fix dm-raid normal-operation I/O failure.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
**Record:** drivers/md — device-mapper / md RAID. **Criticality:
IMPORTANT** (storage stack, LVM dm-raid users).
### Step 7.2: Activity
**Record:** Actively maintained; multiple recent stable backports in this tree (raid5 hang fixes, dm-raid NULL deref, reshape suspend fix).
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** dm-raid456 users (LVM raid target, reshaping arrays). Config-specific, but affects production storage setups.
### Step 8.2: Trigger conditions
**Record:** Reshape interrupted/frozen **and** I/O crosses reshape position **and** not in DM suspend. Moderately common during reshape admin operations. Unprivileged users can trigger via normal filesystem I/O on the dm device.
### Step 8.3: Failure severity
**Record:** Spurious BLK_STS_IOERR on in-flight I/O → application errors, possible failed LVM operations. **Severity: HIGH** for affected workloads (incorrect I/O failure, not kernel crash). Suspend deadlock is a separate issue addressed by related patches.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for dm-raid reshape users — prevents incorrect I/O failure.
- **Risk:** LOW — ~15 lines, internal flag, narrow condition change.
- **Ratio:** Strong benefit, minimal risk.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real bug in 6.18.43 — verified in source
- Incorrect I/O failure on production storage path
- Small, surgical, maintainer-authored fix
- Complements existing reshape suspend fix already in tree
- Obviously correct logic: wait during normal ops, abort only during suspend
- dm/md maintainers signed off
**AGAINST backport:**
- Affects dm-raid456 reshape edge case, not all kernel users
- No syzbot/user Reported-by in commit message
- Mailing list review not verified
**UNRESOLVED:**
- Original lore thread and explicit stable nomination not verified
- Exact upstream commit date/hash not in this checkout
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic verified in code; maintainer SOBs; no Tested-by
2. Fixes real bug affecting users? **PASS** — spurious I/O errors on dm- raid456 reshape
3. Important issue? **PASS** — incorrect I/O failure on storage path (HIGH)
4. Small and contained? **PASS** — ~15 lines, 3 files
5. No new features/APIs? **PASS** — internal MD_DM_SUSPENDING flag only
6. Can apply to local tree? **PASS** — all prerequisite code present; clean apply expected
### Step 9.3: Exception categories
**Record:** N/A — standard bug fix, not device-ID/quirk/build/doc exception.
### Step 9.4: Decision rationale
This commit fixes a real regression in dm-raid456: I/O that should block waiting for reshape resume is instead failed because DM_MAPIO_REQUEUE does not requeue outside noflush suspend. The buggy code exists in Linux 6.18.43, the fix is minimal and self-contained, and the failure mode (spurious I/O errors during reshape operations) matters to stable users running LVM dm-raid.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user-provided commit message
- **[Phase 2]** Read current raid5.c:6056-6060, dm- raid.c:3341-3360,3824-3867, md.c:395-426, dm.c:872-939,1446-1454
- **[Phase 2]** Traced STRIPE_WAIT_RESHAPE → md_free_cloned_bio → false → DM_MAPIO_REQUEUE → BLK_STS_IOERR path
- **[Phase 3]** git describe HEAD → v6.18.43
- **[Phase 3]** git blame -L 6056,6060 drivers/md/raid5.c → lines at tree base
- **[Phase 3]** git log --grep='only requeue bios' → not in tree
- **[Phase 3]** grep MD_DM_SUSPENDING → not in tree (fix not applied)
- **[Phase 3]** git log --oneline ff6b93410192b → related suspend fix present
- **[Phase 4]** b4 dig -c <hash> → failed (commit not local)
- **[Phase 4]** lore.kernel.org → blocked by Anubis
- **[Phase 4]** Web search → related dm-raid456 reshape context (v6.7 regression thread)
- **[Phase 5]** grep md_handle_request, STRIPE_WAIT_RESHAPE, prepare_suspend → call chain verified
- **[Phase 6]** Buggy unconditional STRIPE_WAIT_RESHAPE confirmed in 6.18.43
- **[Phase 6]** raid_presuspend/prepare_suspend infrastructure confirmed present
- **[Phase 8]** dm_handle_requeue noflush-only requeue behavior confirmed at dm.c:929-939
- **UNVERIFIED:** Mailing list review thread; explicit stable nomination; upstream commit SHA
**YES**The background searches finished and match what the earlier analysis already used:
- **Commit not in this tree** — no match for MD_DM_SUSPENDING or the subject line; the fix is still a candidate, not applied.
- **History** — STRIPE_WAIT_RESHAPE traces to the tree import point (19eef1d98eeda); no finer-grained upstream history in this 6.18.43 checkout.
- **kernel.org search** — no useful commit hit from the web grep.
**Verdict unchanged: YES** for backport to this 6.18.43 tree. The buggy path is present, and the patch is a small, low-risk fix for spurious I/O errors on dm-raid456 during interrupted reshape outside of suspend.
drivers/md/dm-raid.c | 6 ++++++ drivers/md/md.h | 2 ++ drivers/md/raid5.c | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-)
drivers/md/dm-raid.c +6 -0
@@ -3831,6 +3831,7 @@ static void raid_presuspend(struct dm_target *ti)* resume, raid_postsuspend() is too late. */ set_bit (RT_FLAG_RS_FROZEN , &rs->runtime_flags); +set_bit (MD_DM_SUSPENDING , &mddev->flags);if (!reshape_interrupted (mddev))return ;
@@ -3847,13 +3848,16 @@ static void raid_presuspend(struct dm_target *ti)static void raid_presuspend_undo (struct dm_target *ti) {struct raid_set *rs = ti->private; +struct mddev *mddev = &rs->md; +clear_bit (MD_DM_SUSPENDING , &mddev->flags);clear_bit (RT_FLAG_RS_FROZEN , &rs->runtime_flags); }static void raid_postsuspend (struct dm_target *ti) {struct raid_set *rs = ti->private; +struct mddev *mddev = &rs->md;if (!test_and_set_bit (RT_FLAG_RS_SUSPENDED , &rs->runtime_flags)) {/*
@@ -3864,6 +3868,8 @@ static void raid_postsuspend(struct dm_target *ti)mddev_suspend (&rs->md, false); rs->md.ro =MD_RDONLY ; } +clear_bit (MD_DM_SUSPENDING , &mddev->flags); + }static void attempt_restore_of_faulty_devices (struct raid_set *rs)
drivers/md/md.h +2 -0
@@ -343,6 +343,7 @@ struct md_cluster_operations;* @MD_HAS_SUPERBLOCK: There is persistence sb in member disks. * @MD_FAILLAST_DEV: Allow last rdev to be removed. * @MD_SERIALIZE_POLICY: Enforce write IO is not reordered, just used by raid1. +* @MD_DM_SUSPENDING: This DM raid device is suspending. * * change UNSUPPORTED_MDDEV_FLAGS for each array type if new flag is added */
@@ -362,6 +363,7 @@ enum mddev_flags {MD_HAS_SUPERBLOCK ,MD_FAILLAST_DEV ,MD_SERIALIZE_POLICY , + MD_DM_SUSPENDING, }; enum mddev_sb_flags {
drivers/md/raid5.c +5 -2
@@ -6054,8 +6054,11 @@ static enum stripe_result make_stripe_request(struct mddev *mddev,raid5_release_stripe (sh); out:if (ret ==STRIPE_SCHEDULE_AND_RETRY &&reshape_interrupted (mddev)) { - bi->bi_status =BLK_STS_RESOURCE ; - ret =STRIPE_WAIT_RESHAPE ; +if (!mddev_is_dm (mddev) || +test_bit (MD_DM_SUSPENDING , &mddev->flags)) { + bi->bi_status =BLK_STS_RESOURCE ; + ret =STRIPE_WAIT_RESHAPE ; + }pr_err_ratelimited ("dm-raid456: io across reshape position while reshape can't make progress" ); }return ret;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: cfg80211: validate rx/tx MLME callback frame lengths before access
In reply to Sasha LevinFrom: Zhao Li <[email protected]>
[ Upstream commit d5e4586546974179feca305a94e07fac3e9727fe ]
cfg80211_rx_mlme_mgmt() and cfg80211_tx_mlme_mgmt() call tracepoints before rejecting frames shorter than the frame-control field. After that, they only require len >= 2 before dispatching into subtype handlers that assume their fixed fields are present.
The frames that trip this are not shorter than 2 bytes; they are short relative to their subtype. mwifiex is a concrete in-tree example on the length side: mwifiex_process_mgmt_packet() only requires a 4-address ieee80211_hdr plus the 2-byte firmware length prefix before handing the frame to cfg80211_rx_mlme_mgmt(). After stripping the length prefix and removing addr4, pkt_len can be exactly 24: a bare 3-address management header with no reason-code body. The existing WARN_ON(len < 2) does not fire on such a frame, and cfg80211_process_deauth() then reads u.deauth.reason_code as a two-byte access starting at offset 24, immediately past the 24-byte buffer.
Add a frame-control length gate, then validate each subtype's minimum frame size in an if/else-if chain that mirrors the dispatch logic. Trace only after the frame is known to be well-formed.
Side effects of this change:
- The WARN_ON(len < 2) is dropped. It only guarded the frame_control read, never the subtype fixed fields, and it does not fire on the frames that actually trigger the out-of-bounds read (which are >= 2). The len >= 2 check is kept as the guard before dereferencing frame_control, but without the warning: these are exported callbacks and a malformed frame from a driver should be dropped silently rather than backtraced.
- cfg80211_tx_mlme_mgmt() previously routed every non-deauth subtype through disassociation handling; it now silently ignores unrecognised subtypes.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: wifi: cfg80211: validate rx/tx MLME callback frame lengths before access
**Local tree:** v6.18.44-1-g2736c32da98b9 (Linux **6.18.44**)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
**Record:** [wifi: cfg80211] [validate] — Add length validation for rx/tx MLME callback frames before accessing fixed subtype fields.
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
**Record:**
- **Link:** https://patch.msgid.link/20260707025336.22557-1- [email protected]
- **Assisted-by:** Codex:gpt-5.5, Claude:claude-opus-4.8
- **Signed-off-by:** Zhao Li <[email protected]>
- **Signed-off-by:** Johannes Berg <[email protected]> (cfg80211/mac80211 maintainer)
- **No** Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Cc:
[email protected]
- **Notable:** Maintainer sign-off; v2 series (patch 1/3) with Johannes Berg review noted in cover letter changelog
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
**Record:**
- **Bug:** cfg80211_rx_mlme_mgmt() and cfg80211_tx_mlme_mgmt() only check len >= 2 before dispatching to subtype handlers that read fixed fields (reason_code, status_code, etc.)
- **Symptom:** Out-of-bounds 2-byte read at offset 24 when a 24-byte management header (no body) is passed for deauth/disassoc
- **Concrete trigger:** mwifiex_process_mgmt_packet() can pass pkt_len == 24 after stripping addr4 from a minimal 4-address frame
- **Root cause:** Validation guards frame_control (2 bytes) but not per- subtype minimum sizes (26 bytes for deauth/disassoc)
- **Version info:** None explicit in message
### Step 1.4: DETECT HIDDEN BUG FIXES
**Record:** Not disguised — explicitly fixes out-of-bounds memory access. The WARN_ON removal and tx subtype routing change are documented side effects of the safety fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES **Record:**
- **File:** net/wireless/mlme.c only (+37 / -8 lines)
- **Functions modified:** cfg80211_rx_mlme_mgmt(), cfg80211_tx_mlme_mgmt()
- **Scope:** Single-file surgical fix
### Step 2.2: CODE FLOW CHANGE
**Record:**
**cfg80211_rx_mlme_mgmt() — before → after:**
- Before: trace → WARN_ON(len < 2) → dispatch by subtype → handlers read fixed fields
- After: check len >= sizeof(fc) → read fc → per-subtype offsetofend() validation → trace → dispatch
- Affected path: RX MLME frames from drivers (notably mwifiex host_mlme)
**cfg80211_tx_mlme_mgmt() — before → after:**
- Before: trace → WARN_ON(len < 2) → deauth or **everything else → disassoc**
- After: validate deauth/disassoc minimum lengths; unknown subtypes silently dropped
- Affected path: TX disconnect notifications from mac80211/mwifiex
### Step 2.3: BUG MECHANISM
**Record:**
- **Category:** Buffer overflow / out-of-bounds read (memory safety)
- **Mechanism:** cfg80211_process_deauth() reads mgmt->u.deauth.reason_code at offset 24–25:
```109:116:net/wireless/mlme.c
static void cfg80211_process_deauth(struct wireless_dev *wdev,
const u8 *buf, size_t len,
bool reconnect)
{
...
u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
``` Minimum valid deauth frame is 26 bytes (IEEE80211_DEAUTH_FRAME_LEN).
A 24-byte buffer causes a read 2 bytes past the end.
### Step 2.4: FIX QUALITY
**Record:**
- Fix is obviously correct: mirrors dispatch logic with offsetofend() checks, same pattern used elsewhere in ieee80211 code
- Minimal and surgical
- Low regression risk: only rejects malformed frames that were already unsafe to process
- Moving tracepoints after validation is correct
- tx path fix for unrecognized subtypes prevents wrongly routing auth frames to disassoc handler
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
**Record:** All lines in cfg80211_rx_mlme_mgmt() / cfg80211_tx_mlme_mgmt() blame to 5d324e5159d9e (6.18 merge base in this tree). Buggy insufficient-length check has been present since these functions landed in this tree.
### Step 3.2: FOLLOW THE FIXES: TAG
**Record:** No Fixes: tag present. N/A.
### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES **Record:**
- Recent mlme.c commits: c3ab9657866fc (radar detection fix), merge base
- This fix is **not** yet in the local tree (buggy code still present at lines 149–167, 213–230)
- Part of v2 3-patch series; **this commit is standalone** for the two cfg80211 callback functions (patches 2/3 fix cfg80211_rx_assoc_resp and ieee80211_rx_mgmt_deauth separately)
### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
**Record:** Zhao Li is not a regular mlme.c contributor in this tree. Johannes Berg (maintainer) signed off and merged.
### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS **Record:** No prerequisites. Uses standard offsetofend(struct ieee80211_mgmt, ...) which exists in this tree. Applies cleanly against current net/wireless/mlme.c.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: ORIGINAL PATCH DISCUSSION
**Record:**
- Local mbox: v2_20260707_enderaoelyther_wifi_cfg80211_validate_rx_tx_m lme_callback_frame_lengths_before_access.mbx
- v2 changelog documents Johannes Berg review feedback (commit message rewrite)
- lore.kernel.org blocked by Anubis bot protection; b4 dig -c could not be run (commit not in local tree)
- No review replies in local mbox (patches only)
### Step 4.2: WHO REVIEWED THE PATCH
**Record:** Johannes Berg reviewed v1 per v2 changelog ("Per Johannes' review"). Maintainer Signed-off-by on committed version.
### Step 4.3: BUG REPORT
**Record:** No external bug report or syzbot link. Bug identified via static/code-path analysis with concrete mwifiex trigger documented by author.
### Step 4.4: RELATED PATCHES AND SERIES
**Record:** 3-patch v2 series:
1. **This commit** — cfg80211 rx/tx MLME callbacks
2. cfg80211_rx_assoc_resp() length validation
3. ieee80211_rx_mgmt_deauth() read-before-check fix in mac80211
Patches 2/3 are related but **not required** for this commit to be correct and self-contained.
### Step 4.5: STABLE MAILING LIST HISTORY
**Record:** Could not search lore (blocked). No stable nomination found in local mbox.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: KEY FUNCTIONS
**Record:** cfg80211_rx_mlme_mgmt(), cfg80211_tx_mlme_mgmt(), callees cfg80211_process_auth/deauth/disassoc()
### Step 5.2: TRACE CALLERS
**Record:**
| Caller | File | Notes | |--------|------|-------| | `ieee80211_report_disconnect()` | `net/mac80211/mlme.c:4547-4549` | Always uses `IEEE80211_DEAUTH_FRAME_LEN` (26) buffers | | Auth failure paths | `net/mac80211/mlme.c:4878,4944,5045` | mac80211 validates before calling | | `mwifiex_process_mgmt_packet()` | `drivers/.../mwifiex/util.c:482` | **Can pass pkt_len == 24** | | `mwifiex_host_mlme_disconnect()` | `mwifiex/util.c:385` | Passes 26 bytes (safe) |
### Step 5.3: TRACE CALLEES
**Record:** Subtype handlers call nl80211_send_*, cfg80211_sme_*, read reason_code/status_code from frame body.
### Step 5.4: CALL CHAIN / REACHABILITY
**Record:**
1. WiFi firmware delivers management frame to mwifiex
2. mwifiex_process_mgmt_packet() strips 4-addr header → 24-byte 3-addr frame
3. If host_mlme_reg and deauth/disassoc: calls cfg80211_rx_mlme_mgmt(dev, skb->data, 24)
4. cfg80211_process_deauth() reads past buffer end
**Reachable from userspace indirectly:** Malicious or buggy AP/firmware can send short deauth/disassoc frames to mwifiex clients with host MLME enabled. Config-dependent (CONFIG_MWIFIEX, host_mlme firmware capability).
### Step 5.5: SIMILAR PATTERNS
**Record:** mac80211's ieee80211_rx_mgmt_deauth() has the same read- before-check pattern (reads reason_code before len check at line 5011 vs 5015) — fixed in patch 3/3 of the series, separate from this commit.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: DOES THE BUGGY CODE EXIST?
**Record:** **YES.** Current tree at net/wireless/mlme.c:149-167 and 213-230 has the insufficient WARN_ON(len < 2) check. mwifiex trigger path exists at util.c:398-482.
Verified minimum frame math:
- ieee80211_mgmt header = 24 bytes
- u.deauth.reason_code ends at byte 26
- mwifiex minimum after addr4 strip: sizeof(ieee80211_hdr) (30) − ETH_ALEN (6) = **24 bytes**
### Step 6.2: BACKPORT COMPLICATIONS
**Record:** Clean apply expected. Diff in local mbox matches current file structure. No conflicting recent changes to these functions.
### Step 6.3: RELATED FIXES ALREADY PRESENT?
**Record:** **No.** git log --grep and -S 'offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)' found no matching fix in this tree.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: SUBSYSTEM AND CRITICALITY
**Record:** net/wireless (cfg80211) — **CORE/IMPORTANT**. cfg80211 is the central wireless configuration API used by all mac80211 drivers and several fullmac drivers.
### Step 7.2: SUBSYSTEM ACTIVITY
**Record:** Actively maintained; recent stable backport c3ab9657866fc in this tree.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: WHO IS AFFECTED
**Record:** Users of WiFi drivers calling cfg80211_rx_mlme_mgmt() / cfg80211_tx_mlme_mgmt(). Primary concrete trigger: **mwifiex with host MLME** (several SDIO device tables set host_mlme = true). mac80211 callers are generally safe due to IEEE80211_DEAUTH_FRAME_LEN usage.
### Step 8.2: TRIGGER CONDITIONS
**Record:**
- Receiving deauth/disassoc/auth frame with header only (no body) via mwifiex host_mlme path
- Requires connected state and matching BSSID checks in mwifiex
- Not every boot, but plausible with malformed AP traffic or firmware quirks
- Unprivileged remote trigger via WiFi network (AP sends short frame)
### Step 8.3: FAILURE MODE SEVERITY
**Record:** Out-of-bounds kernel memory read — **HIGH** severity
- KASAN: detectable crash
- Production without KASAN: potential info leak or unpredictable behavior
- Not a typical controlled write primitive, but real memory safety bug in core wireless path
### Step 8.4: RISK-BENEFIT RATIO
**Record:**
- **Benefit:** HIGH — prevents OOB read in exported cfg80211 API; defense-in-depth for all drivers
- **Risk:** LOW — ~37 lines, validation-only, maintainer-reviewed
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: EVIDENCE COMPILED
**FOR backport:**
- Real out-of-bounds read verified in code and frame-size math
- Concrete in-tree trigger path (mwifiex host_mlme, 24-byte frames)
- Small, surgical, maintainer-signed fix
- Buggy code confirmed present in 6.18.44 tree
- Fixes incorrect tx subtype routing (non-deauth → disassoc) that could cause same class of bug
- Exported API should validate inputs from drivers
**AGAINST backport:**
- No syzbot report or user crash report (theoretical/code-analysis discovery)
- Trigger requires specific driver config (mwifiex host_mlme)
- Related bugs in patches 2/3 not included (but separate functions)
**UNRESOLVED:**
- Full lore review thread (blocked by Anubis)
- Whether any reviewer explicitly nominated for stable
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — standard offsetofend validation; maintainer reviewed v2
2. Fixes a real bug? **PASS** — verified OOB read with mwifiex trigger path
3. Important issue? **PASS** — kernel memory safety (OOB read), HIGH severity
4. Small and contained? **PASS** — 1 file, ~37 lines
5. No new features or APIs? **PASS** — validation only
6. Can apply to local tree? **PASS** — code present, clean apply expected
### Step 9.3: EXCEPTION CATEGORIES
**Record:** None (not device ID, quirk, DT, build, or docs). Standard memory-safety bug fix.
### Step 9.4: DECISION RATIONALE
This commit fixes a verified out-of-bounds read in exported cfg80211 MLME callbacks. The buggy code exists in Linux 6.18.44, the fix is small and maintainer-approved, and a concrete in-tree caller (mwifiex host_mlme) can trigger it with 24-byte deauth/disassoc frames. While the trigger is config-specific, cfg80211 is a core API that should reject malformed driver input — making this appropriate for the 6.18.y stable tree.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user query and local mbox
- **[Phase 2]** Read current net/wireless/mlme.c:109-167,213-230; confirmed OOB read at reason_code with 24-byte buffer
- **[Phase 2]** Computed frame sizes: header=24, deauth offsetofend=26, auth offsetofend=30
- **[Phase 3]** git describe HEAD: v6.18.44; git blame: buggy code at 5d324e5159d9e
- **[Phase 3]** git log --grep / -S offsetofend: fix not in tree
- **[Phase 4]** Read local mbox v2_20260707_enderaoelyther_*.mbx; v2 Johannes Berg review noted
- **[Phase 4]** lore.kernel.org fetch: blocked (Anubis)
- **[Phase 4]** b4 dig -c: not attempted (commit not in tree)
- **[Phase 5]** grep cfg80211_rx_mlme_mgmt: callers in mac80211 (safe, 26-byte) and mwifiex (unsafe path at util.c:482)
- **[Phase 5]** Read mwifiex/util.c:398-482: verified pkt_len can be 24 after addr4 removal
- **[Phase 5]** Read ieee80211.h:1162-1207: confirmed struct layout
- **[Phase 5]** IEEE80211_DEAUTH_FRAME_LEN = 26 in net/mac80211/ieee80211_i.h:85
- **[Phase 6]** Buggy code confirmed present; fix absent
- **[Phase 6]** sizeof(struct ieee80211_hdr) = 30 (includes addr4); 30−6=24 minimum after strip
- **[Phase 8]** Failure mode: OOB read, HIGH severity
**YES**The background git log -S 'cfg80211_rx_mlme_mgmt' search finished. In this 6.18.44 tree it only surfaced merge commits — notably 5d324e5159d9e — and git blame attributes the current cfg80211_rx_mlme_mgmt() / cfg80211_tx_mlme_mgmt() code to that same point. That’s enough to confirm the buggy validation has been present since these functions landed here; it doesn’t change the backport call.
**Verdict for this tree: YES** — the out-of-bounds read in cfg80211 MLME callbacks is real, reachable via mwifiex host_mlme with 24-byte frames, and the fix is small and maintainer-reviewed.
net/wireless/mlme.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-)
net/wireless/mlme.c +37 -8
@@ -164,19 +164,35 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len) {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;lockdep_assert_wiphy (wdev->wiphy); -trace_cfg80211_rx_mlme_mgmt (dev, buf, len); +if (len <sizeof (fc)) +return ; + + fc = mgmt->frame_control; -if (WARN_ON (len <2 )) +if (ieee80211_is_auth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.auth.status_code)) +return ; + }else if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } + +trace_cfg80211_rx_mlme_mgmt (dev, buf, len); -if (ieee80211_is_auth (mgmt->frame_control)) +if (ieee80211_is_auth (fc))cfg80211_process_auth (wdev, buf, len); -else if (ieee80211_is_deauth (mgmt->frame_control)) +else if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, false); -else if (ieee80211_is_disassoc (mgmt->frame_control)) +else cfg80211_process_disassoc (wdev, buf, len, false); }EXPORT_SYMBOL (cfg80211_rx_mlme_mgmt);
@@ -229,15 +245,28 @@ void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;lockdep_assert_wiphy (wdev->wiphy); -trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); +if (len <sizeof (fc)) +return ; -if (WARN_ON (len <2 )) + fc = mgmt->frame_control; + +if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } + +trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); -if (ieee80211_is_deauth (mgmt->frame_control)) +if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, reconnect);else cfg80211_process_disassoc (wdev, buf, len, reconnect);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: mt76: transform aspm_conf for pci_disable_link_state
In reply to Sasha LevinFrom: Jiajia Liu <[email protected]>
[ Upstream commit 2dd78856223484895306351df1f903a4b75d213f ]
commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") changed PCIE_LINK_STATE_L0S (1) to (BIT(0) | BIT(1)). PCI_EXP_LNKCTL_ASPM_L0S (1) and PCI_EXP_LNKCTL_ASPM_L1 (2) are no longer matched with PCIE_LINK_STATE_L0S (3) and PCIE_LINK_STATE_L1 (4).
On the platform enabling ASPM L0s and L1, mt76_pci_disable_aspm is not able to disable L1. Fix this by transforming aspm_conf to pcie link state.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [wifi: mt76] [transform] — Convert PCI LNKCTL ASPM register bits to PCIE_LINK_STATE_* values before calling pci_disable_link_state().
### Step 1.2: Commit Message Tags
**Record:**
- **Signed-off-by:** Jiajia Liu <[email protected]> (author)
- **Link:**
https://patch.msgid.link/[email protected]
- **Signed-off-by:** Felix Fietkau <[email protected]> (mt76 maintainer)
- No Fixes:, Reported-by:, Cc: stable, Tested-by:, or Reviewed- by: tags
- References upstream commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") as the change that broke the existing code
### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** mt76_pci_disable_aspm() passes raw PCI_EXP_LNKCTL register bits (aspm_conf) directly to pci_disable_link_state(), but after b478e162f227 the PCIE_LINK_STATE_* constants no longer match those register bit positions.
- **Symptom:** On platforms with ASPM L0s and L1 enabled, L1 cannot be disabled via pci_disable_link_state(); the function returns success and exits early.
- **Root cause:** PCIE_LINK_STATE_L0S changed from 1 to 3 (BIT(0)|BIT(1)); PCIE_LINK_STATE_L1 changed from 2 to 4 (BIT(2)). PCI_EXP_LNKCTL_ASPM_L0S/L1 remain 1/2.
- **Version info:** Regression tied to b478e162f227 (merged May 2024).
### Step 1.4: Hidden Bug Fix Detection
**Record:** Yes — despite the neutral "transform" wording, this is a functional regression fix. The driver was written to disable ASPM because it causes MCU hangs and WiFi instability on mt76 hardware; the broken mapping silently leaves L1 active.
---
## Phase 2: Diff Analysis
### Step 2.1: Change Inventory
**Record:**
- **Files:** drivers/net/wireless/mediatek/mt76/pci.c only (+7 / -1)
- **Function modified:** mt76_pci_disable_aspm()
- **Scope:** Single-file surgical fix
### Step 2.2: Code Flow Change
**Record:**
- **Before:** pci_disable_link_state(pdev, aspm_conf) where aspm_conf holds PCI_EXP_LNKCTL bits (e.g. 0x3 for L0s+L1).
- **After:** Build state by mapping register bits to API constants:
- PCI_EXP_LNKCTL_ASPM_L0S → PCIE_LINK_STATE_L0S
- PCI_EXP_LNKCTL_ASPM_L1 → PCIE_LINK_STATE_L1
- Then call pci_disable_link_state(pdev, state).
- **Path affected:** Normal probe path when CONFIG_PCIEASPM is enabled and the OS has ASPM control.
### Step 2.3: Bug Mechanism
**Record:** **Logic/correctness fix — API value mismatch regression.**
When aspm_conf = 0x3 (L0s+L1 in LNKCTL):
- Broken: pci_disable_link_state(pdev, 0x3) sets link->aspm_disable |= 0x3
- In pcie_config_aspm_link(): state &= (link->aspm_capable & ~link->aspm_disable) — bits 0 and 1 are cleared, but PCIE_LINK_STATE_L1 is BIT(2) = 4, which is **not** cleared
- Function returns 0 (success) and exits early — L1 remains enabled
When aspm_conf = 0x2 (L1 only): aspm_disable |= 2 does not map to PCIE_LINK_STATE_L1 (4) — L1 not disabled.
### Step 2.4: Fix Quality
**Record:** Obviously correct — matches how every other driver in the tree calls pci_disable_link_state() (using PCIE_LINK_STATE_* constants, not register values). Minimal, no new APIs, very low regression risk.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Buggy pci_disable_link_state(pdev, aspm_conf) call introduced in f37f05503575c (Oct 2019, "mt76: mt76x2e: disable pcie_aspm by default"). Worked correctly until b478e162f227 changed the PCIE_LINK_STATE_* definitions.
### Step 3.2: Fixes Tag
**Record:** N/A — no Fixes: tag. Referenced commit b478e162f227 is confirmed in this tree (git merge-base --is-ancestor succeeds).
### Step 3.3: Related File History
**Record:** pci.c has only 3 commits in this tree. No related fix already applied. The fix commit itself is not yet in stable/linux-6.18.y.
### Step 3.4: Author Context
**Record:** Jiajia Liu has other kernel contributions. Felix Fietkau (mt76 maintainer) Signed-off-by on the patch.
### Step 3.5: Dependencies
**Record:** Requires b478e162f227 (present in tree). Standalone — no series dependencies. Applies cleanly to current pci.c.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Patch Discussion
**Record:** b4 am [email protected] found thread at
https://patch.msgid.link/[email protected].
Single-message thread (initial submission only); no review replies or stable nominations in the mbox.
### Step 4.2: Reviewers
**Record:** b4 am reported 0 code-review messages. Felix Fietkau maintainer sign-off in the patch itself.
### Step 4.3: Bug Report
**Record:** No external bug report or syzbot link. Bug identified via code analysis of the b478e162f227 API change impact.
### Step 4.4: Related Patches
**Record:** Standalone 1-patch fix. mt76 is the only driver passing raw LNKCTL values to pci_disable_link_state() (verified via grep).
### Step 4.5: Stable List History
**Record:** Not searched — no stable discussion found in the patch thread. Not applicable as a negative signal.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** mt76_pci_disable_aspm() modified.
### Step 5.2: Callers
**Record:** Called during PCI probe from:
- mt76x0/pci.c, mt76x2/pci.c — always
- mt7615/pci.c, mt7915/pci.c, mt7996/pci.c — always
- mt7921/pci.c, mt7925/pci.c — when disable_aspm module param is set (default false)
### Step 5.3: Callees
**Record:** pci_disable_link_state() → __pci_disable_link_state() → sets link->aspm_disable and calls pcie_config_aspm_link(). Fallback:pcie_capability_clear_word() on LNKCTL if API call fails.
### Step 5.4: Reachability
**Record:** Triggered at device probe on systems with CONFIG_PCIEASPM and ASPM enabled in firmware/BIOS — common on laptops and desktops. Not userspace-triggerable, but affects every boot/probe of affected mt76 hardware.
### Step 5.5: Similar Patterns
**Record:** All other pci_disable_link_state() callers use PCIE_LINK_STATE_* constants correctly. mt76 is the sole offender.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy Code Present?
**Record:** **Yes.** Local tree is **v6.18.44** (stable/linux-6.18.y). Buggy code at line 34 of pci.c. Regression commit b478e162f227 is an ancestor of HEAD.
### Step 6.2: Backport Complications
**Record:** Clean apply expected — no conflicting changes to this function in 6.18.y.
### Step 6.3: Fix Already Present?
**Record:** No — fix not in tree. git log --grep='transform aspm_conf' returns nothing.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem Criticality
**Record:** drivers/net/wireless/mediatek/mt76 — IMPORTANT (WiFi driver, multiple widely-used MediaTek chips).
### Step 7.2: Activity Level
**Record:** Actively maintained; mt76 is a core WiFi driver family with ongoing development.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Users of mt76x0, mt76x2, mt7615, mt7915, mt7996 PCI WiFi devices (always calls ASPM disable). mt7921/mt7925 users who set disable_aspm=1. Config-dependent on CONFIG_PCIEASPM and platform ASPM settings.
### Step 8.2: Trigger Conditions
**Record:** Device probe on platforms with ASPM L0s and/or L1 enabled in PCI config — common default on modern systems. Not timing-dependent.
### Step 8.3: Failure Mode Severity
**Record:** **HIGH** functional impact — ASPM L1 remains active when the driver intends to disable it. Original 2019 commit documented this causes "continuous mcu hangs and instability" on mt76 hardware. Not a kernel oops, but serious WiFi reliability regression.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for affected mt76 users — restores intended ASPM disabling behavior
- **Risk:** VERY LOW — 6-line mapping fix, maintainer-approved, matches established driver patterns
- **Ratio:** Strongly favors backport
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real regression from b478e162f227 (in tree since v6.9)
- Prevents ASPM L1 disable on mt76 — known to cause MCU hangs/instability
- Small, surgical, maintainer-signed fix
- Buggy code and prerequisite both present in v6.18.44
- Only driver in tree with this incorrect usage pattern
**AGAINST backport:**
- No syzbot report or user bug report filed
- mt7921/mt7925 only affected when module param set
- Not a security issue or kernel crash
**Unresolved:** No review-thread discussion beyond initial submission.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — mapping is verifiably correct; maintainer SOB
2. Fixes a real bug? **PASS** — regression from PCI API change
3. Important issue? **PASS** — WiFi instability on affected hardware (HIGH functional)
4. Small and contained? **PASS** — 7 lines, 1 file
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — prerequisite present, clean apply
### Step 9.3: Exception Categories
**Record:** Hardware workaround — restoring ASPM disable that prevents known hardware instability. Qualifies under quirk/workaround exception.
### Step 9.4: Decision Rationale
This is a clear regression fix for the locally checked-out **6.18.y** tree. Commit b478e162f227 changed PCIE_LINK_STATE_* semantics; mt76 was the only driver still passing raw LNKCTL register values. The result is that pci_disable_link_state() returns success without actually disabling L1, leaving mt76 devices exposed to the exact ASPM-related instability the driver was designed to prevent. The fix is minimal, correct, and maintainer-approved.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified regression from b478e162f227
- [Phase 2] Read diff: 7 lines in mt76_pci_disable_aspm(), maps LNKCTL bits to PCIE_LINK_STATE_*
- [Phase 2] Verified values: PCI_EXP_LNKCTL_ASPM_L0S=1, L1=2; PCIE_LINK_STATE_L0S=3, L1=4 in include/linux/pci.h
- [Phase 2] Traced pcie_config_aspm_link() line 961: state &= (capable & ~aspm_disable) — confirmed L1 (bit 2) not cleared when aspm_disable=0x3
- [Phase 3] git describe HEAD: v6.18.44
- [Phase 3] git merge-base --is-ancestor b478e162f227 HEAD: confirmed present
- [Phase 3] git show b478e162f227^:include/linux/pci.h: old PCIE_LINK_STATE_L0S=BIT(0), L1=BIT(1) matched register bits
- [Phase 3] git blame pci.c:34: introduced in f37f05503575c (2019)
- [Phase 3] Fix not in tree: git log --grep='transform aspm_conf' empty
- [Phase 4] b4 am 20260602054349...: found patch thread, 1 message, Felix Fietkau SOB
- [Phase 5] grep mt76_pci_disable_aspm: 7 call sites across mt76 PCI drivers
- [Phase 5] grep pci_disable_link_state: mt76 is sole driver passing register values
- [Phase 6] Buggy code confirmed at pci.c:34 in v6.18.44
- [Phase 6] b478e162f227 on stable/linux-6.18.y via grep of branch log
- [Phase 8] Original commit f37f05503575c message documents ASPM causes "mcu hangs and instability"
**YES**The background checks finished and match the earlier analysis:
- **Stable branch search:** b478e162f227d ("PCI/ASPM: Consolidate link state defines") is on stable/linux-6.18.y, so the regression this mt76 fix addresses is present in your v6.18.44 tree.
- **Author history:** Jiajia Liu has other kernel fixes (Bluetooth, mt76, btmtk, i915); Felix Fietkau signed off on this patch.
**Verdict unchanged: YES** — backport the fix to restore correct ASPM disabling on mt76 PCI WiFi devices.
drivers/net/wireless/mediatek/mt76/pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/pci.c +7 -1
@@ -30,8 +30,14 @@ void mt76_pci_disable_aspm(struct pci_dev *pdev)if (IS_ENABLED (CONFIG_PCIEASPM )) {int err; +int state =0 ; - err =pci_disable_link_state (pdev, aspm_conf); +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L0S ) + state |=PCIE_LINK_STATE_L0S ; +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L1 ) + state |=PCIE_LINK_STATE_L1 ; + + err =pci_disable_link_state (pdev, state);if (!err)return ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
In reply to Sasha LevinFrom: ikaros <[email protected]>
[ Upstream commit 0e2021f49e64b3c8a9aa880d0c62a218bfe147ce ]
Add overflow check for Index + Length to prevent integer overflow when calculating the truncation length. This prevents negative size parameter being passed to memcpy().
---
LLM Generated explanations, may be completely bogus:
The background author/search finished. A search for ikaros/void0red in this tree only turned up unrelated error-path hardening commits (hwmon, thermal, ACPICA debug checks, etc.) — not the MidOp overflow fix. That fix exists only on master as 0e2021f49e64b and is still missing from stable/linux-6.18.y at v6.18.44.
That matches the earlier analysis: the vulnerable code is present, the one-line patch applies cleanly, and the backport recommendation remains **YES**.
drivers/acpi/acpica/exoparg3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/exoparg3.c +1 -1
@@ -152,7 +152,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)/* Truncate request if larger than the actual String/Buffer */ - else if ((index + length) > operand[0]->string.length) { + else if ((index + length) > operand[0]->string.length || (index + length) < index) { /* Check for overflow */ length = (acpi_size )operand[0 ]->string.length - (acpi_size )index;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 usb: gadget: udc: skip pullup() if already connected
In reply to Sasha LevinFrom: Xu Yang <[email protected]>
[ Upstream commit 62911bc82b0332aee7546156800d3516500fa1e1 ]
The device controller may update vbus status via usb_udc_vbus_handler(), which tries to connect the gadget even though gadget_bind_driver() has already called usb_udc_connect_control_locked(). This causes pullup() to be called twice. Avoid this by checking if gadget->connected is true.
This also set gadget->connected as false in usb_gadget_activate() if it became connected while it was being deactivated. Otherwise, usb_gadget_connect_locked will return early and pullup() won't be called.
---
LLM Generated explanations, may be completely bogus:
The background git log -S search finished. In this **v6.18.43** checkout the history is flattened, so pickaxe only points at 19eef1d98eeda for vbus_work in core.c — it doesn’t show when that logic was really introduced. That matches what we already inferred from
mainline: the dual connect path dates to the 2023 usb_udc_vbus_handler workqueue offload.
That doesn’t change the backport call: the buggy code is present in this tree, the fix is small and applies cleanly, and the verdict remains **YES**.
drivers/usb/gadget/udc/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/core.c +6 -1
@@ -714,6 +714,9 @@ static int usb_gadget_connect_locked(struct usb_gadget *gadget) goto out; } +if (gadget->connected) + goto out; +if (gadget->deactivated || !gadget->udc->allow_connect || !gadget->udc->started) {/* * If the gadget isn't usable (because it is deactivated,
@@ -887,8 +890,10 @@ int usb_gadget_activate(struct usb_gadget *gadget)* If gadget has been connected before deactivation, or became connected * while it was being deactivated, we call usb_gadget_connect(). */ -if (gadget->connected) +if (gadget->connected) { + gadget->connected = false; ret =usb_gadget_connect_locked (gadget); + } unlock:mutex_unlock (&gadget->udc->connect_lock);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: mvm: fix a possible underflow
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 0cb5260a1027a43f8cdb961e128f2ddd42e46832 ]
We shouldn't trust the firmware about the length of the wowlan packet.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: wifi: iwlwifi: mvm: fix a possible underflow
**Local tree:** Linux **6.18.44** (v6.18.44-2-g1b9e1abadee04)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [wifi: iwlwifi: mvm] [fix] — validate WoWLAN wake-packet size from firmware before arithmetic/copy to prevent integer underflow.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Emmanuel Grumbach <[email protected]> (author)
- **Signed-off-by:** Miri Korenblit <[email protected]> (iwlwifi maintainer)
- **Link:** https://patch.msgid.link/20260715215523.fbd989cc85e2...
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Cc: stable, or syzbot tags
- Part of series [PATCH 14/15] in 20260715_miriam_rachel_korenblit_wifi_iwlwifi_fixes_07_15_2026.mbx
### Step 1.3: Body
**Record:**
- **Bug:** Driver trusts firmware-reported WoWLAN wake-packet length (wake_packet_bufsize) without validating it is large enough for header/crypto overhead.
- **Symptom:** Integer underflow on pktsize -= hdrlen / pktsize -= ivlen + icvlen, then skb_put_data() with a huge effective size → kernel crash on WoWLAN resume.
- **Root cause:** Missing bounds checks before subtracting lengths from pktsize.
- **Version info:** None in message; wake-packet path dates to 2022.
### Step 1.4: Hidden bug fix?
**Record:** No — explicitly labeled “fix a possible underflow”; clearly a firmware-validation / memory-safety fix, not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/net/wireless/intel/iwlwifi/mvm/d3.c (+15 / −4)
- **Function:** iwl_mvm_report_wakeup_reasons()
- **Scope:** Single-file, surgical fix in WoWLAN wake-packet handling
### Step 2.2: Code flow change
**Record:**
| Hunk | Before | After | |------|--------|-------| | Early guard | Dereference `hdr->frame_control` immediately | `WARN_ON_ONCE(pktsize < sizeof(*hdr)); return;` before further header use | | Data-frame path | Copy header (`skb_put_data`) before validating total size | Validate `pktsize > hdrlen + ivlen + icvlen` via `IWL_FW_CHECK`, then copy | | Underflow site | `pktsize -= ivlen + icvlen` without prior size check | Same subtraction only after validation |
### Step 2.3: Bug mechanism
**Record:** **Integer underflow / out-of-bounds access (memory safety).**
- pktsize is int; subtracting hdrlen, ivlen, icvlen when firmware reports a too-small value makes pktsize negative.
- skb_put_data(pkt, pktdata, pktsize) treats size as unsigned → ~4 GB copy attempt.
- Header fields are read before validating minimum buffer size.
- Complements 2d5dec517b539 (validates notification at store time); this validates again at report time.
### Step 2.4: Fix quality
**Record:** Obviously correct, minimal, matches existing IWL_FW_CHECK patterns in iwlwifi. Low regression risk.
- **Minor concern:** Early return skips ieee80211_report_wowlan_wakeup() (unlike goto report on alloc failure). Acceptable trade-off to avoid processing corrupt firmware data.
- **Note:** Current tree has icvlen = 0; truncated -= icvlen; ordering at lines 1548–1550 (subtracts after zeroing). This commit does not fix that; separate issue.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Wake-packet handling in iwl_mvm_report_wakeup_reasons() traces to merge 5d324e5159d9e (v6.18 base). Original wake-packet support in commit 219ed58feda9 (Sep 2022) already had unchecked pktsize arithmetic. Bug present since feature introduction.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:**
- 2d5dec517b539 — related wake-packet notification validation; **already in this tree**
- dd90880eb5ec5 — OOB read fix in iwl_mvm_nd_match_info_handler()
- Patch 15/15 (ND match struct sizing) is **independent**; patch 14/15 is standalone
### Step 3.4: Author context
**Record:** Emmanuel Grumbach is a core iwlwifi developer; July 2026 series is a batch of firmware-validation hardening fixes. Miri Korenblit is iwlwifi maintainer.
### Step 3.5: Dependencies
**Record:** No prerequisites. IWL_FW_CHECK exists in fw/dbg.h. Self- contained; does not need patch 15/15.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** Local mbox 20260715_miriam_rachel_korenblit_wifi_iwlwifi_fixes_07_15_2026.mbx, patch 14/15. Cover letter lists it under “bugfixes.” b4 dig -c 2d5dec517b539 worked for the related patch; direct b4 dig on this commit hash unavailable (not yet committed upstream in this checkout). Lore URL blocked by bot protection.
### Step 4.2: Reviewers
**Record:** Series cover shows Intel iwlwifi maintainers as authors; no explicit review thread found in local mbox for patch 14.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link. Intel-internal firmware-trust hardening, consistent with related fixes in the same series.
### Step 4.4: Series context
**Record:** Patch 14/15 of 15; independent of patch 15/15 (struct layout change).
### Step 4.5: Stable list history
**Record:** No stable-list discussion found. Not a negative signal.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** iwl_mvm_report_wakeup_reasons() (modified)
### Step 5.2: Callers
**Record:**
- iwl_mvm_query_wakeup_reasons() → called from D3 resume path (~line 2770)
- Triggered on **system resume from suspend** when WoWLAN wakes the host
- Requires CONFIG_PM, CONFIG_IWLMVM, WoWLAN enabled
### Step 5.3: Callees
**Record:** WARN_ON_ONCE, IWL_FW_CHECK, alloc_skb, skb_put_data, ieee80211_data_to_8023, kfree_skb, ieee80211_report_wowlan_wakeup
### Step 5.4: Reachability
**Record:** Reachable on every WoWLAN wakeup with a wake packet on Intel MVM hardware — common laptop suspend/resume path. Not userspace- triggerable directly, but affects all WoWLAN users on resume.
### Step 5.5: Similar patterns
**Record:** Same series and tree already have multiple IWL_FW_CHECK validations (mvm/tx.c, mvm/rxmq.c, mld/tx.c). This follows established iwlwifi defensive pattern.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.44)
### Step 6.1: Buggy code present?
**Record:** **YES.** Lines 1508–1559 in d3.c lack the proposed checks. Underflow path is live.
### Step 6.2: Backport complications
**Record:** **Clean apply.** Patch 14 hunks applied to d3.c with +7 line offset. No structural conflicts.
### Step 6.3: Related fixes already present?
**Record:** 2d5dec517b539 (notification-time validation) is in tree. This underflow fix is **not** present (grep "pktsize is too small" only in mbox).
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem / criticality
**Record:** drivers/net/wireless/intel/iwlwifi/mvm — **IMPORTANT** (Intel WiFi on a large share of laptops/desktops).
### Step 7.2: Activity
**Record:** Actively maintained; several iwlwifi validation fixes already backported to this 6.18.y tree in 2026.
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** Intel WiFi users with WoWLAN (CONFIG_IWLMVM + PM). Large population on laptops.
### Step 8.2: Trigger conditions
**Record:** Firmware reports wake_packet_bufsize smaller than actual 802.11 header + IV/ICV overhead during WoWLAN wakeup. Requires firmware bug or corruption; rare but plausible. Not unprivileged-userspace- triggerable.
### Step 8.3: Failure severity
**Record:** Integer underflow → massive skb_put_data() → **kernel oops/panic on resume** — **CRITICAL** for affected path.
### Step 8.4: Risk/benefit
**Record:**
- **Benefit:** HIGH — prevents crash on WoWLAN resume
- **Risk:** LOW — ~15 lines, defensive checks only, established macro
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR:**
- Real integer underflow → crash on resume
- Buggy code confirmed in 6.18.44 tree
- Small, surgical, obviously correct
- Complements existing backport 2d5dec517b539
- Applies cleanly
- iwlwifi maintainer authorship
- Matches stable firmware-validation pattern
**AGAINST:**
- Requires firmware misreporting (not syzbot-proven)
- Early return drops wakeup report on corrupt packet (minor, vs. crash)
- icvlen/truncated ordering bug in current tree is separate (not introduced by this patch)
**UNRESOLVED:** No public review thread or syzbot reproducer (not needed for decision).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic verified; maintainer- signed
2. Fixes a real bug? **PASS** — demonstrated underflow path
3. Important issue? **PASS** — resume-time kernel crash
4. Small and contained? **PASS** — one function, ~19 lines
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — verified clean apply
### Step 9.3: Exception category
**Record:** N/A (not device ID, quirk, DT, docs, or build fix — standard bug fix).
### Step 9.4: Decision rationale
For Linux **6.18.44**, the vulnerable WoWLAN wake-packet code is present and unpatched. Malicious or buggy firmware length fields can underflow pktsize and crash the kernel during suspend resume — a high-severity, low-risk fix that belongs in stable.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user query and mbox patch 14/15
- **[Phase 1]** Confirmed patch 14/15 in 20260715_miriam_rachel_korenblit_wifi_iwlwifi_fixes_07_15_2026.mbx
- **[Phase 2]** Read d3.c lines 1454–1588; confirmed missing validation
- **[Phase 2]** Simulated underflow: pktsize=10, hdrlen=24 → pktsize=-34 → 4294967262 unsigned
- **[Phase 3]** git describe HEAD → v6.18.44-2-g1b9e1abadee04; Makefile 6.18.44
- **[Phase 3]** git blame lines 1508–1560 → merge 5d324e5159d9e
- **[Phase 3]** git show 219ed58feda9 → wake packet support from Sep 2022 with same unchecked arithmetic
- **[Phase 3]** git show 2d5dec517b539 → related fix already in tree
- **[Phase 3]** git log --oneline -20 -- drivers/net/wireless/intel/iwlwifi/mvm/d3.c → fix not present
- **[Phase 4]** Read cover letter: listed as “bugfixes”, patch 14/15 standalone
- **[Phase 4]** b4 dig -c 2d5dec517b539 → lore URL for related patch
- **[Phase 4]** WebFetch lore URL → blocked (bot protection); relied on local mbox
- **[Phase 5]** Traced call chain: resume → iwl_mvm_query_wakeup_reasons → iwl_mvm_report_wakeup_reasons
- **[Phase 5]** grep IWL_FW_CHECK → macro present in fw/dbg.h
- **[Phase 6]** grep "pktsize is too small" → only in mbox, not in tree
- **[Phase 6]** git apply --check on patch 14 d3.c hunks → succeeded (offset +7)
- **[Phase 6]** Confirmed iwl_mvm_wowlan_store_wake_pkt and wake- packet path exist
- **[Phase 8]** Assessed severity: resume crash on WoWLAN path
**YES**
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +15 -4
@@ -1516,6 +1516,10 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,if (WARN_ON_ONCE (truncated <0 )) truncated =0 ; +/* this would be a firmware bug */ +if (WARN_ON_ONCE (pktsize <sizeof (*hdr))) +return ; +if (ieee80211_is_data (hdr->frame_control)) {int hdrlen =ieee80211_hdrlen (hdr->frame_control);int ivlen =0 , icvlen =4 ;/* also FCS */
@@ -1524,10 +1528,6 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,if (!pkt) goto report; -skb_put_data (pkt, pktdata, hdrlen); - pktdata += hdrlen; - pktsize -= hdrlen; -if (ieee80211_has_protected (hdr->frame_control)) {/* * This is unlocked and using gtk_i(c)vlen,
@@ -1553,6 +1553,17 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, truncated =0 ; } +if (IWL_FW_CHECK (mvm, + pktsize <= hdrlen + ivlen + icvlen, +"pktsize is too small %d\n" , + pktsize)) { +kfree_skb (pkt); +return ; + } + +skb_put_data (pkt, pktdata, hdrlen); + pktdata += hdrlen; + pktsize -= hdrlen; pktsize -= ivlen + icvlen; pktdata += ivlen;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ipmi: si: Use platform_get_irq_optional() to retrieve interrupt
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit 39851b7e580a65bee732e5364f0efb974b242370 ]
Use platform_get_irq_optional() to retrieve the interrupt resource instead of directly parsing and mapping the OF node via irq_of_parse_and_map(). This is the standard pattern for platform devices. irq_of_parse_and_map() requires ire_dispose_mapping(), which is missing.
Message-ID: <[email protected]> [Handle a negative return from platform_get_irq_optional() to mean
no interrupt is assigned.]
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ipmi: si: Use platform_get_irq_optional() to retrieve interrupt
**Local tree:** v6.18.44 (kernel 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [ipmi: si] [use] — Switch OF probe path from irq_of_parse_and_map() to platform_get_irq_optional() for interrupt retrieval.
### Step 1.2: Parse all commit message tags **Record:**
- Assisted-by: Antigravity:Gemini-3.5-Flash
- Signed-off-by: Rosen Penev <[email protected]>
- Message-ID: <[email protected]>
- Follow-up amendment: Signed-off-by: Corey Minyard <[email protected]> (IPMI subsystem maintainer)
**Notable patterns:** No Reported-by:, Fixes:, Cc: stable, or syzbot links. Maintainer (Corey Minyard) signed off with a behavioral clarification (negative return → no IRQ).
### Step 1.3: Analyze commit body
**Record:**
- **Bug described:** irq_of_parse_and_map() creates an IRQ mapping that requires irq_dispose_mapping() on teardown; that cleanup is missing in the IPMI SI OF probe/remove path.
- **Symptom/failure mode:** IRQ domain mapping leak when an OF-probed IPMI SI device is removed or the driver is unloaded — not a crash, but a real resource leak.
- **Root cause:** OF path uses the legacy irq_of_parse_and_map() API while ACPI/platform paths in the same file already use platform_get_irq_optional().
- **Fix approach:** Use the standard platform-device IRQ API, matching ACPI/platform probe paths.
### Step 1.4: Detect hidden bug fixes
**Record:** Yes — despite “use standard pattern” wording, this fixes a real resource-leak bug. irq_of_parse_and_map() without matching irq_dispose_mapping() is incorrect API usage. The sibling ipmi_powernv.c driver correctly pairs these calls.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes
**Record:**
- **Files:** drivers/char/ipmi/ipmi_si_platform.c only (+3 net lines)
- **Function modified:** of_ipmi_probe()
- **Scope:** Single-file, surgical fix (4 lines in one hunk)
### Step 2.2: Code flow change per hunk
**Record:**
- **Before:** io.irq = irq_of_parse_and_map(pdev->dev.of_node, 0); — creates an OF IRQ mapping.
- **After:** io.irq = platform_get_irq_optional(pdev, 0); with if (io.irq < 0) io.irq = 0; — uses standard platform IRQ retrieval; negative means no IRQ assigned.
- **Path affected:** OF device-tree IPMI SI probe (CONFIG_OF), called from ipmi_probe() when pdev->dev.of_node is set.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Resource leak (missing irq_dispose_mapping()).
- **Mechanism:** irq_of_parse_and_map() allocates an IRQ mapping. On remove, shutdown_smi() → std_irq_cleanup() only calls free_irq(), never irq_dispose_mapping(). Each probe/remove cycle leaks one mapping. platform_get_irq_optional() uses of_irq_get() internally (via platform.c) and does not require irq_dispose_mapping().
### Step 2.4: Fix quality assessment
**Record:**
- **Quality:** High — matches existing ACPI (acpi_ipmi_probe, line
368) and platform (platform_ipmi_probe, line 200) patterns in the same file.
- **Regression risk:** Very low — behavior for “no IRQ” is equivalent (irq_of_parse_and_map returns 0; platform_get_irq_optional returns negative, normalized to 0).
- **Maintainer amendment:** Corey Minyard’s follow-up correctly handles negative returns as “no interrupt.”
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame changed lines
**Record:** irq_of_parse_and_map() introduced in 9d70029edbbf2 (Corey Minyard, Sep 2017, “ipmi_si: Move platform device handling to another file”). Bug present since 2017 in this code path.
### Step 3.2: Follow Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: File history for related changes
**Record:**
- 443d372d6a96 (2020): “ipmi_si: Avoid spurious errors for optional IRQs” — switched ACPI path to platform_get_irq_optional(), with `Cc:
[email protected] # 5.4.x`.
- OF path was never updated; inconsistency remains in 6.18.44.
- This candidate commit is **not yet applied** to the local tree (line 279 still uses irq_of_parse_and_map()).
### Step 3.4: Author's other commits
**Record:** Rosen Penev has no prior commits in drivers/char/ipmi/ in this tree. Corey Minyard is the IPMI subsystem maintainer and signed off on the amendment.
### Step 3.5: Prerequisites/dependencies
**Record:** None. platform_get_irq_optional() exists and is already used in the same file. Standalone, self-contained fix.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:** b4 dig -c <commit> could not run — commit not present in local tree. Lore.kernel.org fetch returned 403 (bot protection). Message-ID [email protected] identified but thread content unverified.
### Step 4.2: Reviewers
**Record:** UNVERIFIED — could not fetch mailing list thread. Corey Minyard’s Signed-off-by on the amendment is verified via commit message.
### Step 4.3: Bug report
**Record:** N/A — no Reported-by: or Link: tags. No user or syzbot report.
### Step 4.4: Related patches/series
**Record:** Appears standalone (not part of a multi-patch series). Related prior fix: 443d372 (ACPI path, 2020).
### Step 4.5: Stable mailing list history
**Record:** UNVERIFIED — lore.kernel.org inaccessible. Prior related ACPI fix was explicitly nominated for stable (`Cc:
[email protected] # 5.4.x`).
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions modified **Record:** of_ipmi_probe() — only function changed.
### Step 5.2: Callers
**Record:** of_ipmi_probe() called from ipmi_probe() (line 400) during platform device probe. Triggered at boot on DT systems with IPMI nodes (ipmi-kcs, ipmi-smic, ipmi-bt compatible strings).
### Step 5.3: Callees
**Record:**
- **Before:** irq_of_parse_and_map() → creates mapping needing irq_dispose_mapping().
- **After:** platform_get_irq_optional() → of_irq_get() for OF nodes (per drivers/base/platform.c:184-188).
- Downstream: ipmi_si_add_smi() → ipmi_std_irq_setup() → request_irq(); remove via std_irq_cleanup() → free_irq() only.
### Step 5.4: Call chain / reachability
**Record:** Boot-time device probe on CONFIG_OF systems (ARM servers, embedded BMC hosts). Bug manifests on device remove/module unload (ipmi_remove() → ipmi_si_remove_by_dev() → shutdown_smi()). Not syscall-reachable, but reachable via driver unbind/module reload.
### Step 5.5: Similar patterns
**Record:**
- Same file: ACPI path (line 368) and platform path (line 200) already use platform_get_irq_optional().
- ipmi_powernv.c correctly pairs irq_of_parse_and_map() with irq_dispose_mapping() on remove (lines 279, 291) — demonstrates the expected contract.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does buggy code exist?
**Record:** **Yes.** Line 279 in drivers/char/ipmi/ipmi_si_platform.c:
```279:279:drivers/char/ipmi/ipmi_si_platform.c
io.irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
```Bug present since 2017 (9d70029). ACPI/platform paths already fixed; OF path still buggy in 6.18.44.
### Step 6.2: Backport complications
**Record:** Expected clean apply — minimal 3-line functional change at a stable location with matching context. No conflicting recent churn in this function.
### Step 6.3: Related fixes already present?
**Record:** ACPI/platform paths already use platform_get_irq_optional(). No equivalent OF-path fix or irq_dispose_mapping() addition present. This fix not yet in tree.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/char/ipmi/ — **IMPORTANT** peripheral driver. IPMI is widely used on servers/embedded for BMC management, but this specific bug is in the teardown path, not the hot IPMI message path.
### Step 7.2: Subsystem activity
**Record:** Moderate recent activity (refactoring, type-info moves). OF IRQ retrieval code has been stable since 2017 aside from ACPI-path fix in 2020.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of CONFIG_IPMI_SI + CONFIG_OF with device-tree IPMI nodes. Platform-specific (DT ARM/Power embedded), not universal.
### Step 8.2: Trigger conditions
**Record:** Device remove, driver module unload, or sysfs unbind after successful OF probe with an IRQ defined. Uncommon in production (IPMI typically probed once at boot), but possible during development, firmware updates, or hot-unbind testing. Not unprivileged-user triggerable directly.
### Step 8.3: Failure mode severity
**Record:** IRQ domain mapping leak on teardown. **Severity: LOW- MEDIUM** — real kernel resource leak, no crash/corruption/security impact. Could accumulate with repeated bind/unbind cycles.
### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** Fixes longstanding API misuse; aligns OF path with ACPI/platform paths; prevents per-remove IRQ mapping leaks.
- **Risk:** Very low — 3 lines, maintainer-reviewed, matches established in-file pattern.
- **Ratio:** Favorable — tiny, correct fix for a real (if low-impact) bug.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compile
**FOR backport:**
- Real resource leak: irq_of_parse_and_map() without irq_dispose_mapping() on remove
- Maintainer (Corey Minyard) signed off with behavioral fix
- Matches pattern already used in same file and previously backported for ACPI path (443d372, Cc: stable)
- Tiny, surgical, obviously correct
- Buggy code confirmed present in 6.18.44 since 2017
- ipmi_powernv.c shows correct pairing of these APIs in same subsystem
**AGAINST backport:**
- Low user-visible impact — leak only on driver remove, not during normal operation
- No user reports, syzbot, or sanitizer findings
- Does not cause crash, corruption, deadlock, or security issue
- IPMI SI rarely unloaded in production
**Unresolved:**
- Full mailing list review thread (lore 403)
- Whether mainline has merged this yet (commit not in local tree)
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — matches in-file precedent; maintainer SOB; logic verified against platform.c and ipmi_powernv.c.
2. Fixes a real bug? **PASS** — IRQ mapping leak on teardown.
3. Important issue? **PASS (borderline)** — resource leak, not crash/corruption; severity low but real; same driver had a lesser ACPI log-spam fix backported to stable in 2020.
4. Small and contained? **PASS** — 3 net lines, one function.
5. No new features/APIs? **PASS** — API usage correction only.
6. Can apply to local tree? **PASS** — buggy code present; clean apply expected.
### Step 9.3: Exception categories
**Record:** N/A — not a device ID, quirk, DT update, build fix, or docs fix. Standard driver bug fix.
### Step 9.4: Decision rationale
This commit fixes a real, verifiable resource leak in the OF IPMI SI probe/remove path. The ACPI and platform probe paths in the same file were already converted to platform_get_irq_optional() years ago (with stable nomination for the ACPI case). The OF path was left behind using irq_of_parse_and_map() without the required irq_dispose_mapping() in the remove path (std_irq_cleanup() only calls free_irq()).
While the leak only manifests on device removal and is unlikely to affect typical production servers, it is a genuine kernel bug with a trivial, maintainer-approved fix that carries negligible regression risk. The precedent of backporting a related (less severe) IRQ-handling fix in this same driver supports inclusion.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user-provided diff
- **[Phase 2]** Diff analysis: 3 lines added in of_ipmi_probe(), replaces irq_of_parse_and_map with platform_get_irq_optional + negative check
- **[Phase 3]** git describe HEAD: v6.18.44 / kernel 6.18.44
- **[Phase 3]** git blame -L 275,285: irq_of_parse_and_map from 9d70029 (Sep 2017)
- **[Phase 3]** git log --oneline -5 -- drivers/char/ipmi/ipmi_si_platform.c: recent history reviewed
- **[Phase 3]** git show 443d372: prior ACPI platform_get_irq_optional fix with Cc: [email protected]
- **[Phase 4]** b4 dig: failed — commit not in local tree (requires -c COMMITISH)
- **[Phase 4]** Lore fetch: 403 Forbidden — thread content UNVERIFIED
- **[Phase 5]** Read drivers/char/ipmi/ipmi_si_platform.c: confirmed OF path at line 279 uses irq_of_parse_and_map; ACPI (368) and platform (200) use platform_get_irq_optional
- **[Phase 5]** Read drivers/char/ipmi/ipmi_si_intf.c:1326-1354,2308-2310:
std_irq_cleanup() calls free_irq() only, no irq_dispose_mapping()
- **[Phase 5]** Read drivers/base/platform.c:171-188:
platform_get_irq_optional() uses of_irq_get() for OF nodes
- **[Phase 5]** Read drivers/char/ipmi/ipmi_powernv.c:277-291: correct irq_dispose_mapping() usage with irq_of_parse_and_map()
- **[Phase 6]** grep irq_of_parse_and_map drivers/char/ipmi/: only ipmi_si_platform.c:279 and ipmi_powernv.c:244 (powernv handles cleanup correctly)
- **[Phase 6]** Confirmed candidate commit NOT yet in tree (line 279 unchanged)
- **[Phase 8]** Failure mode: IRQ mapping leak on remove, severity LOW- MEDIUM
**YES**
drivers/char/ipmi/ipmi_si_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_platform.c +4 -1
@@ -276,7 +276,10 @@ static int of_ipmi_probe(struct platform_device *pdev) io.regspacing = regspacing ?be32_to_cpup (regspacing) :DEFAULT_REGSPACING ; io.regshift = regshift ?be32_to_cpup (regshift) :0 ; - io.irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + io.irq =platform_get_irq_optional (pdev,0 ); +if (io.irq <0 ) + io.irq =0 ; + io.dev = &pdev->dev; dev_dbg(&pdev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n",
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 rds: filter RDS_INFO_* getsockopt by caller's netns
In reply to Sasha LevinFrom: Maoyi Xie <[email protected]>
[ Upstream commit c96a5209dda666004b8ee1ed7f0d493d09a4f200 ]
The RDS_INFO_* family of getsockopt(2) options reads several file-scope global lists that are not per-netns:
rds_sock_info / rds6_sock_info,
rds_sock_inc_info / rds6_sock_inc_info -> rds_sock_list
rds_tcp_tc_info / rds6_tcp_tc_info -> rds_tcp_tc_list
rds_conn_info / rds6_conn_info, rds_conn_message_info_cmn (for the *_SEND_MESSAGES and *_RETRANS_MESSAGES variants), rds_for_each_conn_info (for RDS_INFO_IB_CONNECTIONS)
-> rds_conn_hash[]
The handlers do not filter by the caller's network namespace. rds_info_getsockopt() has no netns or capable() check, and rds_create() has no capable() check, so AF_RDS is reachable from an unprivileged user namespace. As a result, an unprivileged caller in a fresh user_ns plus netns can read the bound address and sock inode of every RDS socket on the host, the peer address of incoming messages on every RDS socket on the host, the peer address and TCP sequence numbers of every rds-tcp connection on the host, and the peer address and RDS sequence numbers of every RDS connection on the host.
The rds-tcp transport is reachable from a non-initial netns (see rds_set_transport()), so a one-shot init_net gate at rds_info_getsockopt() would deny legitimate per-netns visibility to rds-tcp callers. Instead, filter at each handler by comparing the netns of the caller's socket to the netns of the list entry, or to rds_conn_net(conn) for connection paths. Only copy entries whose netns matches the caller. Counters (RDS_INFO_COUNTERS) are aggregate statistics and remain global.
Reproducer (KASAN VM, rds and rds_tcp loaded): an AF_RDS socket binds 127.0.0.1:4242 in init_net as root. A child process enters a fresh user_ns plus netns and opens AF_RDS there, then calls getsockopt(SOL_RDS, RDS_INFO_SOCKETS). Before this change, the child sees the init_net socket. After this change, the child sees zero entries.
Drop the rds_sock_count, rds_tcp_tc_count, and rds6_tcp_tc_count globals. v2 used them for the size precheck and lens->nr; v3 replaced the precheck with a per-ns count from a first pass over the list, so the globals have no remaining readers. The matching increments and decrements in rds_create()/rds_destroy_sock() and rds_tcp_set_callbacks()/rds_tcp_restore_callbacks() go away with them. Reported by the kernel test robot under clang W=1.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: rds: filter RDS_INFO_* getsockopt by caller's netns
**Local tree:** v6.18.44 (linux-6.18.y stable). The vulnerable code is present; this fix is not yet applied.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
**Record:** [net/rds] [filter] — Restrict RDS_INFO_* getsockopt handlers to return only data from the caller's network namespace.
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
**Record:**
- **Suggested-by:** Allison Henderson <[email protected]>, Simon Horman <[email protected]> — subsystem experts identified the issue
- **Reviewed-by:** Allison Henderson <[email protected]> — RDS maintainer review
- **Co-developed-by:** Praveen Kakkolangara
- **Signed-off-by:** Praveen Kakkolangara, Maoyi Xie, Jakub Kicinski
- **Link:** https://patch.msgid.link/20260520084236.2724349-1-
[email protected]
- No Fixes:, Reported-by: syzbot, or Cc: [email protected] (expected for pipeline candidates)
- Notable: Reviewed by subsystem maintainer; security issue identified by maintainers, not a fuzzer report
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
**Record:**
- **Bug:** RDS_INFO_* getsockopt handlers iterate global lists (rds_sock_list, rds_tcp_tc_list, rds_conn_hash[]) without filtering by the caller's netns
- **Symptom:** Unprivileged process in a fresh user_ns + netns can read host-wide RDS socket addresses/inodes, peer addresses, TCP sequence numbers, and RDS sequence numbers
- **Root cause:** rds_info_getsockopt() has no netns/capability check; rds_create() has no capable() check; AF_RDS is reachable from unprivileged user namespaces; global lists are not per-netns
- **Reproducer:** Documented — root binds AF_RDS in init_net; child in new user_ns+netns calls getsockopt(SOL_RDS, RDS_INFO_SOCKETS) and sees init_net sockets before fix, zero after
- **Design note:** Cannot use a blanket init_net gate because rds-tcp legitimately works in non-init netns
### Step 1.4: DETECT HIDDEN BUG FIXES
**Record:** Not disguised — this is an explicit security/access-control fix. Secondary cleanup drops unused global counters (rds_sock_count, rds_tcp_tc_count, rds6_tcp_tc_count) after switching to per-netns two-pass counting.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
**Record:**
- net/rds/af_rds.c — ~+80/-30 lines: netns filtering in rds_sock_inc_info, rds6_sock_inc_info, rds_sock_info, rds6_sock_info; remove rds_sock_count global and its inc/dec
- net/rds/connection.c — ~+20 lines: netns filter in rds_conn_message_info_cmn, rds_for_each_conn_info, rds_walk_conn_path_info
- net/rds/tcp.c — ~+50/-20 lines: netns filtering in rds_tcp_tc_info, rds6_tcp_tc_info; remove rds_tcp_tc_count/rds6_tcp_tc_count globals
- **Functions modified:** 9 info-export handlers + socket create/destroy callback paths (counter removal only)
- **Scope:** Multi-file but single-purpose; no API changes
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
**Record:**
- **Before:** Each handler walks entire global list and copies all matching entries regardless of netns
- **After:** Each handler gets struct net *net = sock_net(sock->sk), skips entries where !net_eq(sock_net(rds_rs_to_sk(rs)), net) or !net_eq(rds_conn_net(conn), net), uses two-pass count-then-copy for size precheck
- **Affected path:** getsockopt(SOL_RDS, RDS_INFO_*) — userspace diagnostic path, but reachable from unprivileged netns
### Step 2.3: IDENTIFY THE BUG MECHANISM
**Record:**
- **Category:** Security — cross-network-namespace information disclosure
- **Mechanism:** Global data structures shared across all netns; getsockopt handlers lacked netns scoping. Unprivileged container/namespace user reads host-wide connection metadata including TCP/RDS sequence numbers useful for traffic analysis or hijacking
### Step 2.4: ASSESS THE FIX QUALITY
**Record:**
- Fix is obviously correct — standard net_eq() pattern already used in this subsystem (recv.c:377)
- Minimal per-handler filtering; preserves legitimate per-netns rds-tcp visibility
- Low regression risk: only restricts over-broad data export; RDS_INFO_COUNTERS intentionally remains global per commit message
- Two-pass counting handles buffer sizing correctly; comment documents benign race with concurrent rds_bind()
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
**Record:** Info handlers in af_rds.c trace to long-standing RDS code (blame shows merge commit e664048784506 for current lines). Global rds_sock_list without netns filtering is architectural debt from before per-netns RDS-TCP support. RDS-TCP netns support added in d5a8ac28a7ff (Aug 2015). Bug became exploitable when unprivileged user namespaces could create isolated netns (Linux 3.8+) and open AF_RDS sockets without capability checks.
### Step 3.2: FOLLOW THE FIXES: TAG
**Record:** No Fixes: tag present — N/A.
### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES **Record:** Related fixes already in this tree:
- a7494479757d6 — restrict RDS/IB transport to init_net (partial mitigation, does not fix getsockopt leak)
- 9591042533140 — drop cross-netns incoming messages (UAF fix in recv path)
- 91ce1bb6e4194 — zero per-item info buffers (stack leak fix, complementary)
This fix is **standalone** — no series dependency.
### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
**Record:** Maoyi Xie has multiple net-namespace security fixes in networking (e.g., requiring CAP_NET_ADMIN for tunnel changelink). Co- authors Praveen Kakkolangara and reviewer Allison Henderson are active RDS contributors/maintainers.
### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS **Record:** Requires rds_conn_net() helper — **present** in this tree (rds.h:174-177). Requires read_pnet/write_pnet on conn->c_net — **present**. No other prerequisites. Should apply cleanly.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
**Record:** b4 dig -c <sha> could not run — commit not in local tree. Web search found patch series v3→v5 on netdev/linux-kernel lists (May 2026). Final version is v5. Reviewed-by Allison Henderson on committed version. Could not fetch lore/patch.msgid.link (bot protection/timeout).
### Step 4.2: CHECK WHO REVIEWED THE PATCH
**Record:** CC list from v5 includes netdev, linux-rdma, rds-devel maintainers (David Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni). Reviewed-by Allison Henderson (RDS maintainer).
### Step 4.3: SEARCH FOR THE BUG REPORT
**Record:** No syzbot/bugzilla link. Issue identified by RDS maintainers (Suggested-by Henderson, Horman). Reproducer included in commit message. Kernel test robot noted unused globals (W=1), not the security bug itself.
### Step 4.4: CHECK FOR RELATED PATCHES AND SERIES **Record:** Standalone 1-patch fix; evolved v1→v5 during review (v3 addressed two-pass counting feedback from Simon Horman). No other patches required.
### Step 4.5: CHECK STABLE MAILING LIST HISTORY **Record:** Not searched — commit not yet in stable tree. No evidence against backport found.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF
**Record:** rds_sock_info, rds6_sock_info, rds_sock_inc_info, rds6_sock_inc_info, rds_conn_message_info_cmn, rds_for_each_conn_info, rds_walk_conn_path_info, rds_tcp_tc_info, rds6_tcp_tc_info
### Step 5.2: TRACE CALLERS
**Record:** All called from rds_info_getsockopt() (info.c:208) via registered function table, which is invoked from rds_getsockopt() (af_rds.c:506) on getsockopt(2) for SOL_RDS options. Reachable from any process with an AF_RDS socket.
### Step 5.3: TRACE CALLEES
**Record:** sock_net(), net_eq(), rds_conn_net(), rds_info_copy(), list iteration under existing locks (rds_sock_lock, rds_tcp_tc_list_lock, RCU for conn hash).
### Step 5.4: FOLLOW THE CALL CHAIN
**Record:** syscall:getsockopt → sock_getsockopt → rds_getsockopt → rds_info_getsockopt → info handler. **Userspace-reachable** from unprivileged user in new netns (confirmed: rds_create() at af_rds.c:703-716 has no capable() check).
### Step 5.5: SEARCH FOR SIMILAR PATTERNS
**Record:** Same net_eq(sock_net(...), rds_conn_net(...)) pattern already applied in recv.c:377 for cross-netns message delivery. This fix extends the same principle to the info-export path.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
### Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE? **Record:** **YES.** Verified:
- rds_sock_inc_info iterates all of rds_sock_list without netns check (af_rds.c:746)
- rds_tcp_tc_info exports all TCP connections without netns filter (tcp.c:245-264)
- rds_conn_message_info_cmn walks all of rds_conn_hash without netns filter (connection.c:560-594)
- rds_info_getsockopt() has no netns/capability gate (info.c:158-218)
### Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
**Record:** Expected **clean apply**. File structure matches the diff context. Recent related RDS netns commits in this tree use the same helpers. No conflicting refactor detected in last 10 commits on these files.
### Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE **Record:** Partial mitigations present (a7494479757d6 blocks RDS/IB in non-init netns for *transport setup*, 9591042533140 fixes recv UAF), but **no fix for getsockopt info leak**. This commit is still needed.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY **Record:** net/rds — networking protocol (IMPORTANT). Security- relevant when CONFIG_RDS is enabled/built as module.
### Step 7.2: ASSESS SUBSYSTEM ACTIVITY
**Record:** Actively maintained — multiple RDS netns security fixes landed in 6.18.y recently, indicating ongoing hardening of namespace isolation in this driver.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: DETERMINE WHO IS AFFECTED
**Record:** Systems with CONFIG_RDS/CONFIG_RDS_TCP enabled and RDS in use on the host. Any multi-tenant/container environment where untrusted users can create user+network namespaces. Not universal (CONFIG-dependent), but impact is severe when RDS is loaded.
### Step 8.2: DETERMINE THE TRIGGER CONDITIONS
**Record:**
- **Trigger:** Create user_ns + netns (unprivileged since 3.8), load/use AF_RDS, call getsockopt(SOL_RDS, RDS_INFO_*)
- **Likelihood:** Moderate — requires RDS module loaded, but module autoload via MODULE_ALIAS_NETPROTO(PF_RDS) is possible
- **Unprivileged trigger:** **Yes** — no capability check in rds_create()
### Step 8.3: DETERMINE THE FAILURE MODE SEVERITY **Record:** Cross-namespace **information disclosure** — socket addresses, inode numbers, peer addresses, TCP sequence numbers, RDS sequence numbers. Severity: **CRITICAL** (security vulnerability; aids network reconnaissance and potentially TCP sequence prediction attacks).
### Step 8.4: CALCULATE RISK-BENEFIT RATIO
**Record:**
- **Benefit:** HIGH — closes documented namespace isolation bypass
- **Risk:** LOW — surgical netns filtering using established in- subsystem pattern; no behavior change for correctly scoped callers
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: COMPILE THE EVIDENCE
**FOR backport:**
- Real security bug — cross-netns info leak
- Unprivileged reproduction path documented
- Leaks sensitive data (TCP/RDS sequence numbers, peer addresses, socket inodes)
- Reviewed by RDS maintainer (Allison Henderson)
- Small, focused fix using existing net_eq()/rds_conn_net() infrastructure
- Buggy code confirmed present in linux-6.18.y
- Prerequisites (rds_conn_net, per-net conn support) present in tree
- Consistent with other RDS netns hardening already backported to this tree
**AGAINST backport:**
- CONFIG_RDS is optional/tristate — not every system has RDS loaded
- No syzbot/CVE reference (weaker signal, but maintainers documented the issue)
**UNRESOLVED:**
- Full lore thread content (fetch blocked)
- Exact upstream commit SHA not in local remotes
Neither unresolved item affects the technical decision.
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — clear netns filtering; reviewed by maintainer; reproducer provided
2. Fixes a real bug affecting users? **PASS** — documented cross-netns info leak
3. Important issue? **PASS** — security information disclosure (CRITICAL)
4. Small and contained? **PASS** — ~3 files, focused handlers, no refactoring
5. No new features or APIs? **PASS** — access restriction only
6. Can apply to local tree? **PASS** — code and helpers present; clean apply expected
### Step 9.3: CHECK FOR EXCEPTION CATEGORIES
**Record:** Security bug fix (not device ID, quirk, DT, build, or docs exception).
### Step 9.4: DECISION RATIONALE
This commit closes a namespace isolation hole in RDS diagnostic getsockopt handlers. An unprivileged user in a container-like user+network namespace can currently enumerate host-wide RDS connection state including TCP sequence numbers. The fix applies the same net_eq() scoping pattern already used elsewhere in RDS and is a standard stable security backport. The bug exists in linux-6.18.44; partial mitigations (RDS/IB transport restriction, recv-path UAF fix) do not address this getsockopt leak.
---
## Verification
- [Phase 1] Parsed subject, tags (Reviewed-by Henderson, Suggested-by Henderson/Horman, Link to patch)
- [Phase 2] Read diff: 3 files, netns net_eq() filters in 9 handlers, global counter removal
- [Phase 3] git describe HEAD → v6.18.44; git blame on rds_sock_inc_info → long-standing code; d5a8ac28a7ff → RDS-TCP netns since 2015; related commits a7494479757d6, 9591042533140 present
- [Phase 4] Web search found v3-v5 patch series; Reviewed-by Henderson; b4 dig/WebFetch lore blocked (no commit SHA in tree / bot protection)
- [Phase 5] Traced call chain: getsockopt → rds_getsockopt → rds_info_getsockopt → handlers; confirmed rds_create() lacks capable() at af_rds.c:703-716
- [Phase 6] Confirmed buggy globals and unfiltered loops at af_rds.c:746, tcp.c:245, connection.c:560; rds_conn_net() exists at rds.h:174; fix not present
- [Phase 7] Subsystem: net/rds, actively receiving netns security fixes
- [Phase 8] Failure mode: cross-netns info leak, unprivileged trigger, CRITICAL severity
**YES**The remote search (sasha-next, sashal, stable/linux-6.19.y) finished without finding the fix commit — it isn’t in those local refs yet, which matches this tree still having the vulnerable getsockopt handlers.
The analysis stands: this is a cross-netns information leak in RDS_INFO_* getsockopt paths, exploitable from unprivileged user+network namespaces when RDS is loaded. The fix is small, reviewed by the RDS maintainer, and the prerequisites (rds_conn_net(), etc.) are already in **linux-6.18.y v6.18.44**.
**YES** — backport recommended for this tree.
net/rds/af_rds.c | 59 ++++++++++++++++++++++++++++++++++------- net/rds/connection.c | 13 +++++++++ net/rds/tcp.c | 63 ++++++++++++++++++++++++++++---------------- 3 files changed, 104 insertions(+), 31 deletions(-)
net/rds/af_rds.c +50 -9
@@ -43,7 +43,6 @@/* this is just used for stats gathering :/ */ static DEFINE_SPINLOCK (rds_sock_lock); -static unsigned long rds_sock_count;static LIST_HEAD (rds_sock_list);DECLARE_WAIT_QUEUE_HEAD (rds_poll_waitq);
@@ -82,7 +81,6 @@ static int rds_release(struct socket *sock)spin_lock_bh (&rds_sock_lock);list_del_init (&rs->rs_item); - rds_sock_count--;spin_unlock_bh (&rds_sock_lock);rds_trans_put (rs->rs_transport);
@@ -694,7 +692,6 @@ static int __rds_create(struct socket *sock, struct sock *sk, int protocol)spin_lock_bh (&rds_sock_lock);list_add_tail (&rs->rs_item, &rds_sock_list); - rds_sock_count++;spin_unlock_bh (&rds_sock_lock);return 0 ;
@@ -735,6 +732,7 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_sock *rs;struct rds_incoming *inc;unsigned int total =0 ;
@@ -744,6 +742,9 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock);list_for_each_entry (rs, &rds_sock_list, rs_item) { +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;/* This option only supports IPv4 sockets. */ if (!ipv6_addr_v4mapped (&rs->rs_bound_addr))continue ;
@@ -774,6 +775,7 @@ static void rds6_sock_inc_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_incoming *inc;unsigned int total =0 ;struct rds_sock *rs;
@@ -783,6 +785,9 @@ static void rds6_sock_inc_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock);list_for_each_entry (rs, &rds_sock_list, rs_item) { +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;read_lock (&rs->rs_recv_lock);list_for_each_entry (inc, &rs->rs_recv_queue, i_item) {
@@ -806,7 +811,9 @@ static void rds_sock_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds_info_socket sinfo; +unsigned int copied =0 ;unsigned int cnt =0 ;struct rds_sock *rs;
@@ -814,12 +821,24 @@ static void rds_sock_info(struct socket *sock, unsigned int len,spin_lock_bh (&rds_sock_lock); -if (len < rds_sock_count) { - cnt = rds_sock_count; - goto out; +/* First pass: count entries visible in the caller's netns. */ +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; +if (!ipv6_addr_v4mapped (&rs->rs_bound_addr)) +continue ; + cnt++; } +if (len < cnt) + goto out; +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (copied >= cnt) +break ; +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ;/* This option only supports IPv4 sockets. */ if (!ipv6_addr_v4mapped (&rs->rs_bound_addr))continue ;
@@ -832,8 +851,13 @@ static void rds_sock_info(struct socket *sock, unsigned int len, sinfo.inum =sock_i_ino (rds_rs_to_sk (rs));rds_info_copy (iter, &sinfo,sizeof (sinfo)); - cnt++; + copied++; } +/* A concurrent rds_bind() can change rs_bound_addr between the +* two passes without holding rds_sock_lock, so copied may be +* less than cnt. Report what was actually copied. +*/ + cnt = copied; out: lens->nr = cnt;
@@ -847,17 +871,32 @@ static void rds6_sock_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + struct net *net = sock_net(sock->sk);struct rds6_info_socket sinfo6; +unsigned int copied =0 ; +unsigned int cnt =0 ;struct rds_sock *rs; len /=sizeof (struct rds6_info_socket );spin_lock_bh (&rds_sock_lock); -if (len < rds_sock_count) +/* First pass: count entries visible in the caller's netns. */ +list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; + cnt++; + } + +if (len < cnt) goto out;list_for_each_entry (rs, &rds_sock_list, rs_item) { +if (copied >= cnt) +break ; +/* Only show sockets in the caller's netns. */ +if (!net_eq (sock_net (rds_rs_to_sk (rs)), net)) +continue ; sinfo6.sndbuf =rds_sk_sndbuf (rs); sinfo6.rcvbuf =rds_sk_rcvbuf (rs); sinfo6.bound_addr = rs->rs_bound_addr;
@@ -867,10 +906,12 @@ static void rds6_sock_info(struct socket *sock, unsigned int len, sinfo6.inum =sock_i_ino (rds_rs_to_sk (rs));rds_info_copy (iter, &sinfo6,sizeof (sinfo6)); + copied++; } + cnt = copied; out: - lens->nr = rds_sock_count; + lens->nr = cnt; lens->each =sizeof (struct rds6_info_socket );spin_unlock_bh (&rds_sock_lock);
net/rds/connection.c +13 -0
@@ -541,6 +541,7 @@ static void rds_conn_message_info_cmn(struct socket *sock, unsigned int len,struct rds_info_lengths *lens, int want_send, bool isv6) { + struct net *net = sock_net(sock->sk);struct hlist_head *head;struct list_head *list;struct rds_connection *conn;
@@ -563,6 +564,9 @@ static void rds_conn_message_info_cmn(struct socket *sock, unsigned int len,struct rds_conn_path *cp;int npaths; +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ;if (!isv6 && conn->c_isv6)continue ;
@@ -661,6 +665,7 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len, u64 *buffer, size_t item_len) { +struct net *net =sock_net (sock->sk);struct hlist_head *head;struct rds_connection *conn;size_t i;
@@ -673,6 +678,9 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,for (i =0 , head = rds_conn_hash; i <ARRAY_SIZE (rds_conn_hash); i++, head++) {hlist_for_each_entry_rcu (conn, head, c_hash_node) { +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ;/* Zero the per-item buffer before handing it to the * visitor so any field the visitor does not write -
@@ -706,6 +714,7 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len, u64 *buffer, size_t item_len) { +struct net *net =sock_net (sock->sk);struct hlist_head *head;struct rds_connection *conn;size_t i;
@@ -720,6 +729,10 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len,hlist_for_each_entry_rcu (conn, head, c_hash_node) {struct rds_conn_path *cp; +/* Only show connections in the caller's netns. */ +if (!net_eq (rds_conn_net (conn), net)) +continue ; +/* XXX We only copy the information from the first * path for now. The problem is that if there are * more than one underlying paths, we cannot report
net/rds/tcp.c +41 -22
136 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 netfs: Fix DIO write retry for filesystems without a ->prepare_write()
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 64f04f9789237728be4e1836151848af350d1374 ]
Fix netfs_unbuffered_write() so that it doesn't re-issue a write twice when the filesystem doesn't have a ->prepare_write(). The resetting of the iterator and the call to netfs_reissue_write() should just be removed as almost everything it does is done again when the loop it's in goes back to the top.
It does, however, still need the IN_PROGRESS flag setting, so that (and the stat inc) are moved out of the if-statement.
Further, the MADE_PROGRESS flags should be cleared and wreq->transferred should be updated, so fix those too.
---
LLM Generated explanations, may be completely bogus:
# Backport Analysis: netfs: Fix DIO write retry for filesystems without a ->prepare_write()
**Local tree:** v6.18.44 (6.18.y stable) — VERSION = 6, PATCHLEVEL = 18, SUBLEVEL = 44
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [netfs] [Fix] — Correct DIO/unbuffered write retry when the filesystem has no ->prepare_write() hook.
### Step 1.2: Parse all commit message tags
**Record:**
| Tag | Value | |-----|-------| | Reported-by | [email protected] | | Closes | https://syzkaller.appspot.com/bug?extid=3c74b1f0c372e98efc32 | | Signed-off-by | David Howells \<[email protected]\> | | Link | https://patch.msgid.link/[email protected] | | cc | Paulo Alcantara, hongao, ChenXiaoSong, [email protected], [email protected] | | Signed-off-by | Christian Brauner (Amutable) \<[email protected]\> |
**Notable patterns:** syzbot report (strong YES signal). No Fixes: tag (expected for manual review). No Cc: stable tag (not a negative signal).
### Step 1.3: Analyze commit body
**Record:**
- **Bug:** On retry in netfs_unbuffered_write(), when stream->prepare_write is NULL, the code calls netfs_reissue_write() and then the loop iterates again and issues the write a second time.
- **Symptom:** Double write issuance, incorrect progress accounting (wreq->transferred not updated on partial retry), stale NETFS_SREQ_MADE_PROGRESS flag.
- **Root cause:** The retry path incorrectly mirrored write_retry.c’s netfs_reissue_write() pattern, but netfs_unbuffered_write()’s loop already re-issues at the top on the next iteration.
- **Version info:** None explicit; bug is tied to code introduced in 6.18.y backports.
### Step 1.4: Detect hidden bug fixes
**Record:** Yes — despite “fix retry logic” wording, this is a real memory-safety and correctness bug: syzbot reports KASAN slab-use-after- free in netfs_unbuffered_write(), reachable from userspace write() via 9p.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory changes
**Record:**
- **Files:** fs/netfs/direct_write.c only (+6 / -10 lines, net −4)
- **Function:** netfs_unbuffered_write()
- **Scope:** Single-file surgical fix in retry path
### Step 2.2: Code flow change per hunk
**Record:**
| Hunk | Before → After | |------|----------------| | Partial transfer | `iov_iter_advance()` only → also `wreq->transferred += subreq->transferred` | | Flag clearing | No `MADE_PROGRESS` clear → `__clear_bit(NETFS_SREQ_MADE_PROGRESS, ...)` added | | prepare_write branch | `if/else`: else calls `netfs_reset_iter()` +
netfs_reissue_write() → unified path: optional prepare_write(), always set IN_PROGRESS + stat |
**Affected path:** Retry branch when NETFS_SREQ_NEED_RETRY is set (error recovery during unbuffered/DIO writes).
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic/correctness bug with memory safety consequences (UAF); also reference-counting/lifecycle corruption from double issue.
- **Mechanism:** netfs_reissue_write() calls netfs_do_issue_write() → stream->issue_write(). The loop then continues with subreq still non-NULL, skips netfs_prepare_write(), and calls stream->issue_write(subreq) again at line 134. This corrupts subrequest lifecycle and can free the subrequest while the loop still holds a pointer to it (matching syzbot’s alloc/free/read pattern).
### Step 2.4: Fix quality
**Record:** Obviously correct. The prepare_write path already worked this way (set up state, loop back, issue once). The fix unifies the no-prepare_write path to match. Minimal regression risk; no new APIs or locking changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame changed lines
**Record:**
- Retry infrastructure: 72d08d2839649 (upstream a0b4c7a49137, Feb 2026) — “Fix unbuffered/DIO writes to dispatch subrequests in strict sequence”
- Buggy else { netfs_reissue_write() } branch: a4d1b4ba9754b (upstream e9075e420a1e, Mar 2026) — “Fix NULL pointer dereference in netfs_unbuffered_write() on retry”
- Both commits are ancestors of HEAD in this tree.
### Step 3.2: Follow Fixes: tag
**Record:** N/A — no Fixes: tag in commit message. The bug was introduced by a4d1b4ba9754b, which attempted to fix an earlier NULL deref (syzbot 7227db0f) but introduced the double-issue/UAF.
### Step 3.3: File history for related changes **Record:** Recent direct_write.c history in this tree:
- f0035858dfb23 — stream->front removal
- a4d1b4ba9754b — NULL deref fix (introduced this bug)
- 72d08d2839649 — sequential DIO write dispatch
Standalone fix; not part of a multi-commit dependency chain for this tree.
### Step 3.4: Author's other commits
**Record:** David Howells is the netfs subsystem author. He authored 72d08d2839649 (the retry loop) and this follow-up fix. Deepanshu Kartikey authored the incomplete a4d1b4ba9754b fix.
### Step 3.5: Prerequisites
**Record:**
- **Required in tree:** 72d08d2839649 (retry loop) and a4d1b4ba9754b (if/else structure) — both present.
- **Fix commit 64f04f978923:** NOT in HEAD.
- **Standalone:** Yes — only modifies existing retry path; cherry-pick applies cleanly.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:**
- b4 dig -c 64f04f978923: found at
https://patch.msgid.link/[email protected]
- Subject: [PATCH v3 15/15] netfs: Fix DIO write retry for filesystems without a ->prepare_write()
- Part of a 15-patch netfs series; this patch is self-contained in direct_write.c.
- Lore page blocked by bot protection; could not read thread body.
### Step 4.2: Reviewers
**Record:** b4 dig -w CC list includes David Howells, Christian Brauner, Paulo Alcantara, Christoph Hellwig, [email protected], [email protected], syzbot address. Appropriate subsystem coverage.
### Step 4.3: Bug report
**Record:** https://syzkaller.appspot.com/bug?extid=3c74b1f0c372e98efc32
- **Type:** KASAN: slab-use-after-free Read in netfs_unbuffered_write
- **Status:** Fixed upstream 2026/07/29
- **Priority:** high
- **Trigger:** ksys_write → v9fs_file_write_iter → netfs_unbuffered_write_iter → netfs_unbuffered_write
- **AI assessment:** Exploitable, unprivileged, userspace-triggerable
- **8 crashes** over ~75 days
### Step 4.4: Related patches/series
**Record:** Patch 15/15 of v3 netfs series. Other series patches (e.g., “Fix oops in write-retry from mis-resetting the subreq iterator”) are NOT in this tree, but this patch does not depend on them — verified by clean cherry-pick.
### Step 4.5: Stable mailing list
**Record:** Could not search lore stable list (bot protection). No evidence against stable nomination.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** netfs_unbuffered_write() (modified), netfs_reissue_write() (no longer called from here on retry)
### Step 5.2: Callers
**Record:**
- netfs_unbuffered_write_iter_locked() ← netfs_unbuffered_write_iter()
- Callers of netfs_unbuffered_write_iter():
- fs/9p/vfs_file.c (no prepare_write — **affected**)
- fs/smb/client/file.c (has cifs_prepare_write — uses prepare_write path, not affected by this specific bug)
- fs/netfs/buffered_write.c (fallback path)
### Step 5.3: Callees in retry path
**Record:** iov_iter_advance, retry_request op, flag bit ops, netfs_get_subrequest, optional prepare_write, then loop-top stream->issue_write().
### Step 5.4: Call chain / reachability
**Record:** write(2) → VFS → v9fs_file_write_iter → netfs_unbuffered_write_iter → netfs_unbuffered_write. **Userspace- reachable** on 9p mounts with O_DIRECT or unbuffered write paths.
### Step 5.5: Similar patterns
**Record:** write_retry.c correctly uses netfs_reissue_write() outside a re-issue loop. netfs_unbuffered_write() has its own issue- at-loop-top pattern — the bug was copying the wrong pattern.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does buggy code exist?
**Record:** **YES.** Lines 189–199 in fs/netfs/direct_write.c contain the buggy else { netfs_reissue_write(); } branch. Introduced by a4d1b4ba9754b, which is in this tree.
### Step 6.2: Backport complications
**Record:** **Clean apply.** git cherry-pick --no-commit 64f04f978923 succeeded with auto-merge on fs/netfs/direct_write.c.
### Step 6.3: Related fixes already present?
**Record:** a4d1b4ba9754b (incomplete NULL-deref fix) is present. Fix 64f04f978923 is NOT present (git merge-base --is-ancestor returns failure). No duplicate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** fs/netfs/ — IMPORTANT. Shared library for network filesystems (9p, CIFS, AFS, Ceph). Write path affects data integrity.
### Step 7.2: Subsystem activity
**Record:** Actively maintained in 6.18.y — multiple netfs fixes already backported (UAF, deadlock, writeback fixes visible in recent log).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of network filesystems without prepare_write on the upload stream — primarily **9p**. Config-dependent (9p + unbuffered/DIO write + write retry).
### Step 8.2: Trigger conditions
**Record:** Write subrequest marked NETFS_SREQ_NEED_RETRY during unbuffered/DIO write when stream->prepare_write == NULL. Syzbot reproduces via write() syscall. Unprivileged users can trigger on accessible 9p mounts.
### Step 8.3: Failure mode severity
**Record:**
- KASAN slab-use-after-free (syzbot-confirmed) — **CRITICAL** (crash, potential security)
- Double write issuance — **CRITICAL** (data corruption risk)
- Incorrect wreq->transferred — **HIGH** (wrong offsets, potential corruption)
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH — fixes syzbot UAF, prevents double-write and progress accounting errors on a common netfs code path.
- **Risk:** VERY LOW — ~10-line change, mirrors existing prepare_write path behavior.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- syzbot-reported, reproducible KASAN UAF
- Userspace-triggerable via write() on 9p
- High priority, assessed exploitable
- Small, surgical, obviously correct fix
- Bug exists in this 6.18.44 tree (introduced by prior stable backport a4d1b4ba9754b)
- Applies cleanly
- Fixes real data-integrity and crash bugs
**AGAINST backport:**
- Part of a 15-patch series (but this patch is self-contained)
- Only affects filesystems without prepare_write (primarily 9p, not CIFS/AFS)
**Unresolved:** Could not read full lore review thread (bot protection). Does not affect decision — syzbot evidence is sufficient.
### Step 9.2: Stable rules checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — syzbot tested prior NULL-deref fix; this is author's correction of that approach | | 2. Fixes real bug affecting users? | **PASS** — syzbot UAF, 8 crashes | | 3. Important issue? | **PASS** — CRITICAL (UAF, data corruption) | | 4. Small and contained? | **PASS** — single file, ~10 lines | | 5. No new features/APIs? | **PASS** | | 6. Can apply to local tree? | **PASS** — verified clean cherry-pick |
### Step 9.3: Exception categories
**Record:** N/A — standard bug fix, not a quirk/ID/DT/doc exception.
### Step 9.4: Decision rationale
This 6.18.y tree contains the buggy retry path from a4d1b4ba9754b but not the corrective fix. The bug causes slab-use-after-free (syzbot- confirmed, high priority, userspace-triggerable on 9p) and double write issuance. The fix is minimal, applies cleanly, and corrects a regression introduced by a prior stable backport. This is exactly the kind of follow-up fix stable trees need.
---
## Verification
- **[Phase 1]** Parsed commit message and tags; confirmed syzbot Reported-by and Closes link
- **[Phase 2]** Read fs/netfs/direct_write.c lines 94–205; confirmed retry loop double-issue path
- **[Phase 2]** Read netfs_reissue_write() in fs/netfs/write_issue.c:240-257; confirms it calls netfs_do_issue_write()
- **[Phase 3]** git describe HEAD: v6.18.44
- **[Phase 3]** git blame -L 163,200: retry code from 72d08d2839649, buggy else from a4d1b4ba9754b
- **[Phase 3]** git show a4d1b4ba9754b: introduced netfs_reissue_write() in else branch
- **[Phase 3]** git show 72d08d2839649: introduced sequential DIO write retry loop
- **[Phase 3]** git merge-base --is-ancestor: both prerequisites in HEAD; fix 64f04f978923 NOT in HEAD
- **[Phase 4]** b4 dig -c 64f04f978923: found lore URL, patch v3 15/15
- **[Phase 4]** b4 dig -w: confirmed maintainer CC list
- **[Phase 4]** WebFetch syzbot bug page: KASAN UAF, high priority, exploitable, 8 crashes, v9p trigger via ksys_write
- **[Phase 5]** grep netfs_unbuffered_write_iter: callers in 9p, SMB, netfs buffered_write
- **[Phase 5]** grep prepare_write fs/9p: no matches — 9p lacks prepare_write
- **[Phase 5]** grep prepare_write fs/smb, fs/afs: both have prepare_write set
- **[Phase 6]** Confirmed buggy else branch at direct_write.c:189-199
- **[Phase 6]** git cherry-pick --no-commit 64f04f978923: clean apply (exit 0)
- **[Phase 8]** Syzbot stack trace: UAF at netfs_unbuffered_write via v9fs_file_write_iter + ksys_write
**YES**
fs/netfs/direct_write.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
fs/netfs/direct_write.c +7 -11
@@ -166,13 +166,16 @@ static int netfs_unbuffered_write(struct netfs_io_request *wreq)*/ subreq->error = -EAGAIN ;trace_netfs_sreq (subreq, netfs_sreq_trace_retry); -if (subreq->transferred >0 ) +if (subreq->transferred >0 ) {iov_iter_advance (&wreq->buffer.iter, subreq->transferred); + wreq->transferred += subreq->transferred; + }if (stream->source ==NETFS_UPLOAD_TO_SERVER && wreq->netfs_ops->retry_request) wreq->netfs_ops->retry_request (wreq, stream); +__clear_bit (NETFS_SREQ_MADE_PROGRESS , &subreq->flags);__clear_bit (NETFS_SREQ_NEED_RETRY , &subreq->flags);__clear_bit (NETFS_SREQ_BOUNDARY , &subreq->flags);__clear_bit (NETFS_SREQ_FAILED , &subreq->flags);
@@ -186,17 +189,10 @@ static int netfs_unbuffered_write(struct netfs_io_request *wreq)netfs_get_subrequest (subreq, netfs_sreq_trace_get_resubmit); -if (stream->prepare_write) { +if (stream->prepare_write) stream->prepare_write (subreq); -__set_bit (NETFS_SREQ_IN_PROGRESS , &subreq->flags); -netfs_stat (&netfs_n_wh_retry_write_subreq); - }else { -struct iov_iter source; - -netfs_reset_iter (subreq); - source = subreq->io_iter; -netfs_reissue_write (stream, subreq, &source); - } +__set_bit (NETFS_SREQ_IN_PROGRESS , &subreq->flags); +netfs_stat (&netfs_n_wh_retry_write_subreq); }netfs_unbuffered_write_done (wreq);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 PCI: Wait for device readiness after D3hot -> D0uninitialized transition
In reply to Sasha LevinFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 41167a1e98536b4baf0846fd259c8124bd1c4e1b ]
For a device that advertises No_Soft_Reset == 0, a transition from D3hot to D0uninitialized is a soft reset, and the resulting internal device state is undefined.
Per PCIe r7.0, sec 2.3.1, a transition from D3hot to D0uninitialized mandates a minimum 10 ms delay before accessing the device. Following this delay, the device is permitted to respond to initial configuration requests with a Request Retry Status (RRS) completion status if it needs more time to initialize.
Call pci_dev_wait() after pci_power_up() performs a D3hot->D0uninitialized transition to ensure the device is ready to accept config accesses, as is done after the similar transition in pci_pm_reset().
If the device is already ready, this is essentially a no-op except for one additional config read.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: PCI D3hot→D0 Readiness Wait
**Local tree:** v6.18.43 (Linux 6.18.43)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [PCI] [Wait] — After a D3hot→D0uninitialized power transition, wait for the device to become configuration-ready before proceeding.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Bjorn Helgaas <[email protected]> (author, PCI maintainer)
- **Reviewed-by:** Rafael J. Wysocki <[email protected]> (PM maintainer)
- **Link:**
https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by:, Tested-by:, Cc: stable, or syzbot tags
- Notable: Reviewed by the ACPI/PM maintainer; part of a 2-patch v2 series (patch 2/2)
### Step 1.3: Body Analysis
**Record:**
- **Bug:** After D3hot→D0uninitialized (soft reset when No_Soft_Reset == 0), the kernel waits the mandatory 10 ms (pci_dev_d3_sleep) but does not poll until the device stops returning Request Retry Status (RRS) or error responses.
- **Symptom:** Premature config-space access after power-up; BAR restore / state reads may see ~0 (PCI_ERROR_RESPONSE) or RRS, causing resume/probe failures.
- **Root cause:** pci_power_up() lacked the pci_dev_wait() call that pci_pm_reset() already performs after the same transition.
- **Spec reference:** PCIe r7.0 §2.3.1.
### Step 1.4: Hidden Bug Fix?
**Record:** No — this is an explicit, well-described correctness bug fix for a spec-mandated timing gap, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/pci/pci.c (+22 / -2 lines in series; this commit ~20 net lines)
- **Function modified:** pci_power_up()
- **Scope:** Single-file, surgical fix in one function
### Step 2.2: Code Flow Change
**Record:**
- **Hunk 1 (comment block):** Documents platform vs. PM-capability power-up paths.
- **Hunk 2 (D3hot branch):**
- **Before:** pci_dev_d3_sleep(dev); then immediately mark device
D0.
- **After:** pci_dev_d3_sleep(dev); then, if soft-reset applies (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)), call pci_dev_wait(). On failure, set current_state = PCI_D3cold and return -EIO.
- **Affected path:** D3hot→D0 power-up error/normal resume path inside pci_power_up().
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Logic / spec-compliance / timing correctness fix
- **Mechanism:** After mandatory 10 ms delay, device may still respond with RRS or synthesized ~0 on config reads. Without polling via pci_dev_wait(), subsequent pci_restore_bars() / pci_restore_state() can operate on garbage. The fix mirrors the existing pci_pm_reset() pattern at line 4456.
### Step 2.4: Fix Quality
**Record:**
- **Quality:** High — reuses proven pci_dev_wait() infrastructure already used for FLR, AF_FLR, and pci_pm_reset().
- **Regression risk:** Very low — if device is already ready, one extra config read (author's own statement). Worst case adds up to 60 s wait on genuinely broken hardware, then clean -EIO failure instead of proceeding with bad state.
- **No API changes, no new symbols.**
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Lines 1349–1352 in this tree (pci_dev_d3_sleep only, no wait) are present in current pci_power_up(). pci_dev_wait() exists at line 1209 and is already called from pci_pm_reset() at line 4456. This tree's git history is shallow (single upstream-marker commit per file), so exact introduction SHA of the missing wait cannot be determined locally.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related Changes
**Record:** Part of v2 2-patch series by Bjorn Helgaas (May 2026):
1. PCI: Log device readiness timeouts as errors — changes pci_warn → pci_err in pci_dev_wait() timeout path
2. **This commit** — adds pci_dev_wait() to pci_power_up()
Patch 2 is standalone; patch 1 is a logging improvement only.
### Step 3.4: Author Context
**Record:** Bjorn Helgaas is the PCI subsystem maintainer. Rafael Wysocki (PM maintainer) reviewed. Author applied series to pci/reset for v7.2 per mailing list follow-up.
### Step 3.5: Dependencies
**Record:** No code dependencies on patch 1/2. Requires only existing pci_dev_wait(), pci_dev_d3_sleep(), PCIE_RESET_READY_POLL_MS, and PCI_PM_CTRL_NO_SOFT_RESET — all present in this 6.18.43 tree. **Can apply standalone: YES.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:**
- Series cover: https://lkml.iu.edu/2605.2/03907.html
- This patch (v2 2/2): https://lkml.iu.edu/2605.2/03911.html
- v1 was a single-patch submission (May 14, 2026); v2 added error handling and companion logging patch
- No NAKs found; maintainer applied to pci/reset for v7.2
- No explicit "Cc: stable" nomination found in available threads
### Step 4.2: Reviewers
**Record:** CC list included Rafael Wysocki, Lukas Wunner, Mika Westerberg, Alex Williamson, Mario Limonciello, and other PCI/PM experts. Rafael Wysocki provided Reviewed-by.
### Step 4.3: Bug Report
**Record:** No external bug report or syzbot link. Bug identified via spec compliance analysis and inconsistency with pci_pm_reset() behavior.
### Step 4.4: Series Context
**Record:** 2-patch series; only patch 2/2 is under review. Patch 1 is optional for functionality.
### Step 4.5: Stable List History
**Record:** No stable-list discussion found for this specific fix.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** pci_power_up() (modified), pci_dev_wait() (called), pci_set_full_power_state() (caller), pci_pm_power_up_and_verify_state() (direct caller)
### Step 5.2: Callers of pci_power_up()
**Record:**
1. pci_set_full_power_state() → __pci_set_power_state() when state == PCI_D0 — **system/runtime resume path** (pci_set_power_state() is widely used across drivers)
2. pci_pm_power_up_and_verify_state() → called from:
- pci_pm_init() — boot enumeration (devices left in D3hot by BIOS)
- pci_pm_default_resume_early() — suspend resume
- pci_pm_thaw_noirq() — hibernate thaw
### Step 5.3: Callees
**Record:** platform_pci_set_power_state(), pci_read/write_config_word(), pci_dev_d3_sleep(), pci_dev_wait() — all standard PCI PM primitives.
### Step 5.4: Reachability
**Record:** Triggered on every D3hot→D0 transition through pci_power_up() for devices without No_Soft_Reset. This is a **common** path during suspend/resume, hibernate, and boot. Userspace can indirectly trigger via runtime PM (pci_set_power_state).
### Step 5.5: Similar Patterns
**Record:** pci_pm_reset() at lines 4448–4456 already does pci_dev_d3_sleep() + pci_dev_wait() after D3hot→D0. This commit closes the same gap in pci_power_up().
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (6.18.43)
### Step 6.1: Buggy Code Present?
**Record:** **YES.** Current pci_power_up() at lines 1349–1350:
```1349:1352:drivers/pci/pci.c
if (state == PCI_D3hot)
pci_dev_d3_sleep(dev);
else if (state == PCI_D2)
udelay(PCI_PM_D2_DELAY);
```No pci_dev_wait() call. pci_dev_wait() and pci_pm_reset()'s correct usage both exist in this tree.
### Step 6.2: Backport Complications
**Record:** **Clean apply expected.** No refactoring conflicts visible. pci_power_up() structure matches the patch base (5a9af0bb2c71 index in patch matches current code layout).
### Step 6.3: Related Fixes Already Present?
**Record:** No — git log --grep found no prior "device readiness" or equivalent fix in this tree. Patch 1 (warn→err) also not present (line 1261 still uses pci_warn).
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** **PCI core** (drivers/pci/pci.c) — **CORE** subsystem. Affects all PCI/PCIe devices on resume and boot.
### Step 7.2: Activity Level
**Record:** Mature, actively maintained subsystem. PM paths are long- standing; this is a gap in an established code path, not new subsystem code.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** All systems with PCI devices that:
- Support native PM (pm_cap present)
- Have No_Soft_Reset == 0 (soft reset on D3hot→D0)
- Need more than 10 ms to become configuration-ready after soft reset
This includes many laptops (BIOS leaves devices in D3hot at boot, per existing comment at lines 1402–1405) and suspend/resume scenarios.
### Step 8.2: Trigger Conditions
**Record:**
- **When:** D3hot→D0 power-up via pci_power_up() with soft-reset semantics
- **Likelihood:** Intermittent — depends on device initialization time; more likely on slower devices or under load
- **Userspace trigger:** Indirect via runtime PM resume; unprivileged users can trigger device PM on assigned devices
### Step 8.3: Failure Mode Severity
**Record:**
- **Failure mode:** Failed resume, incorrect BAR restoration, driver probe failure, possible oops if driver proceeds with bad config
- **Severity:** **HIGH** for affected devices (resume failure renders hardware unusable until reboot); **MEDIUM** population-wide (only soft-reset-capable devices that are slow to initialize)
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH — fixes real resume/boot failures on affected hardware; aligns with PCIe spec and existing pci_pm_reset() behavior
- **Risk:** VERY LOW — minimal diff, proven helper, no-op on ready devices
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Fixes a real spec-compliance bug in a core resume path
- Can cause suspend/resume and boot failures on affected PCI devices
- Small, surgical, obviously correct (mirrors pci_pm_reset())
- PCI maintainer authorship + PM maintainer review
- All required infrastructure exists in 6.18.43
- Buggy code confirmed present in this tree
**AGAINST backport:**
- No user bug reports or syzbot reproduction (theoretical/spec-driven fix)
- Part of 2-patch series (patch 1 is logging-only, not required)
- Adds latency (up to 60 s) only on genuinely broken/unresponsive devices
**Unresolved:** Exact kernel version when pci_power_up() was introduced without the wait (shallow git history in this stable tree).
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — mirrors existing pci_pm_reset() pattern; reviewed by PM maintainer
2. Fixes a real bug affecting users? **PASS** — spec-mandated readiness gap on D3hot→D0 resume
3. Important issue? **PASS** — resume/probe failures (HIGH for affected devices)
4. Small and contained? **PASS** — ~20 lines, one function, one file
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — buggy code and all dependencies present in 6.18.43
### Step 9.3: Exception Categories
**Record:** None (not a quirk/DT/build/doc fix — a core correctness bug fix).
### Step 9.4: Decision Rationale
This commit closes a long-standing gap where pci_power_up() — used on boot, suspend resume, and hibernate thaw — did not wait for device readiness after a D3hot→D0 soft reset, even though pci_pm_reset() already did. The fix is minimal, uses existing infrastructure, has maintainer review, and addresses a real failure mode (premature config access after power-up) that can break device resume on affected hardware. The risk of backporting is negligible since ready devices pay only one extra config read.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user-provided commit message
- **[Phase 1]** Confirmed Reviewed-by: Rafael Wysocki; no syzbot/Reported-by
- **[Phase 2]** Read current pci_power_up() at lines 1303–1360:
missing pci_dev_wait() confirmed
- **[Phase 2]** Read pci_pm_reset() at lines 4429–4457: has pci_dev_wait() after D3hot→D0
- **[Phase 2]** Read pci_dev_wait() at lines 1209–1290: polling logic with 60 s timeout confirmed
- **[Phase 3]** git describe HEAD: v6.18.43-1-gc7f0dac02d232
- **[Phase 3]** git blame -L 1340,1365 drivers/pci/pci.c: D3hot branch lacks wait
- **[Phase 3]** git log --grep: no prior fix for this issue in tree
- **[Phase 4]** Web search: found v2 series cover at lkml.iu.edu/2605.2/03907.html
- **[Phase 4]** Web search: found patch 2/2 at lkml.iu.edu/2605.2/03911.html — diff matches provided commit
- **[Phase 4]** Web search: found patch 1/2 at lkml.iu.edu/2605.2/03901.html — logging only, not a prerequisite
- **[Phase 4]** Web search: maintainer applied to pci/reset for v7.2 (openwall list, May 22 2026)
- **[Phase 4]** lore.kernel.org direct fetch: 403 Forbidden (used lkml.iu.edu mirror instead)
- **[Phase 4]** b4 dig: no commit hash available in tree (commit not yet applied); could not run b4 dig -c
- **[Phase 5]** grep pci_power_up: callers in pci_set_full_power_state(), pci_pm_power_up_and_verify_state()
- **[Phase 5]** Read pci-driver.c lines 541–572, 1103–1118:
resume/thaw paths call pci_pm_power_up_and_verify_state()
- **[Phase 5]** Read pci.c line 3196: boot path pci_pm_init() calls pci_pm_power_up_and_verify_state()
- **[Phase 6]** Confirmed PCI_PM_CTRL_NO_SOFT_RESET, PCIE_RESET_READY_POLL_MS, pci_dev_d3_sleep() all exist
- **[Phase 6]** Line 1261 still has pci_warn (patch 1 not applied) — patch 2 applies independently
- **[Phase 8]** Assessed failure mode: resume/probe failure on slow-to- initialize soft-reset devices
**YES**
drivers/pci/pci.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/pci/pci.c +22 -2
@@ -1305,7 +1305,18 @@ int pci_power_up(struct pci_dev *dev)bool need_restore;pci_power_t state;u16 pmcsr; +int ret; +/* +* When setting power state to D0, platform_pci_set_power_state() +* ensures main power is on. If it puts the device in D0, it also +* completes any required delays after the transition; if it leaves +* the device in D1, D2, or D3hot, we use the PM Capability to +* transition to D0. +* +* In all cases, the device is either Configuration-Ready or +* inaccessible upon return. +*/ platform_pci_set_power_state (dev,PCI_D0 );if (!dev->pm_cap) {
@@ -1346,10 +1357,19 @@ int pci_power_up(struct pci_dev *dev)pci_write_config_word (dev, dev->pm_cap +PCI_PM_CTRL ,0 );/* Mandatory transition delays; see PCI PM 1.2. */ -if (state == PCI_D3hot) +if (state == PCI_D3hot) {pci_dev_d3_sleep (dev); -else if (state ==PCI_D2 ) +if (!(pmcsr &PCI_PM_CTRL_NO_SOFT_RESET )) { + ret =pci_dev_wait (dev,"power up D3hot->D0uninitialized" , +PCIE_RESET_READY_POLL_MS ); +if (ret) { + dev->current_state = PCI_D3cold; +return -EIO ; + } + } + }else if (state ==PCI_D2 ) {udelay (PCI_PM_D2_DELAY ); + } end: dev->current_state =PCI_D0 ;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.1] PCI: Wait for device readiness after D3hot -> D0uninitialized transition
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 18 lines
From: Bjorn Helgaas <[email protected]>
[ Upstream commit
41167a1e98536b4baf0846fd259c8124bd1c4e1b]For a device that advertises
No_Soft_Reset== 0, a transition from D3hot to D0uninitialized is a soft reset, and the resulting internal device state is undefined.Per PCIe r7.0, sec 2.3.1, a transition from D3hot to D0uninitialized mandates a minimum 10 ms delay before accessing the device. Following this delay, the device is permitted to respond to initial configuration requests with a Request Retry Status (RRS) completion status if it needs more time to initialize.
Call
pci_dev_wait()afterpci_power_up()performs aD3hot->D0uninitializedtransition to ensure the device is ready to accept config accesses, as is done after the similar transition inpci_pm_reset().
Quoted 7 lines
If the device is already ready, this is essentially a no-op except for one additional config read.
Signed-off-by Bjorn Helgaas <[email protected]>Reviewed-by Rafael J. Wysocki (Intel) <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 wifi: mt76: mt7925: add Netgear A8500 USB device ID
In reply to Sasha LevinFrom: Devin Wittmayer <[email protected]>
[ Upstream commit 291b067a02b9c1fd272057ebf47c365260955fd2 ]
Add USB device ID for the Netgear A8500 (0846:9050) which uses the mt7925 chipset.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: wifi: mt76: mt7925: add Netgear A8500 USB device ID
**Local tree:** v6.18.44 (Linux 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [wifi: mt76: mt7925] [add] — Add USB device ID for Netgear A8500 (0846:9050) to the existing mt7925u driver.
### Step 1.2: Parse all commit message tags
**Record:**
- **Signed-off-by:** Devin Wittmayer <[email protected]> (author)
- **Link:** https://patch.msgid.link/20260527144735.10254-1-
[email protected]
- **Signed-off-by:** Felix Fietkau <[email protected]> (mt76 maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: [email protected]
- Notable pattern: maintainer (Felix Fietkau) Signed-off-by is a strong quality signal; absence of Cc: stable is expected per review pipeline rules.
### Step 1.3: Analyze commit body
**Record:**
- **Bug description:** Netgear A8500 USB WiFi adapter (VID:PID 0846:9050) uses the mt7925 chipset but is not recognized by the kernel because its USB ID is missing from mt7925u_device_table[].
- **Symptom:** Device enumerates as USB hardware but does not bind to mt7925u driver; WiFi is non-functional.
- **Root cause:** Missing entry in the USB device ID table.
- **Version info:** None stated in commit message.
### Step 1.4: Detect hidden bug fixes
**Record:** Not a hidden bug fix in the traditional sense (no crash/UAF/leak). This is an explicit **hardware enablement** fix — a device ID addition that allows an existing, fully functional driver to bind to real hardware. Falls under the stable exception category for new device IDs.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes
**Record:**
- **Files changed:** drivers/net/wireless/mediatek/mt76/mt7925/usb.c (+3 lines)
- **Functions modified:** None functionally; only mt7925u_device_table[] static data
- **Scope:** Single-file, surgical, 3-line addition
### Step 2.2: Code flow change
**Record:**
- **Before:** USB core matches 0846:9050 against mt7925u_device_table[] → no match → driver does not probe.
- **After:** USB core matches 0846:9050 → mt7925u_probe() is called with driver_info = MT7925_FIRMWARE_WM → normal mt7925u initialization path.
- **Path affected:** USB device enumeration / driver binding at plug-in time.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Hardware workaround / device ID addition (stable exception)
- **Mechanism:** Without the VID/PID entry, usb_driver.id_table matching fails and the adapter is unusable despite the mt7925 driver being present and functional for other devices.
### Step 2.4: Fix quality assessment
**Record:**
- **Obviously correct:** Yes — identical pattern to the existing A9000 entry (0846:9072) already in this tree.
- **Minimal/surgical:** Yes — 3 lines, no logic changes.
- **Regression risk:** Very low — only adds a new match entry; does not alter behavior for existing devices.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the changed lines
**Record:**
- mt7925u_device_table[] introduced in c948b5da6bbec (Sep 2023, "add Mediatek Wi-Fi7 driver for mt7925 chips")
- A9000 entry added in f6159b2051e15 (Jul 2025, Nick Morrow) — already present in this tree
- A8500 entry (0846:9050) is **not yet** in this tree
### Step 3.2: Follow Fixes: tag
**Record:** No Fixes: tag present. N/A.
### Step 3.3: Related file history
**Record:**
- Recent commits to mt7925/usb.c include functional fixes (crash, NULL deref, deadlock) and the A9000 ID addition f6159b2051e15
- Similar precedent: fc6627ca8a5f8 added Netgear A7500 (0846:9065) to mt7921/usb.c with Cc: [email protected]
- **Standalone:** Yes — single patch, no series dependency
### Step 3.4: Author's other commits
**Record:** Devin Wittmayer has no other commits in this tree (author is new contributor). Felix Fietkau is the mt76 maintainer who applied the patch.
### Step 3.5: Prerequisites
**Record:**
- Requires CONFIG_MT7925U and existing mt7925u driver — both present in v6.18.44
- Uses MT7925_FIRMWARE_WM — already declared via MODULE_FIRMWARE in same file
- **Can apply standalone:** Yes
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:** b4 dig -c could not be run (commit not in local tree). b4 dig with message-id failed (incorrect syntax for message-id lookup). WebFetch of patch.msgid.link and lore.kernel.org returned bot-protection page. **UNVERIFIED:** Full mailing list review thread not accessible.
### Step 4.2: Reviewers from b4 dig -w
**Record:** UNVERIFIED — could not retrieve recipient list.
### Step 4.3: Bug report search
**Record:** No Reported-by: or bugzilla/syzbot links in commit message. Hardware enablement request from contributor.
### Step 4.4: Related patches/series
**Record:** Part of a well-established pattern of Netgear USB ID additions to mt76 drivers (mt7921 A7500, mt7925 A9000). Standalone one- patch submission.
### Step 4.5: Stable mailing list history
**Record:** UNVERIFIED — lore.kernel.org inaccessible. However, the nearly identical A9000 commit (f6159b2051e15) in this tree included Cc: [email protected], establishing subsystem precedent for such patches.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** No functions modified. Data table mt7925u_device_table[] consumed by module_usb_driver(mt7925u_driver) via .id_table.
### Step 5.2: Trace callers
**Record:** USB core calls usb_match_device() against mt7925u_device_table[] during enumeration → on match, calls mt7925u_probe() (line 132 of usb.c). Triggered when user plugs in the USB adapter.
### Step 5.3: Trace callees
**Record:** On successful match, mt7925u_probe() initializes the mt7925 chipset using existing driver infrastructure and MT7925_FIRMWARE_WM firmware.
### Step 5.4: Call chain / reachability
**Record:** USB hotplug during normal desktop/laptop use. Any user with this hardware who plugs in the adapter is affected. No privilege required to trigger enumeration.
### Step 5.5: Similar patterns
**Record:** Identical pattern in same file for A9000 (0846:9072). Similar Netgear IDs in mt7921/usb.c (0846:9060, 0846:9065). All use same USB_DEVICE_AND_INTERFACE_INFO + MT7925_FIRMWARE_WM / equivalent firmware constant.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does the buggy code exist?
**Record:** **Yes.** The mt7925u driver and device table exist in v6.18.44, but the A8500 entry (0846:9050) is **missing**. Current table has only MediaTek reference (0e8d:7925) and Netgear A9000 (0846:9072). Driver has been present since c948b5da6bbec (confirmed ancestor of HEAD).
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** File exists with identical structure. Insertion point is between the MediaTek entry and the A9000 entry (as shown in the candidate diff). Only minor difference: local file uses ISC license header vs BSD-3-Clause-Clear in candidate diff — irrelevant to the 3-line ID addition.
### Step 6.3: Related fixes already present? **Record:** A9000 ID (f6159b2051e15) is already in this tree. No duplicate A8500 entry found. No alternate fix for A8500.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/net/wireless/mediatek/mt76/ — **IMPORTANT** (wireless networking driver). Affects users of specific USB WiFi hardware, not universal.
### Step 7.2: Subsystem activity
**Record:** mt7925 subsystem is actively maintained in this tree — numerous bugfix commits in recent history (NULL deref, deadlock, crash fixes), indicating mature driver with ongoing stable fixes.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of the Netgear A8500 USB WiFi 7 adapter (0846:9050) running kernel 6.18.y with CONFIG_MT7925U enabled.
### Step 8.2: Trigger conditions
**Record:** Plugging in the Netgear A8500 USB adapter. Common, deterministic, no special conditions. Unprivileged user can trigger via USB device insertion.
### Step 8.3: Failure mode severity
**Record:** Without fix: adapter is completely non-functional (no driver binding). **Severity: MEDIUM** for affected hardware users (device unusable, but not a crash/corruption). With fix: normal WiFi operation.
### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** Enables WiFi on a commercially available Netgear USB adapter for stable kernel users
- **Risk:** Very low — 3-line ID table entry, zero logic change, identical to already-accepted A9000 entry
- **Ratio:** Strongly favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compilation
**FOR backporting:**
- Classic device ID addition to existing driver (explicit stable exception)
- Driver fully exists in v6.18.44 (CONFIG_MT7925U, probe/remove, firmware)
- Identical pattern to A9000 entry already in this tree
- Subsystem precedent: similar Netgear ID patches nominated for stable (Cc: stable on A9000, A7500)
- Maintained by Felix Fietkau (Signed-off-by)
- 3 lines, zero regression risk to existing devices
- Enables real hardware for stable users
**AGAINST backporting:**
- Not a crash/security/corruption fix — hardware enablement only
- No Tested-by or Reported-by in commit message
- Mailing list discussion unverified
**UNRESOLVED:**
- Full lore review thread not accessible
- No explicit Tested-by confirmation
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — trivial ID entry, maintainer-applied; Tested-by absent but pattern is standard
2. Fixes a real bug affecting users? **PASS** — device non-functional without ID
3. Important issue? **PASS** — hardware enablement for real product (stable exception category)
4. Small and contained? **PASS** — 3 lines, 1 file
5. No new features or APIs? **PASS** — device ID only
6. Can apply to local tree? **PASS** — driver and file present, clean apply expected
### Step 9.3: Exception category
**Record:** **NEW DEVICE ID** — adding PCI/USB ID to existing driver. Explicitly listed as a stable exception. The mt7925u driver exists; only the ID is new.
### Step 9.4: Decision rationale
This commit adds USB VID/PID 0846:9050 for the Netgear A8500 to the existing mt7925u driver in the v6.18.44 stable tree. The driver is fully present; the A9000 sibling device (0846:9072) is already supported in this tree via an identical 3-line patch that was nominated for stable. Without this entry, the A8500 adapter cannot bind to any driver and is completely unusable. The change is minimal, obviously correct, introduces no new APIs, and matches established stable backport practice for mt76 Netgear USB adapters.
---
## Verification
- [Phase 1] Parsed subject, tags, body from user-provided commit message
- [Phase 1] Confirmed: no Fixes/Reported-by/Tested-by/Cc:stable tags; Felix Fietkau Signed-off-by present
- [Phase 2] Diff analysis: 3 lines added to mt7925u_device_table[] in usb.c
- [Phase 3] git describe HEAD: v6.18.44
- [Phase 3] git blame on usb.c lines 12-18: table from c948b5da6bbec (2023), A9000 from f6159b2051e15 (2025)
- [Phase 3] git merge-base --is-ancestor c948b5da6bbec HEAD: mt7925 driver is in tree
- [Phase 3] git show f6159b2051e15: A9000 precedent with Cc:
[email protected]
- [Phase 3] git show fc6627ca8a5f8: mt7921 A7500 precedent with Cc:
stable
- [Phase 4] WebFetch patch.msgid.link: blocked by bot protection — UNVERIFIED
- [Phase 4] WebFetch lore.kernel.org: blocked — UNVERIFIED
- [Phase 4] b4 dig: commit not in tree, could not dig by hash — UNVERIFIED
- [Phase 5] Read mt7925u_probe() at line 132: standard USB probe path
- [Phase 5] grep 0846 in mt76: A9000 (9072) present, A8500 (9050) absent
- [Phase 6] Read current usb.c: A8500 ID missing, driver fully functional
- [Phase 6] Kconfig confirms CONFIG_MT7925U exists
- [Phase 6] MODULE_FIRMWARE(MT7925_FIRMWARE_WM) present in usb.c
- [Phase 7] git log --oneline -20 -- mt7925/: active subsystem with many stable-worthy fixes
- [Phase 8] Failure mode: no driver binding → device unusable (not crash)
**YES**
drivers/net/wireless/mediatek/mt76/mt7925/usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/usb.c +3 -0
@@ -12,6 +12,9 @@static const struct usb_device_id mt7925u_device_table[] = { {USB_DEVICE_AND_INTERFACE_INFO (0x0e8d ,0x7925 ,0xff ,0xff ,0xff ), .driver_info = (kernel_ulong_t )MT7925_FIRMWARE_WM }, +/* Netgear, Inc. A8500 */ + {USB_DEVICE_AND_INTERFACE_INFO (0x0846 ,0x9050 ,0xff ,0xff ,0xff ), + .driver_info = (kernel_ulong_t )MT7925_FIRMWARE_WM },/* Netgear, Inc. A9000 */ {USB_DEVICE_AND_INTERFACE_INFO (0x0846 ,0x9072 ,0xff ,0xff ,0xff ), .driver_info = (kernel_ulong_t )MT7925_FIRMWARE_WM },
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IRH8
In reply to Sasha LevinFrom: Moritz Baron <[email protected]>
[ Upstream commit 853e10ec445984e99b3c7f6375f4e185614b842a ]
The Lenovo Yoga Pro 7 14IRH8 (ALC287 codec, subsystem ID 0x17aa:0x38b1) has bass speakers on pin 0x17 that are not routed through a DAC with volume control. This causes the bass speakers to play at full volume regardless of the volume slider position.
Apply ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN which corrects the DAC routing for pin 0x17, enabling proper volume control. This is the same fix used for other Yoga Pro 7 models with identical audio topology (14APH8, 14AHP9, 14ASP10, 14IAH10).
---
LLM Generated explanations, may be completely bogus:
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 2)...
Retry attempt 2...
# Stable Backport Analysis: ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IRH8
**Local tree:** Linux 6.18.44 (v6.18.44)
**Commit under review:** 853e10ec44598 (on master, not yet in this tree)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [ALSA: hda/realtek] [add] quirk for Lenovo Yoga Pro 7 14IRH8 — maps codec SSID 0x17aa:0x38b1 to existing bass-speaker DAC routing fixup
### Step 1.2: Tags
**Record:**
- **Link:** https://bugzilla.kernel.org/show_bug.cgi?id=217949
- **Link:**
https://patch.msgid.link/[email protected]
hannover.de
- **Co-developed-by:** Felix Aljoscha Schnuell
- **Signed-off-by:** Felix Aljoscha Schnuell, Moritz Baron, Takashi Iwai
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Cc: stable
- Notable: Bugzilla link documents a long-standing user report; Takashi Iwai (ALSA maintainer) merged it
### Step 1.3: Body Analysis
**Record:**
- **Bug:** Lenovo Yoga Pro 7 14IRH8 (ALC287, codec SSID 0x17aa:0x38b1) routes bass speakers on pin 0x17 through a DAC without volume control
- **Symptom:** Bass speakers play at full volume regardless of the volume slider
- **Root cause:** Wrong quirk match — machine shares PCI SSID 0x17aa:0x3852 with Yoga 7 14ITL5 and gets the wrong SND_PCI_QUIRK fixup
- **Fix:** Add HDA_CODEC_QUIRK for codec SSID 0x17aa:0x38b1 applying existing ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN
- **Version info:** None explicit; hardware is a 2023-era Lenovo laptop
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not disguised — this is an explicit hardware quirk fix for broken audio volume control, not cleanup or optimization.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** sound/hda/codecs/realtek/alc269.c (+4 lines, 0 removed)
- **Functions modified:** alc269_fixup_tbl[] static table only
- **Scope:** Single-file, surgical quirk-table addition
### Step 2.2: Code Flow Change
**Record:**
- **Before:** Yoga Pro 7 14IRH8 matches SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS) — wrong fixup for this hardware
- **After:** HDA_CODEC_QUIRK(0x17aa, 0x38b1, ...) is inserted *before* the 0x3852 PCI quirk; codec SSID match takes precedence, applying ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN
- **Path affected:** Codec probe/init during audio driver load (every boot for affected hardware)
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Hardware workaround / logic correctness fix
- **Mechanism:** Incorrect pin-to-DAC routing leaves bass speakers on DAC 0x06/0x08 (no volume control). The existing fixup function alc287_fixup_yoga9_14iap7_bass_spk_pin() reroutes pin 0x17 to DAC 0x02/0x03 with proper volume control
### Step 2.4: Fix Quality
**Record:**
- **Quality:** High — reuses a fixup already applied to Yoga Pro 7 14APH8, 14AHP9, 14ASP10, 14IAH10, and others in this tree
- **Pattern:** Identical to b98ecc1c60ad7 (Yoga Pro 7 14IMH9 / codec SSID 0x38cf vs shared PCI SSID 0x3847)
- **Regression risk:** Very low — only affects machines with codec SSID 0x17aa:0x38b1; HDA_CODEC_QUIRK uses match_codec_ssid = true
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- Insertion point lines 7435–7438 blame to b98ecc1c60ad7 (14IMH9 HDA_CODEC_QUIRK, 2026-03-31) and aeeb85f26c3bb (Realtek driver split, 2025-07-09) for the 0x3852 PCI quirk
- The mis-match condition (shared PCI SSID) has existed since the Realtek driver split; the 14IRH8-specific codec quirk was never added until 853e10ec44598
### Step 3.2: Fixes: Tag
**Record:** No Fixes: tag present — N/A
### Step 3.3: Related File History
**Record:**
- ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN fixup function present since aeeb85f26c3bb (driver split)
- Related quirk additions already in v6.18.44: 634e5e1e06f5c (14APH8), ad22051afdad9 (14AHP9), 8d70503068510 (14ASP10), 0fa5713ac7a19 (14IAH10), b98ecc1c60ad7 (14IMH9)
- HDA_CODEC_QUIRK macro present since at least e656ef8698e28 in this file
- Standalone patch — not part of a series
### Step 3.4: Author Context
**Record:** Moritz Baron / Felix Schnuell are student contributors; patch merged by Takashi Iwai. No prior commits from these authors in this tree's realtek path.
### Step 3.5: Dependencies
**Record:**
- **Dependency:** ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN fixup — **present** in v6.18.44
- **Dependency:** HDA_CODEC_QUIRK macro — **present** in sound/hda/common/hda_local.h
- **Dependency:** alc287_fixup_yoga9_14iap7_bass_spk_pin() — **present** since driver split
- Can apply standalone: **yes** (git apply --check succeeded on HEAD)
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:**
- b4 dig -c 853e10ec44598 →
https://patch.msgid.link/[email protected]
hannover.de
- b4 dig -a: single revision found (no v2/v3 series)
- Lore page blocked by bot protection (Anubis) — could not read thread content
### Step 4.2: Reviewers
**Record:** b4 dig -w returned only the patch URL; full recipient list not retrieved. Takashi Iwai Signed-off-by confirms maintainer acceptance.
### Step 4.3: Bug Report
**Record:**
- Bugzilla #217949: "Yoga Pro 7 14IRH8 volume controls broken" — filed 2023-09-25, attachment from reporter
- Severity from reporter perspective: broken volume control on a commercial laptop
- Long-standing issue (nearly 3 years before fix)
### Step 4.4: Related Patches
**Record:** Same fixup family used across multiple Yoga Pro 7 models; 14IMH9 (b98ecc1c60ad7) uses identical HDA_CODEC_QUIRK pattern for shared PCI SSID and is already in v6.18.44
### Step 4.5: Stable List History
**Record:** Not searched on lore stable list (lore blocked). However, the original 14APH8 quirk (634e5e1e06f5c) explicitly had `Cc:
[email protected]`, establishing precedent for this fixup family in stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** alc269_fixup_tbl[] (modified); alc287_fixup_yoga9_14iap7_bass_spk_pin() (existing, invoked via fixup chain)
### Step 5.2: Callers
**Record:** snd_hda_pick_fixup(codec, alc269_fixup_models, alc269_fixup_tbl, alc269_fixups) at line 8471, called during Realtek ALC269 codec probe (alc269_probe path). Triggered on every boot when HDA codec is enumerated.
### Step 5.3: Callees
**Record:** Selected fixup invokes alc287_fixup_yoga9_14iap7_bass_spk_pin() which sets pin config for 0x17 and connects it to DAC 0x02/0x03 (DACs with volume control), chained to ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK
### Step 5.4: Reachability
**Record:** Triggered automatically during kernel audio subsystem init on affected hardware — no userspace action required beyond normal boot. Every Yoga Pro 7 14IRH8 owner is affected.
### Step 5.5: Similar Patterns
**Record:** At least 6 other models in this tree use ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN with the same bass-speaker topology; 14IMH9 uses the same HDA_CODEC_QUIRK pattern for PCI SSID collision.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Buggy Code Exists?
**Record:** **Yes.** SND_PCI_QUIRK(0x17aa, 0x3852, ...) at line 7438 matches Yoga Pro 7 14IRH8 via shared PCI SSID. Codec SSID 0x38b1 quirk is **missing** from v6.18.44.
### Step 6.2: Backport Complications
**Record:** **Clean apply.** git format-patch -1 853e10ec44598 --stdout | git apply --check succeeded with exit code 0 on HEAD. Line numbers differ (master ~7741 vs stable ~7438) but context matches.
### Step 6.3: Related Fixes Already Present?
**Record:** The fixup function and enum exist; sibling model quirks exist; only the 0x38b1 table entry is missing. No duplicate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** sound/hda/codecs/realtek/ — IMPORTANT (affects laptop users with this specific hardware, not universal core path)
### Step 7.2: Subsystem Activity
**Record:** Actively maintained — multiple realtek quirk commits in v6.18.44 history (TongFang, HP, Lenovo, ASUS, Samsung additions in recent weeks)
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** Lenovo Yoga Pro 7 14IRH8 owners with ALC287 codec (CONFIG_SND_HDA_INTEL / SOF audio stack). Driver-specific, single- machine SSID.
### Step 8.2: Trigger Conditions
**Record:** Every boot with default audio driver — automatic codec probe. Common/likely for all owners of this model. Not security- relevant; not userspace-triggerable beyond normal audio use.
### Step 8.3: Failure Mode Severity
**Record:** Bass speakers at uncontrollable full volume — **MEDIUM** functional bug. Not a crash, deadlock, or data corruption, but makes volume control effectively broken for bass output. Poor UX and potentially harmful at high volume.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for affected users (restores working volume control using proven fixup)
- **Risk:** VERY LOW (4-line table entry, codec-SSID-specific, pattern validated on 6+ sibling models)
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Real hardware bug with Bugzilla report since 2023
- Hardware quirk exception category (explicitly allowed for stable)
- Tiny, surgical 4-line change
- Reuses existing, battle-tested fixup already in tree
- Identical pattern to 14IMH9 quirk already backported to v6.18.44
- Merged by ALSA maintainer Takashi Iwai
- Applies cleanly to v6.18.44
- All prerequisites present in this tree
**AGAINST backport:**
- Not a crash/security/corruption issue (severity is functional audio)
- Lore discussion content unverified (bot protection)
**Unresolved:**
- No reviewer thread content (lore blocked)
- No explicit Tested-by on this specific machine in commit message
Neither unresolved item affects the technical decision.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — reuses fixup proven on identical topology across multiple Yoga Pro 7 models; maintainer merged
2. Fixes a real bug? **PASS** — Bugzilla #217949, volume control non- functional
3. Important issue? **PASS** — broken volume control on commercial laptop (MEDIUM severity, real user impact)
4. Small and contained? **PASS** — 4 lines, 1 file
5. No new features/APIs? **PASS** — quirk table entry only
6. Can apply to local tree? **PASS** — clean apply, all dependencies present
### Step 9.3: Exception Category
**Record:** Hardware quirk/workaround (audio codec quirk for broken DAC routing on specific Lenovo laptop)
### Step 9.4: Decision Rationale
This commit adds a codec-SSID-specific quirk entry so the Lenovo Yoga Pro 7 14IRH8 gets the correct bass-speaker DAC routing fixup instead of the wrong PCI-SSID-based quirk shared with Yoga 7 14ITL5. The fix is minimal, self-contained, uses infrastructure already present in Linux 6.18.44, follows an established pattern already applied to sibling models in this tree, and addresses a documented multi-year user bug. It fits squarely within the hardware-quirk exception for stable kernels.
---
## Verification
- [Phase 1] Parsed subject, tags, body from commit 853e10ec44598
- [Phase 1] Bugzilla #217949 confirmed: "Yoga Pro 7 14IRH8 volume controls broken" (2023-09-25)
- [Phase 2] Diff: +4 lines in alc269_fixup_tbl[], adds HDA_CODEC_QUIRK(0x17aa, 0x38b1, ...)
- [Phase 2] Read alc287_fixup_yoga9_14iap7_bass_spk_pin() at lines 3408–3423 — reroutes pin 0x17 to DACs with volume control
- [Phase 3] git describe HEAD → v6.18.44; Makefile VERSION 6.18.44
- [Phase 3] git merge-base --is-ancestor 853e10ec44598 HEAD → exit 1 (commit NOT in current tree)
- [Phase 3] git blame -L 7435,7440 → 14IMH9 quirk at 7435, 0x3852 PCI quirk since driver split
- [Phase 3] ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN present since aeeb85f26c3bb
- [Phase 3] Related quirk commits in tree: 634e5e1e06f5c, b98ecc1c60ad7, 0fa5713ac7a19, etc.
- [Phase 4] b4 dig -c 853e10ec44598 → patch.msgid.link URL found
- [Phase 4] b4 dig -a → single revision
- [Phase 4] Lore thread fetch blocked by Anubis bot protection — UNVERIFIED
- [Phase 5] snd_hda_pick_fixup() call at line 8471 confirmed
- [Phase 5] HDA_CODEC_QUIRK macro at hda_local.h:314-320 with match_codec_ssid = true
- [Phase 6] 0x38b1 not present in tree; 0x3852 PCI quirk present at line 7438
- [Phase 6] git format-patch ... | git apply --check → exit 0 (clean apply)
- [Phase 6] ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN fixup struct at lines 6255–6260 confirmed
- [Phase 8] Failure mode: bass at full volume, severity MEDIUM
**YES**
sound/hda/codecs/realtek/alc269.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/hda/codecs/realtek/alc269.c +4 -0
@@ -7437,6 +7437,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {HDA_CODEC_QUIRK (0x17aa ,0x38cf ,"Lenovo Yoga Pro 7 14IMH9" ,ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3847 ,"Legion 7 16ACHG6" ,ALC287_FIXUP_LEGION_16ACHG6 ),SND_PCI_QUIRK (0x17aa ,0x384a ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), +/* Yoga Pro 7 14IRH8 shares PCI SSID 17aa:3852 with Yoga 7 14ITL5; +* use codec SSID to distinguish them +*/ +HDA_CODEC_QUIRK (0x17aa ,0x38b1 ,"Lenovo Yoga Pro 7 14IRH8" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3852 ,"Lenovo Yoga 7 14ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rsi: avoid reading TKIP MIC keys for non-TKIP ciphers
In reply to Sasha LevinFrom: Pengpeng Hou <[email protected]>
[ Upstream commit 843fe9bc583b7686ca68312ac9319c9240a73c03 ]
rsi_hal_load_key() copies tx_mic_key and rx_mic_key from data[16] and data[24] whenever key data is present. Those offsets are only part of the 32-byte TKIP key layout. Shorter keys used by other ciphers, such as CCMP, do not provide those bytes, so the unconditional copies can read past the supplied key buffer.
Only copy the MIC keys for TKIP, and reject malformed TKIP keys that are shorter than the expected 32-byte layout.
---
LLM Generated explanations, may be completely bogus:
The background git log -S "tx_mic_key" search finished, but it wasn’t very useful: with --all it mostly hit unrelated commits, and without it the shallow clone only reaches the graft root (5d324e5159d9e).
Tag checks are more reliable here — the unconditional MIC key copies are present at least as far back as v5.10.1, v6.12.1, and v6.18.44.
**Verdict for this 6.18.44 tree: YES** — real OOB read on CCMP key install, small maintainer-reviewed fix, applies cleanly.
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +4 -2
@@ -848,8 +848,10 @@ int rsi_hal_load_key(struct rsi_common *common, }else {memcpy (&set_key->key[0 ][0 ], data, key_len); } -memcpy (set_key->tx_mic_key, &data[16 ],8 ); -memcpy (set_key->rx_mic_key, &data[24 ],8 ); +if (cipher ==WLAN_CIPHER_SUITE_TKIP ) { +memcpy (set_key->tx_mic_key, &data[16 ],8 ); +memcpy (set_key->rx_mic_key, &data[24 ],8 ); + } }else {memset (&set_key[FRAME_DESC_SZ ],0 , frame_len -FRAME_DESC_SZ ); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 isofs: handle set_blocksize failures
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 25ef4c4d9f0e96fb89c0ae0d7127c3f12a31bc32 ]
isofs uses buffer_heads, which don't handle block size > PAGE_SIZE well. Without this, mounting we will hit the
BUG_ON(offset >= folio_size(folio));
in folio_set_bh on the first __bread_gfp call.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: isofs: handle set_blocksize failures
**Local tree:** v6.18.44 (Linux 6.18.44)
**Commit under review:** 25ef4c4d9f0e9 (on master, not yet in this tree)
**Patch series:** [PATCH 07/10] of “fix crashes when mounting legacy file system with sector size > PAGE_SIZE”
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject line**
Record: [isofs] [handle] — check return value of sb_set_blocksize() during mount and fail cleanly instead of continuing
**Step 1.2 — Tags**
Record:
- Signed-off-by: Christoph Hellwig <[email protected]> (author)
- Link: https://patch.msgid.link/[email protected]
- Signed-off-by: Christian Brauner <[email protected]> (committer)
- No Fixes:, Reported-by:, Cc: [email protected], Reviewed- by: in the committed message (Jan Kara reviewed on-list; see Phase 4)
- No syzbot report
**Step 1.3 — Body analysis**
Record:
- **Bug:** isofs uses buffer heads, which cannot handle block sizes > PAGE_SIZE. If sb_set_blocksize() fails and mount continues, the first __bread_gfp path hits BUG_ON(offset >= folio_size(folio)) in folio_set_bh.
- **Symptom:** Kernel BUG() during ISO9660 mount.
- **Root cause (author):** Ignored sb_set_blocksize() failure leaves inconsistent block geometry; buffer-head setup then triggers the folio assertion.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Although the subject says “handle failures,” this is a real crash fix on the mount path, not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record:
- **Files:** fs/isofs/inode.c (+2 / -1 lines)
- **Function:** isofs_fill_super()
- **Scope:** Single-file, surgical mount-path fix
**Step 2.2 — Code flow change**
Record:
- **Before:** sb_set_blocksize(s, orig_zonesize); — return value ignored; mount continues.
- **After:** if (!sb_set_blocksize(s, orig_zonesize)) goto out_freesbi; — mount aborts and frees sbi.
- **Path affected:** Normal mount success path in isofs_fill_super(), after volume-descriptor parsing and before root inode read (isofs_iget() → sb_bread()).
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Logic / correctness fix preventing kernel BUG().
- **Mechanism:** sb_set_blocksize() returns 0 on failure:
```220:229:block/bdev.c
int sb_set_blocksize(struct super_block *sb, int size)
{
if (!(sb->s_type->fs_flags & FS_LBS) && size > PAGE_SIZE)
return 0;
if (set_blocksize(sb->s_bdev_file, size))
return 0;
/* If we get here, we know size is validated */
sb->s_blocksize = size;
sb->s_blocksize_bits = blksize_bits(size);
return sb->s_blocksize;
}
``` ISOFS does not set FS_LBS. orig_zonesize can be 2048 (standard
ISO9660 block size). On systems with PAGE_SIZE < 2048 (e.g. 1024-byte pages), sb_set_blocksize(s, 2048) returns 0. Mount then proceeds with wrong sb->s_blocksize, and buffer-head I/O triggers:
```1578:1582:fs/buffer.c
void folio_set_bh(struct buffer_head *bh, struct folio *folio,
unsigned long offset)
{
bh->b_folio = folio;
BUG_ON(offset >= folio_size(folio));
```**Step 2.4 — Fix quality**
Record: Obviously correct; matches pattern used by ext4, minix, udf, romfs, and nine other filesystems in the same series. Minimal regression risk — only changes behavior when sb_set_blocksize() already fails.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 — Blame**
Record: The unchecked sb_set_blocksize() call dates to the original import (1da177e4c3f4, 2005). The latent bug was exposed when PAGE_SIZE validation was restored to sb_set_blocksize() in a64e5a596067b (merged in v6.15).
**Step 3.2 — Fixes: tag**
Record: Not applicable — no Fixes: tag in commit message.
**Step 3.3 — Related file history**
Record:
- e106e269c5cb3 — “isofs: check the return value of sb_min_blocksize()” — **already in this tree**; handles earlier failure in the same function.
- This commit is the complementary fix for the second sb_set_blocksize() call later in isofs_fill_super().
- Part of a 10-patch series (bfs, hpfs, qnx4, jfs, befs, affs, isofs, minix, ntfs3, omfs).
**Step 3.4 — Author context**
Record: Christoph Hellwig is a core VFS/block developer. Christian Brauner committed the series. Jan Kara (isofs maintainer) reviewed on- list.
**Step 3.5 — Dependencies**
Record: **Standalone.** No prerequisite commits required beyond existing sb_set_blocksize() API and out_freesbi label (both present in this tree). Patch applies cleanly (git apply --check succeeded).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 — Original discussion**
Record:
- b4 dig -c 25ef4c4d9f0e9:
https://patch.msgid.link/[email protected]
- Series: v1, patch 07/10 of 10
- Jan Kara reply: Reviewed-by: Jan Kara <[email protected]>
- No NAKs found in retrieved thread
**Step 4.2 — Reviewers**
Record: CC'd to Alexander Viro, Christian Brauner, Jan Kara, David Sterba, [email protected], and filesystem-specific lists.
**Step 4.3 — Bug report**
Record: No external bug report or syzbot link. Failure mode described analytically by author.
**Step 4.4 — Series context**
Record: Broader series addresses legacy filesystems using buffer heads on systems where sb_set_blocksize() can now fail due to restored PAGE_SIZE validation (a64e5a596067b, in v6.15+). Each filesystem patch is independent.
**Step 4.5 — Stable list discussion**
Record: No stable-list nomination found for this specific isofs patch. (Absence is not a negative signal per instructions.)
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Key functions**
Record: isofs_fill_super(), sb_set_blocksize(), isofs_iget() → isofs_read_inode() → sb_bread() → __bread_gfp() → folio_set_bh()
**Step 5.2 — Callers**
Record: isofs_fill_super() called from FS mount path (mount/fsopen syscall chain with CAP_SYS_ADMIN). Affects all ISO9660 mount attempts where sb_set_blocksize() fails.
**Step 5.3 — Callees**
Record: On failure path, goto out_freesbi → kfree(sbi) → return error (-EINVAL).
**Step 5.4 — Reachability**
Record: Triggered by mounting an ISO9660 image with logical block size 2048 on a kernel where PAGE_SIZE < 2048, or other set_blocksize() failure. Requires mount privileges; not unprivileged, but still a real admin-triggered kernel crash.
**Step 5.5 — Similar patterns**
Record: Nine sibling filesystems in the same series received identical fixes. e106e269c5cb3 already fixed the earlier sb_min_blocksize() call in this same function.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Current tree at line 821:
```821:821:fs/isofs/inode.c
sb_set_blocksize(s, orig_zonesize);
``` Return value is unchecked. PAGE_SIZE validation insb_set_blocksize() is present (a64e5a596067b, in v6.15+). This tree is v6.18.44, so the failure path is live.
**Step 6.2 — Backport complications**
Record: **Clean apply** — verified with git apply --check. No conflicts expected.
**Step 6.3 — Related fixes already present?**
Record: e106e269c5cb3 (sb_min_blocksize check) is already in tree. This specific sb_set_blocksize(orig_zonesize) check is **not** present.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1 — Subsystem**
Record: fs/isofs — IMPORTANT (filesystem, CD/ISO mounting). Not core VFS, but mount crashes are serious.
**Step 7.2 — Activity**
Record: isofs is mature/low-churn; recent related fix e106e269c5cb3 (Nov 2025) shows active maintenance of mount error handling.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 — Who is affected**
Record: Users mounting ISO9660 filesystems on architectures with PAGE_SIZE < 2048, or any configuration where sb_set_blocksize(s, orig_zonesize) fails. Config/arch-specific, not universal.
**Step 8.2 — Trigger conditions**
Record: Mount ISO9660 image where orig_zonesize (512/1024/2048 from disc) causes sb_set_blocksize() to return 0. Most common case:
2048-byte ISO on 1 KiB page kernel. Requires mount capability.
**Step 8.3 — Failure severity**
Record: **CRITICAL** — kernel BUG() in folio_set_bh, not a graceful -EIO return.
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** Prevents kernel crash; converts to clean mount failure. Complements existing sb_min_blocksize() fix already in tree.
- **Risk:** Very low — 2-line change, only affects already-failing path.
- **Ratio:** Strong benefit, minimal risk.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 — Evidence summary**
| FOR backport | AGAINST backport | |---|---| | Real kernel BUG on mount path | Narrow trigger (small-page or specific failure configs) | | Small, surgical, obviously correct | Requires mount privileges | | Matches established pattern in 9 sibling FS fixes | No syzbot/user bug report | | Complements fix already in 6.18 tree | | | PAGE_SIZE validation (v6.15+) makes failure path reachable | | | isofs maintainer reviewed | | | Applies cleanly to 6.18.44 | |
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — pattern used across multiple FS; maintainer reviewed.
2. Fixes a real bug? **PASS** — ignored failure leads to BUG_ON.
3. Important issue? **PASS** — kernel crash (CRITICAL severity).
4. Small and contained? **PASS** — 2 lines, one file.
5. No new features/APIs? **PASS** — error handling only.
6. Can apply to local tree? **PASS** — verified clean apply.
**Step 9.3 — Exception categories**
Record: Not applicable (not device ID, quirk, DT, build, or docs fix).
**Step 9.4 — Decision rationale**
This commit closes a gap left by the v6.15 restoration of PAGE_SIZE validation in sb_set_blocksize(). The 6.18 tree already has that validation and the related sb_min_blocksize() fix, but still ignores the second sb_set_blocksize(orig_zonesize) call. When that call fails, mount continues into buffer-head I/O and hits a kernel BUG(). The fix is minimal, well-reviewed, and directly prevents a crash. The trigger is narrower than a generic networking or memory bug, but kernel BUG() on mount is exactly the kind of issue stable trees accept.
---
## Verification
- [Phase 1] git describe HEAD → v6.18.44; parsed commit message and tags from user query and git show 25ef4c4d9f0e9
- [Phase 2] Read diff; confirmed 2-line change in isofs_fill_super()
- [Phase 2] Read sb_set_blocksize() at block/bdev.c:220-229 — returns 0 when size > PAGE_SIZE for non-LBS filesystems
- [Phase 2] Read folio_set_bh() at fs/buffer.c:1578-1582 — BUG_ON(offset >= folio_size(folio))
- [Phase 3] git blame -L 815,825 fs/isofs/inode.c — unchecked call since 2005
- [Phase 3] git log -1 -S 'size > PAGE_SIZE' -- block/bdev.c → a64e5a596067b (v6.15)
- [Phase 3] git merge-base --is-ancestor a64e5a596067b HEAD → PAGE_SIZE check present in tree
- [Phase 3] git show e106e269c5cb3 — related sb_min_blocksize fix already in tree
- [Phase 3] git log master --oneline --grep='handle set_blocksize failures' — 10-FS series confirmed
- [Phase 4] b4 dig -c 25ef4c4d9f0e9 -a → patch 07/10, lore URL found
- [Phase 4] b4 dig -c 25ef4c4d9f0e9 -w → Viro, Brauner, Jan Kara CC'd
- [Phase 4] Mbox review → Jan Kara Reviewed-by
- [Phase 5] Traced mount path: isofs_fill_super → isofs_iget → sb_bread in fs/isofs/inode.c
- [Phase 6] Confirmed buggy line at fs/isofs/inode.c:821 in HEAD
- [Phase 6] git apply --check on patch from 25ef4c4d9f0e9 → applies cleanly
- [Phase 6] git log HEAD..master --oneline -- fs/isofs/inode.c → fix not yet in tree
- [Phase 6] Verified orig_zonesize values 512/1024/2048 at fs/isofs/inode.c:734-753
- [Phase 6] Verified hardware sector > 2048 rejected at fs/isofs/inode.c:606-610
**YES**The analysis is done: **backport this commit to the 6.18.44 tree.**
isofs_fill_super() still ignores the return value of sb_set_blocksize(s, orig_zonesize). When that call fails (for example, mounting a 2048-byte ISO on a kernel with PAGE_SIZE < 2048), mount continues and can hit BUG_ON(offset >= folio_size(folio)) in folio_set_bh on the first buffer read.
The fix is two lines, applies cleanly, and matches the pattern already used for the earlier sb_min_blocksize() check in this tree (e106e269c5cb3). The commit is on master (25ef4c4d9f0e9) but not yet in v6.18.44.
**YES**
fs/isofs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/isofs/inode.c +2 -1
@@ -818,7 +818,8 @@ static int isofs_fill_super(struct super_block *s, struct fs_context *fc)* entries. By forcing the blocksize in this way, we ensure * that we will never be required to do this. */ -sb_set_blocksize (s, orig_zonesize); +if (!sb_set_blocksize (s, orig_zonesize)) + goto out_freesbi; sbi->s_nls_iocharset =NULL ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 iio: adc: rtq6056: add i2c_device_id support
In reply to Sasha LevinFrom: Kevin Tung <[email protected]>
[ Upstream commit ce80292ead5bb42b50a6b63e44fd95c0edf9d334 ]
Add i2c_device_id table to support legacy I2C instantiation. Update probe to use i2c_get_match_data() so device data can be retrieved consistently for both OF and legacy I2C instantiation.
---
LLM Generated explanations, may be completely bogus:
The background branch search finished (~79s). It didn’t turn up anything useful for this commit: git log -S "rtq6056_probe" --remotes returned unrelated picks from large linux-next merges, and the master search only hit an unrelated merge touching that file.
That doesn’t change the earlier conclusion for **6.18.43**: the regression is present in the current tree, the fix is small and well- reviewed, and the backport recommendation remains **YES**.
drivers/iio/adc/rtq6056.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/iio/adc/rtq6056.c +9 -1
@@ -728,7 +728,7 @@ static int rtq6056_probe(struct i2c_client *i2c)if (!i2c_check_functionality (i2c->adapter,I2C_FUNC_SMBUS_WORD_DATA ))return -EOPNOTSUPP ; - devdata =device_get_match_data (dev); + devdata =i2c_get_match_data (i2c);if (!devdata)return dev_err_probe (dev, -EINVAL ,"Invalid dev data\n" );
@@ -871,6 +871,13 @@ static const struct richtek_dev_data rtq6059_devdata = { .set_average = rtq6059_adc_set_average, }; +static const struct i2c_device_id rtq6056_id[] = { + {"rtq6056" , (kernel_ulong_t)&rtq6056_devdata }, + {"rtq6059" , (kernel_ulong_t)&rtq6059_devdata }, + { } +}; +MODULE_DEVICE_TABLE (i2c, rtq6056_id); +static const struct of_device_id rtq6056_device_match[] = { { .compatible ="richtek,rtq6056" , .data = &rtq6056_devdata }, { .compatible ="richtek,rtq6059" , .data = &rtq6059_devdata },
@@ -885,6 +892,7 @@ static struct i2c_driver rtq6056_driver = { .pm = pm_ptr(&rtq6056_pm_ops), }, .probe = rtq6056_probe, + .id_table = rtq6056_id, };module_i2c_driver (rtq6056_driver);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 Bluetooth: btusb: MT7925: Add VID/PID 13d3/3609
In reply to Sasha LevinFrom: "luke-yj.chen" <[email protected]>
[ Upstream commit a55ef87b61b26097373fe8cbd2ead36582a8df4f ]
Add VID 13d3 & PID 3609 for MediaTek MT7925 USB Bluetooth chip.
The information in /sys/kernel/debug/usb/devices about the Bluetooth device is listed as the below.
T: Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3609 Rev= 1.00 S: Manufacturer=MediaTek Inc. S: Product=Wireless_Device S: SerialNumber=000000000 C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA A: FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms I: If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us I:* If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us E: Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
---
LLM Generated explanations, may be completely bogus:
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 2)...
Retry attempt 2...
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 3)...
Retry attempt 3...
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [Bluetooth: btusb: MT7925] [add] Add VID/PID 13d3/3609 for MediaTek MT7925 USB Bluetooth chip
**Step 1.2 — Tags**
Record:
- Signed-off-by: luke-yj.chen <[email protected]> (author, MediaTek)
- Signed-off-by: Luiz Augusto von Dentz <[email protected]> (Bluetooth maintainer committer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, Cc: [email protected], or Link: tags
**Step 1.3 — Body**
Record: Adds USB VID 0x13d3 / PID 0x3609 for a MediaTek MT7925 combo Bluetooth interface. Includes /sys/kernel/debug/usb/devices output showing a standard 3-interface wireless controller (Manufacturer=MediaTek Inc., Product=Wireless_Device, Driver=btusb on HCI interfaces). Symptom without the ID: device may bind generically but lacks MediaTek-specific quirk flags, so Bluetooth does not work correctly on this hardware variant.
**Step 1.4 — Hidden bug fix?**
Record: Not disguised as cleanup — it is an explicit hardware-enablement ID addition. Functionally it fixes non-working Bluetooth on laptops/modules using this USB ID.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- Files: drivers/bluetooth/btusb.c (+2 lines)
- Function/table: quirks_table[]
- Scope: single-file, surgical, 2-line addition
**Step 2.2 — Code flow**
Record:
- **Before:** 0x13d3:0x3609 not in quirks_table[]; probe falls through generic btusb_table match without BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH.
- **After:** Device gets BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH via quirks_table lookup during btusb_probe().
- Affected path: USB device enumeration / driver probe for this hardware.
**Step 2.3 — Bug mechanism**
Record: **Hardware quirk / device ID** — missing USB ID entry. Without it, btusb_probe() at lines 4018–4024 does not upgrade the match from generic Bluetooth to MediaTek-specific handling, so BTUSB_MEDIATEK setup (btmtk paths, firmware, WBS) is never applied.
**Step 2.4 — Fix quality**
Record: Obviously correct — identical pattern to neighboring entries (0x3608, 0x3613, etc.). Minimal risk; no API/locking changes.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Insertion point is between commits adding 0x3608 (cb45396f96f96, Sep 2024) and 0x3613 (bbf56029322c0, May 2025). Gap at 0x3609 is an omission, not a post-branch regression.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related changes**
Record: Multiple sibling MT7925 ID commits already in stable/linux-6.18.y: bbf56029322c0 (13d3/3613), 576952cf981b7 (13d3/3627), 5bd5c716f7ec3 (13d3/3630), f63f401130e5c (13d3/3628), etc. Standalone 1/1 patch.
**Step 3.4 — Author context**
Record: Author is MediaTek ([email protected]). Committed by Bluetooth maintainer Luiz Augusto von Dentz. Same pattern as other MediaTek ID submissions.
**Step 3.5 — Dependencies**
Record: None. Requires only existing BTUSB_MEDIATEK, BTUSB_WIDEBAND_SPEECH, and btmtk support — all present in this tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- Commit: a55ef87b61b26097373fe8cbd2ead36582a8df4f
- b4 dig -c a55ef87b61b26:
https://patch.msgid.link/20260512060318.3288273-1-luke-
[email protected]
- b4 dig -a: v1 (2026-05-12) and v2 (2026-05-12); committed version matches v2
- No stable nomination or NAK found in thread mbox
**Step 4.2 — Reviewers**
Record: b4 dig -w CC'd Marcel Holtmann, Johan Hedberg, Luiz Von Dentz, Sean Wang, linux-bluetooth, linux-mediatek.
**Step 4.3 — Bug report**
Record: N/A — hardware ID submission with USB descriptor evidence; no syzbot/bugzilla.
**Step 4.4 — Series context**
Record: Standalone single-patch series (v1→v2).
**Step 4.5 — Stable list**
Record: Lore fetch blocked by bot protection for manual stable-list search; no stable discussion found in downloaded mbox.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: quirks_table[] (data), consumed in btusb_probe().
**Step 5.2 — Callers**
Record: btusb_probe() called from USB core on device plug/enumeration — standard hotplug path.
**Step 5.3 — Callees / effects**
Record: When BTUSB_MEDIATEK is set, probe configures btusb_mtk_setup, btmtk send/recv, suspend/resume, and firmware loading. When BTUSB_WIDEBAND_SPEECH is set, HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED is enabled (line 4314).
**Step 5.4 — Reachability**
Record: Triggered by plugging in or booting with hardware using 13d3:3609. Common laptop WiFi+BT combo path.
**Step 5.5 — Similar patterns**
Record: ~15+ other 13d3:36xx MT7925 entries in the same table section; this fills a gap between 0x3608 and 0x3613.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code exists?**
Record:
- Local tree: **linux-6.18.y**, 6.18.44 (v6.18.44-1-g2736c32da98b9)
- 0x13d3:0x3609 **absent** — confirmed gap at lines 754–756 between 0x3608 and 0x3613
- Commit a55ef87b61b26 **not** an ancestor of HEAD (git merge-base --is-ancestor exit 1)
- MT7925 infrastructure present: btmtk.c handles 0x7925, FIRMWARE_MT7925 defined, CONFIG_BT_HCIBTUSB_MTK in Kconfig
**Step 6.2 — Backport complications**
Record: git apply --check succeeds cleanly on current btusb.c.
Expected: trivial apply.
**Step 6.3 — Related fixes already present?**
Record: Sibling MT7925 IDs already in stable; 0x3609 specifically is missing.
---
## Phase 7: Subsystem Context
**Step 7.1 — Subsystem**
Record: drivers/bluetooth/btusb.c — Bluetooth USB HCI driver.
Criticality: **IMPORTANT** (peripheral driver, but affects real laptop hardware).
**Step 7.2 — Activity**
Record: Active — multiple MT7925 ID additions through 2025–2026 already landed in this stable series.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users with MediaTek MT7925 USB Bluetooth at 13d3:3609 (likely recent laptops with IMC/ASUS-style combo modules).
**Step 8.2 — Trigger**
Record: Device enumeration at boot or hotplug. Unprivileged user cannot directly trigger, but any system with this hardware hits it automatically.
**Step 8.3 — Failure mode**
Record: Bluetooth non-functional or severely broken (wrong driver path, no mtk setup/firmware, no WBS). Severity: **MEDIUM** for affected users (complete feature loss, not kernel crash).
**Step 8.4 — Risk vs benefit**
Record:
- Benefit: **HIGH** for affected hardware (restores Bluetooth)
- Risk: **VERY LOW** (2-line ID table entry, identical to proven siblings)
- Ratio: strongly favors backport
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Classic stable exception: new USB device ID for existing driver
- MT7925/btusb/btmtk support already in 6.18.y
- Sibling IDs (3613, 3627, 3628, 3630) already backported to this tree
- Patch applies cleanly
- Committed by Bluetooth maintainer
- Real hardware with documented USB descriptors
**Evidence AGAINST:**
- None significant; not a new driver, API, or refactor
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — pattern matches ~15 existing entries; maintainer committed
2. Fixes real bug affecting users? **PASS** — Bluetooth broken without ID
3. Important issue? **PASS** — complete Bluetooth failure on affected hardware (MEDIUM severity)
4. Small and contained? **PASS** — 2 lines, 1 file
5. No new features/APIs? **PASS** — device ID only
6. Can apply to local tree? **PASS** — verified with git apply --check
**Exception category:** NEW DEVICE ID (USB VID/PID for existing btusb
+ btmtk MT7925 support)
---
## Verification
- [Phase 1] Parsed tags: only Signed-off-by from author and Luiz von Dentz
- [Phase 2] Diff: +2 lines in quirks_table[] between 0x3608 and 0x3613
- [Phase 3] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 3] git blame lines 748–756: gap at 3609 between cb45396 and bbf56029
- [Phase 3] Sibling commits in stable: bbf56029, 576952cf, 5bd5c716, f63f4011
- [Phase 3] Commit hash: a55ef87b61b26097373fe8cbd2ead36582a8df4f; not in HEAD
- [Phase 4] b4 dig -c a55ef87b61b26: lore URL found
- [Phase 4] b4 dig -a: v1 and v2 revisions
- [Phase 4] b4 dig -w: Marcel Holtmann, Luiz von Dentz CC'd
- [Phase 4] Mbox: no stable nomination, no NAKs
- [Phase 5] btusb_probe() quirks lookup at lines 4018–4024 verified
- [Phase 5] BTUSB_MEDIATEK handling at lines 4113–4116, 4214–4228 verified
- [Phase 5] BTUSB_WIDEBAND_SPEECH at line 4314 verified
- [Phase 6] grep 0x3609 in btusb.c: no match (missing)
- [Phase 6] git apply --check: patch applies cleanly
- [Phase 6] btmtk.c MT7925 support and FIRMWARE_MT7925 confirmed
- [Phase 6] CONFIG_BT_HCIBTUSB_MTK in Kconfig confirmed
- [Phase 8] Failure mode: Bluetooth non-functional without quirk flags
This is a textbook stable backport: a missing USB ID for hardware whose driver stack already exists in linux-6.18.y, matching numerous sibling MT7925 ID commits already present in this tree.
**YES**The background searches finished and matched what the full analysis used:
- **btusb history:** Recent changes are mostly MT7925 VID/PID additions and unrelated fixes; 13d3/3609 was not in the stable tree.
- **Author/subject search:** Found nearby MT7925 IDs (3604, 3608) but not 3609 on the checked-out 6.18.44 branch.
- **Branch search:** Located the commit as a55ef87b61b26 on all- next/master/net-next, not in current stable HEAD.
**Verdict remains YES** — it’s a 2-line USB ID addition for existing MT7925/btusb support, applies cleanly, and fills a gap between 0x3608 and 0x3613 already present in linux-6.18.y.
drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -758,6 +758,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3608), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3609), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3613), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3627), .driver_info = BTUSB_MEDIATEK |
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: mac80211: validate deauth frame length before reason access
In reply to Sasha LevinFrom: Zhao Li <[email protected]>
[ Upstream commit 4a360c6e18dfa9d70006c7247a6a8cc8dfe0d60f ]
ieee80211_rx_mgmt_deauth() reads the deauth reason code before checking that the fixed field is actually present in the received frame.
Validate the deauth frame length first and only then read the reason code.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [wifi: mac80211] [validate] validate deauth frame length before reason access — subsystem is mac80211; verb is “validate,” indicating a safety/bug fix.
**Step 1.2 — Tags**
Record:
- Assisted-by: Codex:gpt-5.5
- Assisted-by: Claude:claude-opus-4.8
- Signed-off-by: Zhao Li <[email protected]> (author)
- `Link: https://patch.msgid.link/20260612185042.66260-6-
[email protected]`
- Signed-off-by: Johannes Berg <[email protected]> (mac80211 maintainer)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or Reviewed-by: tags
**Step 1.3 — Body analysis**
Record:
- **Bug:** ieee80211_rx_mgmt_deauth() reads mgmt->u.deauth.reason_code before confirming the frame is long enough.
- **Symptom:** Out-of-bounds read when a deauth frame is shorter than the fixed header + reason field (26 bytes).
- **Root cause:** Length check happens after the reason-code dereference.
- **Version info:** None in the commit message.
**Step 1.4 — Hidden bug fix?**
Record: Yes. Although framed as validation, this is a real memory-safety
bug: reading fixed fields before bounds-checking.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** net/mac80211/mlme.c (+4 / -2 lines)
- **Function:** ieee80211_rx_mgmt_deauth()
- **Scope:** Single-file, surgical fix
**Step 2.2 — Code flow change**
Record:
- **Before:** reason_code = le16_to_cpu(mgmt->u.deauth.reason_code) at function entry; then if (len < 24 + 2) return;
- **After:** Declare reason_code uninitialized; length check first using offsetofend(struct ieee80211_mgmt, u.deauth.reason_code); only then read reason_code
- **Path affected:** RX handling of DEAUTH management frames on station interfaces
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Buffer out-of-bounds / memory safety
- **Mechanism:** With len == 24 (valid 802.11 management header only), the old code reads 2 bytes at offset 24–25 before rejecting the frame. rx.c only requires skb->len >= 24 for management frames, so 24-byte deauth frames can reach this handler.
**Step 2.4 — Fix quality**
Record:
- Fix is obviously correct and mirrors ieee80211_rx_mgmt_disassoc() in the same file (which already reads reason_code after the length check).
- offsetofend(...) is equivalent to 24 + 2 for deauth but more maintainable.
- Regression risk is very low: only changes ordering for frames that would have been dropped anyway.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Lines in ieee80211_rx_mgmt_deauth() trace to 5d324e5159d9e (6.18 merge baseline, Nov 2025). The read-before-check pattern is present in this tree; the function predates the 6.18 mlme.c split.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related file history**
Record: Part of v2 series “validate rx/tx MLME callback frame lengths” (patches 1/3 cfg80211, 2/3 cfg80211 assoc, 3/3 mac80211 deauth). Patch 3/3 is standalone for mac80211’s direct RX path.
**Step 3.4 — Author context**
Record: Zhao Li has other mac80211 validation fixes in recent history (validate individual TWT params, etc.). Johannes Berg (maintainer) signed off.
**Step 3.5 — Dependencies**
Record: No dependencies. Patch 3/3 does not require patches 1/2; it fixes mac80211’s internal path, not cfg80211_rx_mlme_mgmt().
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Patch discussion**
Record: b4 dig did not return a match for this commit hash (not yet in tree). Local mbox v2_20260707_enderaoelyther_wifi_cfg80211_validate_rx_ tx_mlme_callback_frame_lengths_before_access.mbx contains the full v2 series; patch 3/3 matches the analyzed commit. v2 notes per Johannes’ review for patch 1; patch 3/3 had no code changes in v2.
**Step 4.2 — Reviewers**
Record: Johannes Berg signed off. No explicit Reviewed-by: in the mbox for patch 3/3.
**Step 4.3 — Bug report**
Record: No syzbot or user bug report. Patch 1 documents a concrete in- tree trigger via mwifiex → cfg80211; patch 3/3 addresses the parallel mac80211 RX path reachable from over-the-air frames.
**Step 4.4 — Series context**
Record: 3-patch series; this commit is independently valuable for station-mode mac80211 RX.
**Step 4.5 — Stable list**
Record: No stable-list discussion found.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: ieee80211_rx_mgmt_deauth() (modified)
**Step 5.2 — Callers**
Record:
- ieee80211_sta_rx_queued_mgmt() → case IEEE80211_STYPE_DEAUTH
- Called from iface.c for NL80211_IFTYPE_STATION
- Common WiFi station path for all mac80211 clients
**Step 5.3 — Callees**
Record: ieee80211_tdls_handle_disconnect(), ieee80211_set_disassoc(), ieee80211_report_disconnect(), cfg80211_rx_mlme_mgmt(), ieee80211_destroy_assoc_data()
**Step 5.4 — Reachability**
Record:
- rx.c accepts management frames with skb->len >= 24 only
- Malicious AP or in-range attacker can send a 24-byte DEAUTH frame
- **Reachable from wireless attack surface** on every mac80211 station interface
**Step 5.5 — Similar patterns**
Record:
- ieee80211_rx_mgmt_disassoc() in same file: correct (check then read)
- ieee80211_rx_mgmt_deauth_ibss() in ibss.c: **same bug** (read before check) — not fixed by this commit
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is **Linux 6.18.44**
(v6.18.44-1-g2736c32da98b9). Buggy code at:
```5007:5016:net/mac80211/mlme.c
static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data
*sdata,
struct ieee80211_mgmt *mgmt, size_t
len)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (len < 24 + 2)
return;
```**Step 6.2 — Backport complications**
Record: Clean apply expected — small, localized hunk; no structural conflicts observed.
**Step 6.3 — Fix already present?**
Record: **No.** git log --grep found no matching commit; fix is not in this tree.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem criticality**
Record: net/mac80211 — **IMPORTANT/CORE** for WiFi; affects all mac80211 station users.
**Step 7.2 — Activity**
Record: Active subsystem with recent bounds-check and memory-safety fixes (bounds-check link_id, double-free fixes, etc.).
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: All systems using mac80211 in station mode (CONFIG_MAC80211), i.e. the vast majority of Linux WiFi clients.
**Step 8.2 — Trigger conditions**
Record: Receiving a DEAUTH management frame with len == 24 (header only). Triggerable by malicious/over-the-air sources. Not timing- dependent.
**Step 8.3 — Failure mode severity**
Record: **Out-of-bounds read** of 2 bytes past frame end — **HIGH** severity (KASAN-detectable, potential info leak, wireless attack surface). Unlikely to panic on all builds, but is a real kernel memory- safety issue.
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** HIGH — closes OOB read on common WiFi RX path
- **Risk:** VERY LOW — 4-line reordering, matches existing disassoc pattern
- **Ratio:** Strongly favors backport
---
## Phase 9: Final Synthesis
**Evidence FOR backport:**
- Real, verifiable OOB read bug
- Reachable from over-the-air WiFi frames (rx.c allows 24-byte mgmt frames)
- Small, surgical, maintainer-signed fix
- Matches correct pattern already used in ieee80211_rx_mgmt_disassoc()
- Bug present in local 6.18.44 tree
- Standalone — no series dependencies
**Evidence AGAINST backport:**
- No syzbot/user crash report (bug may be subtle on non-KASAN builds)
- Does not fix the same bug in ibss.c (separate, out-of-scope issue)
- Patch 1/3 (cfg80211) fixes a related but distinct path — not required for this fix
**Unresolved questions:**
- No runtime crash report verified
- Lore thread fetch blocked (Anubis); relied on local mbox instead
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — mirrors disassoc; maintainer SOB; no code objections in v2
2. Fixes a real bug? **PASS** — OOB read before length check
3. Important issue? **PASS** — memory safety on wireless attack surface (HIGH)
4. Small and contained? **PASS** — 6 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — buggy code confirmed present; clean apply expected
**Exception category:** N/A (not device ID, quirk, DT, build, or docs)
---
## What Problem This Solves
ieee80211_rx_mgmt_deauth() can process deauth frames as short as 24 bytes because mac80211’s RX path only enforces a 24-byte minimum for management frames. The function reads the 2-byte reason code at offset 24 before checking frame length, causing an out-of-bounds read. A nearby malicious AP or attacker can trigger this on any Linux WiFi client using mac80211 station mode.
The fix validates length first (using offsetofend), then reads the reason code — the same pattern already used in ieee80211_rx_mgmt_disassoc() in the same file.
---
## Verification
- [Phase 1] Parsed commit message and tags from user query and local mbox
- [Phase 2] Read current ieee80211_rx_mgmt_deauth() and ieee80211_rx_mgmt_disassoc() in net/mac80211/mlme.c
- [Phase 2] Confirmed IEEE80211_DEAUTH_FRAME_LEN = 24 + 2 in ieee80211_i.h
- [Phase 3] git blame -L 5007,5016 net/mac80211/mlme.c: buggy pattern in 6.18 baseline
- [Phase 3] git log --grep: no existing fix in tree
- [Phase 4] Read local mbox v2 series; patch 3/3 matches analyzed commit
- [Phase 4] b4 dig: no match (commit not in tree); lore URL blocked by bot protection
- [Phase 5] Traced call chain: iface.c → ieee80211_sta_rx_queued_mgmt() → ieee80211_rx_mgmt_deauth()
- [Phase 5] Read rx.c:3422: mgmt frames only require len >= 24
- [Phase 6] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 6] Confirmed buggy code present; fix not applied
- [Phase 8] Verified failure mode: OOB read at offset 24 when len == 24
- [UNVERIFIED] Whether non-KASAN builds can be exploited beyond info leak
**YES**
net/mac80211/mlme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +4 -2
@@ -5008,13 +5008,15 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len) {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; -u16 reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +u16 reason_code;lockdep_assert_wiphy (sdata->local->hw.wiphy); -if (len <24 +2 ) + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code))return ; + reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +if (!ether_addr_equal (mgmt->bssid, mgmt->sa)) {ieee80211_tdls_handle_disconnect (sdata, mgmt->sa, reason_code);return ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 cxl/region: Validate partition index before array access
In reply to Sasha LevinFrom: Koba Ko <[email protected]>
[ Upstream commit 16329b510f76e5b824e05bf8add8b29850f1f16f ]
construct_region() reads cxled->part and uses it to index cxlds->part[] without checking for a negative value. If the partition was never resolved, part remains at its initial value of -1, causing an out-of-bounds array access.
Add a guard to return -EBUSY when part is negative.
The check was dropped during a merge.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [cxl/region] [validate] [partition index before array access in construct_region()]
### Step 1.2: Tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** Alison Schofield <[email protected]> (CXL maintainer/contributor)
- **Acked-by:** — none
- **Link:**
https://patch.msgid.link/[email protected]
- **Cc: [email protected]:** — absent (not a negative signal)
- **Signed-off-by:** Koba Ko <[email protected]>, Dave Jiang <[email protected]> (ignore pipeline-added SOBs)
Notable: maintainer Reviewed-by, no syzbot/user reports.
### Step 1.3: Body Analysis
**Record:**
- **Bug:** construct_region() reads cxled->part and indexes cxlds->part[part] without validating part is non-negative. Unresolved partition leaves part == -1 (initial value).
- **Symptom:** Out-of-bounds array access on cxlds->part[-1].
- **Root cause:** Guard if (part < 0) return ERR_PTR(-EBUSY) was accidentally dropped during a merge.
- **Version info:** None explicit in message.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not disguised — explicit OOB/array-bounds bug fix, though described as restoring a lost merge guard.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- **Files:** drivers/cxl/core/region.c (+3 lines)
- **Function:** construct_region()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code Flow Change
**Record:**
- **Before:** part = READ_ONCE(cxled->part) then immediately cxlds->part[part].mode — with part == -1, indexes before part[0].
- **After:** Early if (part < 0) return ERR_PTR(-EBUSY) before array access.
- **Path:** Region autodiscovery during endpoint port probe (cxl_add_to_region() → construct_region()).
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Buffer overflow / out-of-bounds access (negative array index).
- **Mechanism:** cxled->part initialized to -1 in drivers/cxl/core/port.c; if DPA does not map to any partition, hdm.c warns but continues with part == -1. construct_region() then reads cxlds->part[-1].mode from a 2-element array (CXL_NR_PARTITIONS_MAX).
### Step 2.4: Fix Quality
**Record:**
- Obviously correct — restores guard from be5cbd0840275.
- Minimal (3 lines).
- Low regression risk: matches existing pattern in cxl_region_attach(); -EBUSY propagates through opportunistic discover_region() which already tolerates failures via dev_dbg().
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:**
- construct_region() introduced in 5ec67596e368cd (2025-02-21, "Drop goto pattern of construct_region()").
- Partition indexing cxlds->part[part].mode added in be5cbd0840275 (2025-02-03, "Kill enum cxl_decoder_mode") **with** the part < 0 guard.
- Guard lost in merge b6faa9c613787b (2025-03-14, merge of for-6.15/guard_cleanups into cxl-for-next2).
- Bug present since that merge; confirmed in this tree at v6.18.44.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag. Root regression is merge b6faa9c613787b dropping guard from be5cbd0840275. Both are ancestors of v6.18.44.
### Step 3.3: Related File History
**Record:**
- Recent region.c changes in 6.18: poison injection, SPA/DPA translation, lock refactors — unrelated to this guard.
- Standalone fix; not part of a multi-patch series.
### Step 3.4: Author Context
**Record:** Koba Ko has limited CXL history in this tree (2 unrelated commits). Reviewer Alison Schofield is an active CXL contributor (region, port, trace fixes).
### Step 3.5: Dependencies
**Record:** No prerequisites. Fix is self-contained. Note: upstream diff shows struct cxl_region_context *ctx signature; this tree uses struct cxl_endpoint_decoder *cxled directly — trivial adaptation, same guard placement.
---
## Phase 4: Mailing List and External Research
### Step 4.1–4.5
**Record:**
- **b4 dig:** Cannot run -c <commit> — commit not present in this checkout.
- **Lore/patch.msgid.link:** Blocked by Anubis bot protection; could not read thread.
- **UNVERIFIED:** Reviewer stable nomination, NAKs, series revisions.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** construct_region(), called from cxl_add_to_region().
### Step 5.2: Callers
**Record:**
- cxl_add_to_region() ← discover_region() in drivers/cxl/port.c
- discover_region() ← cxl_endpoint_port_probe() via device_for_each_child()
- Runs during CXL endpoint port probe after decoder enumeration
### Step 5.3: Callees
**Record:** __create_region(), __construct_region(), READ_ONCE(cxled->part), cxlds->part[part].mode.
### Step 5.4: Reachability
**Record:**
- Triggered on CXL hardware probe with CONFIG_CXL_REGION=y.
- Reachable when endpoint decoder has HPA range but part unresolved (-1).
- hdm.c explicitly allows this: warns "does not map any partition" and returns success.
- Not a syscall path, but standard driver probe on real hardware.
### Step 5.5: Similar Patterns
**Record:** Existing guards elsewhere in same file:
- cxl_region_attach(): if (cxled->part < 0) return -ENODEV (line 1946)
- Poison context: if (ctx->part < 0) return 0 (line 2758)
The missing guard in construct_region() is inconsistent — attach path is protected, construction path is not.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy Code Exists?
**Record:** **YES.** Local tree is **v6.18.44** (make kernelversion = 6.18.44). construct_region() at lines 3515–3543 lacks part < 0 check and uses cxlds->part[part].mode with part potentially -1.
### Step 6.2: Backport Complications
**Record:** Clean apply expected — 3 lines after part = READ_ONCE(cxled->part). Function signature differs slightly from upstream patch (uses cxled not ctx), but guard is identical.
### Step 6.3: Related Fixes Already Present?
**Record:** cxl_region_attach() already has part < 0 check (from be5cbd0840275). The construct_region() guard specifically is **missing** — this fix is still needed.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem Criticality
**Record:** drivers/cxl/ — CXL memory subsystem. **IMPORTANT** for CXL hardware users; not universal core kernel, but memory-related.
### Step 7.2: Activity
**Record:** Actively developed in 6.18 (poison, region management, lock refactors).
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Users with CXL memory devices and region autodiscovery enabled (CONFIG_CXL_REGION). Systems where endpoint decoder DPA does not map to a partition.
### Step 8.2: Trigger Conditions
**Record:**
- Endpoint decoder enumerated with part == -1 (initial value or post- invalidate)
- Decoder has valid HPA range and CXL_DECODER_STATE_AUTO
- No existing region for that HPA range → construct_region() called
- Moderately plausible on misconfigured or partially mapped CXL devices
### Step 8.3: Failure Mode Severity
**Record:** OOB read of cxlds->part[-1] — **HIGH** severity (kernel oops/KASAN report, possible crash; undefined behavior reading memory before array). Not data corruption in common case, but real crash risk on probe.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Prevents OOB access on CXL probe path; restores intentionally added safety check.
- **Risk:** Very low — 3-line guard, reviewed, matches existing code patterns.
- **Ratio:** Strong benefit, minimal risk.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real OOB bug with concrete trigger path (unresolved partition index)
- Small, surgical, obviously correct fix
- Restores guard accidentally dropped in merge b6faa9c613787b
- Reviewed by CXL maintainer (Alison Schofield)
- Buggy code confirmed present in v6.18.44
- Consistent with existing part < 0 guards in same file
**AGAINST backport:**
- CXL region is hardware/config-specific (not all users)
- No user/syzbot report in commit message
- Mailing list discussion unverified
**UNRESOLVED:**
- Lore thread content and any explicit stable nomination
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — restores known-good guard; maintainer reviewed
2. Fixes real bug affecting users? **PASS** — OOB on CXL probe with unmapped partition
3. Important issue? **PASS** — OOB/crash on driver probe (HIGH)
4. Small and contained? **PASS** — 3 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — buggy code present; trivial adaptation
### Step 9.3: Exception Categories
**Record:** None (standard bug fix, not device ID/quirk/build fix).
### Step 9.4: Decision Rationale
This commit fixes a genuine out-of-bounds array access in construct_region() when an endpoint decoder's partition index remains at its initial value of -1. That state is explicitly allowed by hdm.c (warning only, probe continues). The guard was added in be5cbd0840275 and accidentally dropped during merge b6faa9c613787b; the fix simply restores it. For the locally checked-out **6.18.44** tree, the vulnerable code is present and the patch applies cleanly with at most a trivial signature adaptation.
---
## Verification
- [Phase 1] Parsed commit message: subject, Reviewed-by, Link tag; no Fixes/Reported-by
- [Phase 2] Diff: 3-line guard before cxlds->part[part] access in construct_region()
- [Phase 3] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 3] git blame -L 3515,3530: construct_region() from 5ec67596e368cd, partition indexing from b6faa9c613787b lineage
- [Phase 3] git show be5cbd0840275: added both cxlds->part[part].mode and if (part < 0) return ERR_PTR(-EBUSY)
- [Phase 3] git show b6faa9c613787b:drivers/cxl/core/region.c:
confirmed guard absent after merge
- [Phase 3] git merge-base --is-ancestor b6faa9c613787b v6.18.44:
merge is in this tree
- [Phase 3] git log -S "if (part < 0)": only addition in be5cbd0840275; no later removal commit (lost in merge conflict resolution)
- [Phase 4] b4 dig -c: failed — commit not in checkout
- [Phase 4] WebFetch lore/patch.msgid.link: blocked by Anubis — **UNVERIFIED** mailing list discussion
- [Phase 5] grep cxl_add_to_region: caller chain port.c → region.c confirmed
- [Phase 5] grep cxled->part: init -1 in port.c:2076; set -1 on invalidate region.c:2133; unresolved path hdm.c:405-407
- [Phase 5] CXL_NR_PARTITIONS_MAX = 2 in cxlmem.h — part[-1] is OOB
- [Phase 5] Existing guards at region.c:1946 and 2758 confirmed
- [Phase 6] Current construct_region() at 3515-3543: no part < 0 check — bug present
- [Phase 6] cxl_region_attach() guard present — partial protection only, OOB occurs before attach
- [Phase 8] Failure mode: OOB read on probe — HIGH severity for affected CXL configs
**YES**
drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/cxl/core/region.c +3 -0
@@ -3521,6 +3521,9 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,int rc, part =READ_ONCE (cxled->part);struct cxl_region *cxlr; +if (part <0 ) +return ERR_PTR (-EBUSY ); + do { cxlr = __create_region(cxlrd, cxlds->part[part].mode, atomic_read(&cxlrd->region_id));
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] cxl/region: Validate partition index before array access
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Malformed loop condition in __cxl_dpa_reserve() causes an infinite loop and out-of-bounds read if a resource does not match any partition.
- [High] poison_by_decoder() misses partition index validation, causing an out-of-bounds read if cxled->part is -1.
--
commit 31fe17e0b5eabcb1df81ee069bc89ecabb1a8d36
Author: Koba Ko <[email protected]>
cxl/region: Validate partition index before array access
construct_region() reads cxled->part and uses it to index cxlds->part[] without checking for a negative value. If the partition was never resolved, part remains at its initial value of -1, causing an out-of-bounds array access.
Quoted 5 lines
drivers/cxl/core/region.c +0
-0
drivers/cxl/core/region.c static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd, · line 3529
Quoted 9 lines
drivers/cxl/core/region.c +3
-0@@ -3521,6 +3521,9 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,int rc, part =READ_ONCE (cxled->part);struct cxl_region *cxlr; +if (part <0 ) +return ERR_PTR (-EBUSY ); + do { cxlr = __create_region(cxlrd, cxlds->part[part].mode, atomic_read(&cxlrd->region_id));
[Severity: High]
This is a pre-existing issue, but does poison_by_decoder() in this same file also miss this partition index validation?
If cxled->part is -1, it appears we skip index validation and jump directly to reading cxlds->part[-1].mode:
drivers/cxl/core/region.c:poison_by_decoder() {
...
mode = cxlds->part[cxled->part].mode;
...
}Could this cause a similar out-of-bounds read during CXL endpoint poison iteration?
[Severity: High]
This is a pre-existing issue, but does the loop condition in __cxl_dpa_reserve() evaluate as constantly true?
drivers/cxl/core/hdm.c:__cxl_dpa_reserve() {
...
for (int i = 0; cxlds->nr_partitions; i++)
...
}If a resource does not match any partition, i increments infinitely because cxlds->nr_partitions is evaluated as a constant boolean rather than an index bound. Could this cause an infinite loop and out-of-bounds read on cxlds->part until a page fault halts execution?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 fat: stop reading directory entries past the end-of-directory marker
In reply to Sasha LevinFrom: Matteo Croce <[email protected]>
[ Upstream commit 6a2875517c778ac1111b6920e94cbab91cda8724 ]
The FAT specification[1] (FAT Directory Structure -> "DIR_Name[0]") states:
If DIR_Name[0] == 0x00, then the directory entry is free (same as for 0xE5), and there are no allocated directory entries after this one (all of the DIR_Name[0] bytes in all of the entries after this one are also set to 0).
The special 0 value, rather than the 0xE5 value, indicates to FAT file system driver code that the rest of the entries in this directory do not need to be examined because they are all free.
Linux did not honour this. fat_get_entry() kept advancing past the 0x00 terminator; if the trailing on-disk slots were not zero-filled (buggy formatters, read-only media written by other operating systems, on-disk corruption) the driver surfaced arbitrary bytes as real directory entries. On a typical affected image, ls /mnt returns ~150 bogus entries with random binary names, multi-gigabyte sizes, dates ranging from 1980 to 2106, and a flood of -EIO from stat().
Earlier attempts (v1..v3, see [2][3][4]) added de->name[0] == 0 guards at each call site. As Hirofumi pointed out on v3, those guards reject the entry but fat_get_entry() has already advanced *pos past it; the next readdir() resumes after the marker and walks straight back into the garbage. His suggestion was to centralise the check.
This patch:
* Adds fat_get_entry_eod(), a small wrapper around fat_get_entry() that returns -1 when name[0] == 0 and seeks *pos to dir->i_size. Per spec every slot after the 0x00 marker is also zero, so jumping to the end of the directory is correct: subsequent reads return -1 from fat_bmap() without re-fetching trailing zero slots, and callers persisting *pos across invocations (notably readdir's ctx->pos) keep reporting end-of-directory on re-entry.
* Converts the read/search paths to use the new wrapper:
fat_parse_long(), fat_search_long(), __fat_readdir(), and fat_get_short_entry() -- the last covers fat_get_dotdot_entry(), fat_dir_empty(), fat_subdirs(), fat_scan(), and fat_scan_logstart() transitively.
* Leaves fat_add_entries() and __fat_remove_entries() on raw fat_get_entry(): the write paths legitimately need to operate on free/zero slots. fat_add_entries() additionally detects an allocated entry past a 0x00 marker (the spec violation that produces the garbage) and treats it as filesystem corruption:
fat_fs_error_ratelimit() is called -- which honours the configured errors= mount option (panic / remount-ro / continue) -- and the operation returns -EIO so we don't write fresh entries into an already-corrupt directory.
[1] https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://lore.kernel.org/lkml/[email protected]/
[4] https://lore.kernel.org/lkml/[email protected]/
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: fat: stop reading directory entries past the end-of-directory marker
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
**Record:** [fat] [stop] — FAT filesystem driver; stop directory iteration past the FAT end-of-directory (EOD) marker (DIR_Name[0] == 0x00).
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
**Record:**
| Tag | Value | |-----|-------| | Reported-by | Timothy Redaelli \<[email protected]\> | | Suggested-by | OGAWA Hirofumi \<[email protected]\> (FAT maintainer) | | Signed-off-by | Matteo Croce \<[email protected]\> (author) | | Link | https://patch.msgid.link/[email protected] | | Acked-by | OGAWA Hirofumi \<[email protected]\> | | Signed-off-by | Christian Brauner (Amutable) \<[email protected]\> (VFS maintainer merge) |
**Notable patterns:** Real user report from Red Hat; subsystem maintainer Acked-by and Suggested-by; references to earlier v1–v3 attempts (2018–2019). No syzbot, no Fixes: tag (expected for manual review).
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
**Record:**
- **Bug:** Linux fat_get_entry() does not honor the FAT spec EOD marker. After name[0] == 0, iteration continues into trailing directory slots.
- **Symptom:** On non-spec-compliant images (buggy formatters, other OSes, corruption), ls shows ~150 bogus entries with random binary names, multi-GB sizes, invalid dates; stat() floods -EIO.
- **Root cause:** Per FAT spec, name[0] == 0 means no allocated entries follow; Linux kept scanning. Prior per-call-site guards were insufficient because fat_get_entry() had already advanced *pos past the marker.
- **Fix approach:** Centralize EOD handling in fat_get_entry_eod(); use it on read/search paths; keep write paths on raw fat_get_entry(); detect spec violations on write in fat_add_entries().
### Step 1.4: DETECT HIDDEN BUG FIXES
**Record:** Not disguised — this is an explicit filesystem correctness bug fix, though described in terms of spec compliance rather than "fix crash."
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
**Record:**
- **File:** fs/fat/dir.c only (~65 lines added/changed)
- **Functions modified/added:**
- **Added:** fat_get_entry_eod()
- **Modified call sites:** fat_parse_long(), fat_search_long(),
`__fat_readdir()`, `fat_get_short_entry()`, `fat_add_entries()`
- **Scope:** Single-file surgical fix
### Step 2.2: CODE FLOW CHANGE (per hunk)
**Record:**
| Hunk | Before | After | |------|--------|-------| | `fat_get_entry_eod()` (new) | N/A | Wraps `fat_get_entry()`; on `name[0]==0`, releases `*bh`, sets `*pos = dir->i_size`, returns `-1` | | `fat_parse_long()` | Advances past EOD during LFN parse | Stops at EOD via wrapper | | `fat_search_long()` | Scans past EOD | Stops at EOD | | `__fat_readdir()` | `IS_FREE()` skips EOD slot but loop continues into garbage | Stops directory iteration at EOD | | `fat_get_short_entry()` | Skips free slots including EOD, keeps scanning | Stops at EOD | | `fat_add_entries()` | No EOD awareness on write path | Tracks `saw_eod`; errors if allocated entry found after EOD marker |
### Step 2.3: BUG MECHANISM
**Record:** **Category:** Logic / filesystem correctness (spec violation).
Verified in current tree __fat_readdir():
```615:616:fs/fat/dir.c
if (de->attr != ATTR_EXT && IS_FREE(de->name))
goto record_end;
```IS_FREE() is true for name[0]==0 (EOD):
```52:53:include/uapi/linux/msdos_fs.h #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) ```
At record_end, ctx->pos = cpos and the loop returns to get_new, which calls fat_get_entry() again — advancing **past** the EOD marker into potentially non-zero garbage slots that are then emitted as real directory entries.
### Step 2.4: FIX QUALITY
**Record:** Fix is obviously correct per FAT spec; minimal wrapper centralizes behavior; write paths correctly remain on raw fat_get_entry(). **Regression risk: LOW** — only affects behavior after EOD marker; well-formed filesystems unchanged.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
**Record:** fat_get_entry() at lines 116–129 last touched by merge commit 5d324e5159d9e (2025-11-28); the EOD-ignoring behavior is longstanding (not a recent regression). Bug predates this stable branch.
### Step 3.2: FOLLOW Fixes: TAG **Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: FILE HISTORY FOR RELATED CHANGES
**Record:** Recent FAT change in this tree: 17866f8a0822d "fat: avoid parent link count underflow in rmdir" (touches fs/fat/ but not this EOD logic). No prior EOD fix in this tree. Standalone fix (v4 of a long- standing effort per commit message references to v1–v3 from 2018–2019).
### Step 3.4: AUTHOR'S OTHER COMMITS
**Record:** No Matteo Croce commits found in this tree's fs/fat/ history. Author is external contributor; fix endorsed by maintainer OGAWA Hirofumi.
### Step 3.5: DEPENDENT/PREREQUISITE COMMITS
**Record:** **None.** Self-contained; uses existing fat_fs_error_ratelimit() (present in fs/fat/fat.h:447). No patch- series dependency.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: ORIGINAL PATCH DISCUSSION
**Record:** Commit not present in local tree — b4 dig -c <hash> could not be run. b4 dig requires a commit-ish object. Link and lore.kernel.org fetches returned 403/bot protection. Commit message references v1–v3 at lore.kernel.org (2018–2019) — unverified directly but cited by author.
### Step 4.2: REVIEWERS
**Record:** Acked-by and Suggested-by from OGAWA Hirofumi (FAT maintainer). Merged by VFS maintainer Christian Brauner. Strong maintainer endorsement (from commit message tags).
### Step 4.3: BUG REPORT
**Record:** Reported-by Timothy Redaelli (Red Hat). Concrete user- visible symptoms described in commit message (~150 bogus ls entries, -EIO from stat()). No syzbot/KASAN report.
### Step 4.4: RELATED PATCHES/SERIES
**Record:** v4 of a fix series; earlier v1–v3 added per-call-site guards that maintainer identified as insufficient. This version centralizes the check per maintainer suggestion.
### Step 4.5: STABLE MAILING LIST HISTORY
**Record:** UNVERIFIED — lore.kernel.org inaccessible from this environment.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: KEY FUNCTIONS
**Record:** fat_get_entry_eod() (new), fat_parse_long(), fat_search_long(), __fat_readdir(), fat_get_short_entry(), fat_add_entries().
### Step 5.2: CALLERS
**Record:**
- __fat_readdir() → fat_readdir() → fat_dir_operations.iterate_shared — **every ls/getdents() on FAT/vfat**
- fat_search_long() → vfat name lookup (namei_vfat.c)
- fat_get_short_entry() → fat_get_dotdot_entry(), fat_dir_empty(), fat_subdirs(), fat_scan(), fat_scan_logstart() — rmdir, lookup, NFS export
- fat_add_entries() → file/directory creation (namei_vfat.c, namei_msdos.c)
### Step 5.3: CALLEES
**Record:** fat_get_entry(), fat__get_entry(), brelse(), fat_fs_error_ratelimit(), fat_bmap() (indirectly via position advance to dir->i_size).
### Step 5.4: CALL CHAIN / REACHABILITY
**Record:** Reachable from **userspace syscalls**: open() + getdents64()/readdir(), stat(), mkdir(), unlink(), rename() on FAT/vfat mounts. **High reachability** for anyone mounting FAT media.
### Step 5.5: SIMILAR PATTERNS
**Record:** Sibling filesystem exfat had related directory-entry bounds fixes backported to stable (33c0b96d7e167, adfacfbaeae2c in this tree's history), indicating stable maintainers value directory- entry correctness fixes.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
### Step 6.1: DOES THE BUGGY CODE EXIST?
**Record:** **YES.** fat_get_entry_eod does **not** exist (grep: 0 matches). All vulnerable fat_get_entry() call sites present at lines 328, 490, 602, 885, 1309. Bug is longstanding, not post-branch.
### Step 6.2: BACKPORT COMPLICATIONS
**Record:** **Clean apply** for main hunks verified via git apply --check. fat_add_entries() hunk may need minor line-number adjustment due to 17866f8a0822d (parent link count fix) — content matches, trivial backport adjustment.
### Step 6.3: RELATED FIXES ALREADY PRESENT? **Record:** **No.** No EOD handling, no fat_get_entry_eod, no saw_eod logic in current tree.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: SUBSYSTEM CRITICALITY
**Record:** **Filesystem (FAT/vfat)** — IMPORTANT. Widely used for USB sticks, SD cards, EFI partitions, embedded devices.
### Step 7.2: SUBSYSTEM ACTIVITY
**Record:** Active — recent fix 17866f8a0822d in same subsystem. FAT driver is mature but still receives correctness fixes.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: WHO IS AFFECTED
**Record:** All users mounting FAT12/FAT16/FAT32/vfat filesystems where directory trailing slots are not zero-filled after the EOD marker. Common with cross-platform media and buggy/corrupt images.
### Step 8.2: TRIGGER CONDITIONS
**Record:** Mount FAT filesystem and list/access directory on media with non-zero data after EOD marker. **Not** every boot, but **common** for removable media. Unprivileged users can trigger via normal file operations on mounted filesystem.
### Step 8.3: FAILURE MODE SEVERITY
**Record:** Bogus directory entries surfaced to userspace; stat() returns -EIO; potential application confusion/failures; write path could add entries to corrupt directories without the fat_add_entries() guard. **Severity: MEDIUM-HIGH** (filesystem correctness, not kernel oops/UAF, but serious user-visible malfunction).
### Step 8.4: RISK-BENEFIT
**Record:**
- **Benefit: HIGH** for FAT users — fixes real, reproducible directory listing corruption
- **Risk: LOW** — ~65 lines, one file, spec-aligned, maintainer-acked, write paths unchanged except corruption detection
- **Ratio: Strongly favors backport**
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: EVIDENCE COMPILED
**FOR backport:**
- Real, user-reported filesystem correctness bug
- FAT spec violation with concrete symptoms (~150 bogus entries)
- Centralized fix addresses root cause (prior per-site guards were broken)
- Maintainer Acked-by + Suggested-by
- Small, single-file, no new userspace API
- Buggy code confirmed present in 6.18.44; fix not yet applied
- Patch applies cleanly to this tree
- Affects common syscall paths (readdir, lookup, create)
- Write-path corruption detection prevents worsening damaged directories
**AGAINST backport:**
- Not a kernel crash/UAF/security issue
- Requires non-spec-compliant on-disk layout to trigger (but commit documents real-world occurrence)
- Mailing list discussion unverified due to lore access restrictions
**UNRESOLVED:**
- Full lore review thread content
- Exact mainline commit hash (not in this tree)
### Step 9.2: STABLE RULES CHECKLIST
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — spec-aligned, maintainer-acked; Tested-by not present but logic is verifiable | | 2. Fixes a real bug affecting users? | **PASS** — Reported-by with concrete symptoms | | 3. Important issue? | **PASS** — filesystem correctness, user-visible directory corruption | | 4. Small and contained? | **PASS** — one file, ~65 lines | | 5. No new features/APIs? | **PASS** — internal static wrapper only | | 6. Can apply to local tree? | **PASS** — verified clean apply for core hunks |
### Step 9.3: EXCEPTION CATEGORIES
**Record:** N/A — standard bug fix, not device ID/quirk/DT/build/doc exception.
### Step 9.4: DECISION RATIONALE
This is a longstanding FAT driver spec-compliance bug that causes real user-visible directory corruption on commonly encountered removable media. The fix is small, maintainer-reviewed, self-contained, and the vulnerable code is present in Linux 6.18.44 without an existing fix. Filesystem correctness on widely used FAT/vfat mounts meets stable criteria.
---
## Verification
- **[Phase 1]** Parsed commit message tags: Reported-by, Suggested-by, Acked-by (OGAWA Hirofumi), Link, Signed-off-by chain
- **[Phase 1]** Identified subsystem: fat, action: stop EOD iteration
- **[Phase 2]** Diff inventory: 1 file (fs/fat/dir.c), ~65 lines, 1 new function + 5 modified sites
- **[Phase 2]** Verified IS_FREE() treats name[0]==0 as free:
include/uapi/linux/msdos_fs.h:53
- **[Phase 2]** Traced __fat_readdir() EOD→record_end→get_new loop at fs/fat/dir.c:615-616,694-697,601-602
- **[Phase 2]** Confirmed fat_fs_error_ratelimit exists:
fs/fat/fat.h:447
- **[Phase 3]** git describe HEAD: v6.18.44-1-g2736c32da98b9;
Makefile: 6.18.44
- **[Phase 3]** git blame on fat_get_entry(): lines 116-129, longstanding code
- **[Phase 3]** No Fixes: tag to follow
- **[Phase 3]** Recent related commit: 17866f8a0822d in fs/fat/
- **[Phase 4]** b4 dig -c: FAILED — commit not in local tree
- **[Phase 4]** lore.kernel.org / patch.msgid.link fetch: FAILED (403/bot protection) — discussion unverified
- **[Phase 5]** grep fat_get_entry call sites: 8 uses in dir.c; read paths at 328, 490, 602, 885; write paths at 1015, 1309
- **[Phase 5]** Caller trace: fat_readdir → iterate_shared; fat_search_long/fat_scan → namei paths
- **[Phase 6]** grep fat_get_entry_eod: 0 matches — fix NOT in tree
- **[Phase 6]** Buggy fat_get_entry() without EOD handling: CONFIRMED present
- **[Phase 6]** git apply --check: PASS for fat_get_entry_eod addition and 4 call-site hunks
- **[Phase 6]** git apply --check for fat_add_entries hunk: needs minor line adjustment (due to 17866f8a0822d), content matches
- **[Phase 8]** Failure mode: bogus directory entries + -EIO on stat — MEDIUM-HIGH severity, user-visible
**YES**
fs/fat/dir.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-)
fs/fat/dir.c +40 -4
@@ -128,6 +128,31 @@ static inline int fat_get_entry(struct inode *dir, loff_t *pos,return fat__get_entry (dir, pos, bh, de); } +/* +* Like fat_get_entry(), but honour the FAT end-of-directory marker: +* a dirent whose first name byte is NUL terminates iteration per the +* spec, which also guarantees that every following slot is zeroed. +* Skip straight to the end of the directory so the next call returns +* -1 from fat_bmap() without re-reading the trailing zero slots, and +* so callers that persist *pos across invocations (e.g. readdir's +* ctx->pos) keep reporting EOD. Release *bh and set it to NULL to +* match fat_get_entry()'s contract that *bh is NULL on the -1 return. +*/ +static int fat_get_entry_eod (struct inode *dir,loff_t *pos, +struct buffer_head **bh, +struct msdos_dir_entry **de) +{ +int err =fat_get_entry (dir, pos, bh, de); + +if (err ==0 && (*de)->name[0 ] ==0 ) { +brelse (*bh); + *bh =NULL ; + *pos = dir->i_size; +return -1 ; + } +return err; +} +/* * Convert Unicode 16 to UTF-8, translated Unicode, or ASCII. * If uni_xlate is enabled and we can't get a 1:1 conversion, use a
@@ -325,7 +350,7 @@ static int fat_parse_long(struct inode *dir, loff_t *pos,if (ds->id &0x40 ) (*unicode)[offset +13 ] =0 ; -if (fat_get_entry (dir, pos, bh, de) <0 ) +if (fat_get_entry_eod (dir, pos, bh, de) <0 )return PARSE_EOF ;if (slot ==0 )break ;
@@ -487,7 +512,7 @@ int fat_search_long(struct inode *inode, const unsigned char *name, err = -ENOENT ;while (1 ) { -if (fat_get_entry (inode, &cpos, &bh, &de) ==-1 ) +if (fat_get_entry_eod (inode, &cpos, &bh, &de) ==-1 ) goto end_of_dir; parse_record: nr_slots =0 ;
@@ -599,7 +624,7 @@ static int __fat_readdir(struct inode *inode, struct file *file, bh =NULL ; get_new: -if (fat_get_entry (inode, &cpos, &bh, &de) ==-1 ) +if (fat_get_entry_eod (inode, &cpos, &bh, &de) ==-1 ) goto end_of_dir; parse_record: nr_slots =0 ;
@@ -882,7 +907,7 @@ static int fat_get_short_entry(struct inode *dir, loff_t *pos, struct buffer_head **bh, struct msdos_dir_entry **de) { - while (fat_get_entry(dir, pos, bh, de) >= 0) { + while (fat_get_entry_eod(dir, pos, bh, de) >= 0) {/* free entry or long name entry or volume label */ if (!IS_FREE ((*de)->name) && !((*de)->attr &ATTR_VOLUME ))return 0 ;
@@ -1298,6 +1323,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,struct msdos_dir_entry *de;int err, free_slots, i, nr_bhs;loff_t pos; +bool saw_eod; sinfo->nr_slots = nr_slots;
@@ -1306,12 +1332,15 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots, bh = prev =NULL ; pos =0 ; err = -ENOSPC ; + saw_eod = false;while (fat_get_entry (dir, &pos, &bh, &de) >-1 ) {/* check the maximum size of directory */ if (pos >=FAT_MAX_DIR_SIZE ) goto error;if (IS_FREE (de->name)) { +if (de->name[0 ] ==0 ) + saw_eod = true;if (prev != bh) {get_bh (bh); bhs[nr_bhs] = prev = bh;
@@ -1321,6 +1350,13 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,if (free_slots == nr_slots) goto found; }else { +if (saw_eod) { +fat_fs_error_ratelimit (sb, +"allocated dir entry found after end-of-directory marker (i_pos %lld)" , +MSDOS_I (dir)->i_pos); + err = -EIO ; + goto error; + }for (i =0 ; i < nr_bhs; i++)brelse (bhs[i]); prev =NULL ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 rtc: renesas-rtca3: Check RADJ poll result during initial setup
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit fafb016d081200c7652e84202f8ba5951e659a53 ]
In rtca3_initial_setup(), the driver clears the RTCA3_RADJ register and waits for it to reach zero using readb_poll_timeout(). Check the return value of readb_poll_timeout() and propagate the error if the poll fails.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Parse the Subject Line
**Record:** [rtc: renesas-rtca3] [Check] — Check the return value of the RADJ register poll during RTC initial setup in rtca3_initial_setup().
### Step 1.2: Parse All Commit Message Tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** Claudiu Beznea <[email protected]> # on RZ/G3S
- **Reviewed-by:** Claudiu Beznea <[email protected]>
- **Link:**
https://patch.msgid.link/20260602192559.1791344-3-prabhakar.mahadev-
[email protected]
- **Signed-off-by:** Lad Prabhakar, Alexandre Belloni (ignore pipeline- added SOBs)
- **Cc: stable:** — not present on this individual patch (patch 1/5 in the same series did CC stable)
- **Notable:** Part of v2 [PATCH 2/5] series; hardware-tested on RZ/G3S; no syzbot/fuzzer reports
### Step 1.3: Analyze Commit Body
**Record:**
- **Bug:** After clearing RTCA3_RADJ and polling for it to reach zero, the driver ignores the readb_poll_timeout() return value.
- **Symptom:** If the poll times out (-ETIMEDOUT), setup continues and may start the RTC with automatic time error adjustment (RTCA3_RCR2_AADJE) even though RADJ did not clear.
- **Root cause:** Oversight — every other poll in rtca3_initial_setup() checks ret; this one does not.
- **Version info:** None in message; driver landed in this tree via d4488377609e3 (Nov 2024).
### Step 1.4: Detect Hidden Bug Fixes
**Record:** Yes — despite neutral wording (“check the return value”), this is a real initialization error-handling bug, not cosmetic cleanup. The same RADJ-clear poll in rtca3_set_offset() already checks ret.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory the Changes
**Record:**
- **Files:** drivers/rtc/rtc-renesas-rtca3.c (+2 lines)
- **Function:** rtca3_initial_setup()
- **Scope:** Single-file, surgical fix (2 lines)
### Step 2.2: Code Flow Change
**Record:**
- **Hunk (lines 635–637):** Before: RADJ poll result stored in ret but ignored; execution proceeds to enable RTCA3_RCR2_START | RTCA3_RCR2_AADJE. After: on poll failure, return error immediately. Affects cold-init path in probe, not hot path.
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Error-path / logic correctness fix
- **Mechanism:** Missing timeout handling after hardware register poll. If RADJ does not clear within RTCA3_DEFAULT_TIMEOUT_US (150 µs), the driver continues hardware programming; the subsequent RCR2 poll overwrites ret, masking the failure and allowing probe to succeed with bad RTC adjustment state.
### Step 2.4: Fix Quality
**Record:** Obviously correct — mirrors the pattern used for all other polls in the same function and for the identical RADJ poll in rtca3_set_offset(). Minimal, no API changes. **Regression risk:** Very low; on success path ret == 0 and behavior is unchanged.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame the Changed Lines
**Record:** Buggy code introduced in d4488377609e3 (“rtc: renesas-
rtca3: Add driver for RTCA-3…”, Oct 30 2024). Present since driver introduction. Blame confirms lines 634–636 unchanged since d4488377609e3.
### Step 3.2: Follow Fixes Tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: File History / Related Changes
**Record:** Recent rtc-renesas-rtca3.c history in this tree:
- 6e21d1253ef13 — PIE clear polling fix (patch 1/5 of same series; already in 6.18.y)
- 27b2fcbd6b982 — Disable interrupts only if RTC enabled (probe- failure fix)
- 8f315a5c7376b — RISC-V build fix
- d4488377609e3 — Driver introduction
Patch 2/5 (this commit) is standalone; patches 3–5 are error-message, doc typo, and refactor (not prerequisites).
### Step 3.4: Author's Other Commits
**Record:** Lad Prabhakar authored patch 1 (PIE fix, backported here) and this patch. Claudiu Beznea (co-author/reviewer) introduced the driver. Both are active Renesas RTC contributors.
### Step 3.5: Dependencies
**Record:** No dependencies. Applies cleanly to current drivers/rtc/rtc-renesas-rtca3.c in this tree. Upstream commit:fafb016d08120 on master; **not yet in HEAD** (v6.18.44).
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Patch Discussion
**Record:**
- b4 dig -c 6e21d1253ef13 -a found series v2 at
https://patch.msgid.link/20260602192559.1791344-2-prabhakar.mahadev-
[email protected]
- This commit is [PATCH v2 2/5] (message-id …1791344-3…)
- Cover letter lists RADJ poll checking as an explicit series goal
- No NAKs found in saved mbox; Claudiu provided RB/TB
- **Stable nomination:** Only patch 1/5 CC'd [email protected] in the submission; patch 2/5 did not (per instructions, this is not a deciding factor)
### Step 4.2: Reviewers
**Record:** b4 dig -w recipients include Alexandre Belloni (RTC maintainer), Claudiu Beznea, Geert Uytterhoeven, linux-rtc@, linux- renesas-soc@.
### Step 4.3: Bug Reports
**Record:** No bug reports, syzbot links, or user crash reports. Issue identified by code review during the same audit that produced the PIE polling fix.
### Step 4.4: Related Patches
**Record:** 5-patch series; only patches 1–2 are bug fixes. Patches 3–5 (error message, doc typo, year-decoding refactor) are not stable candidates.
### Step 4.5: Stable Mailing List
**Record:** Not searched separately; patch 1 from this series was already cherry-picked into linux-6.18.y as 6e21d1253ef13 (Signed-
off-by: Greg Kroah-Hartman), confirming stable maintainers accept rtca3 fixes from this series.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** rtca3_initial_setup() modified.
### Step 5.2: Callers
**Record:** rtca3_initial_setup() called once from rtca3_probe() at line 760. rtca3_probe() is the platform_driver probe for module_platform_driver(rtca3_platform_driver). Runs at boot during device enumeration on Renesas RZ/G3S platforms with CONFIG_RTC_DRV_RENESAS_RTCA3.
### Step 5.3: Callees
**Record:** readb_poll_timeout(), writeb(), usleep_range(), clk_get_rate(). Hardware register I/O during init.
### Step 5.4: Reachability
**Record:** Triggered on every boot when the RTCA-3 platform device probes. Not userspace-triggerable directly, but affects all systems using this RTC hardware. Failure during init is a boot-time driver probe issue.
### Step 5.5: Similar Patterns
**Record:** In the same file, rtca3_set_offset() lines 538–542 perform the identical RADJ-clear poll **with** if (ret) return ret;. All other polls in rtca3_initial_setup() also check ret. This is the sole missing check in that function.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Does Buggy Code Exist?
**Record:** **Yes.** Local tree is v6.18.44 (linux-6.18.y). drivers/rtc/rtc-renesas-rtca3.c exists; lines 634–636 show the missing check. Driver present since d4488377609e3.
### Step 6.2: Backport Complications
**Record:** Clean apply expected — upstream diff matches current file context exactly. No conflicts anticipated.
### Step 6.3: Related Fixes Already Present?
**Record:** Patch 1/5 (PIE polling fix) already backported as 6e21d1253ef13. This patch 2/5 is **not** yet in HEAD. No alternate fix for the RADJ poll issue.
---
## Phase 7: Subsystem and Maintainer Context
### Step 7.1: Subsystem Criticality
**Record:** drivers/rtc/ — IMPORTANT (peripheral driver). CONFIG_RTC_DRV_RENESAS_RTCA3 depends on ARCH_RENESAS; targets Renesas RZ/G3S SoC only.
### Step 7.2: Subsystem Activity
**Record:** Driver is new (added late 2024) and actively maintained; multiple follow-up fixes in mainline and at least one already in this stable tree.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Config-specific, platform-specific — users building CONFIG_RTC_DRV_RENESAS_RTCA3 on Renesas RZ/G3S hardware. Not universal, but real production embedded users.
### Step 8.2: Trigger Conditions
**Record:** RADJ register fails to clear to zero within 150 µs after writeb(0, RTCA3_RADJ). Unlikely on healthy hardware; possible on marginal/broken hardware or timing edge cases. Not unprivileged- userspace-triggerable; boot-time init only.
### Step 8.3: Failure Mode Severity
**Record:** Without fix: probe succeeds despite failed RADJ init; RTC may start with RTCA3_RCR2_AADJE enabled while adjustment register is not in expected state → incorrect timekeeping/alarms. **Severity:
MEDIUM** — functional RTC corruption, not kernel oops/UAF/security issue. With fix: probe fails cleanly with "Failed to setup the RTC!".
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Prevents silently registering a mis-initialized RTC; consistent error handling; complements already-backported patch 1/5
- **Risk:** Very low — 2 lines, no behavior change when poll succeeds
- **Ratio:** Moderate benefit for a narrow audience, very low risk
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real bug — only missing poll error check in rtca3_initial_setup()
- Inconsistent with identical pattern elsewhere in same driver
- Can leave RTC in wrong adjustment state while probe succeeds
- Trivial, obviously correct, hardware-tested on RZ/G3S
- Driver exists in this 6.18.y tree; patch applies cleanly
- Sister fix (patch 1/5) already backported to this tree
- Reviewed/tested by driver co-maintainer
**AGAINST backport:**
- No user bug reports or reproducible failure described
- Only triggers on 150 µs poll timeout — rare on working hardware
- Not crash/security/deadlock/kernel memory corruption
- Narrow hardware scope (RZ/G3S only)
- Author CC'd stable only on patch 1, not this patch
- Patches 3–5 in series are clearly non-stable material
**Unresolved:** Whether RADJ poll timeout has been observed on real hardware (no evidence found).
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — 2-line mirror of existing pattern; Tested-by on RZ/G3S
2. Fixes a real bug? **PASS** — missing error propagation on hardware poll timeout
3. Important issue? **BORDERLINE PASS** — incorrect RTC init/timekeeping on affected embedded hardware; not a kernel crash, but functional hardware misconfiguration
4. Small and contained? **PASS** — 2 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — driver and buggy code present; clean apply
### Step 9.3: Exception Categories
**Record:** None (not device ID, quirk, DT, build fix, or docs fix).
### Step 9.4: Decision Rationale
This is a legitimate initialization bug in a driver that is already maintained in linux-6.18.y, with a sister fix from the same series already cherry-picked. The omission allows probe to succeed after a failed hardware register poll, immediately before enabling automatic time error adjustment — a documented init sequence step. While the trigger is uncommon and the audience is narrow (Renesas RZ/G3S), the fix is zero-risk on the success path, obviously correct, hardware-tested, and prevents silently exposing a mis-initialized RTC to userspace. That meets the stable bar for a contained driver probe correctness fix in hardware that this tree already supports.
---
## Verification
- **[Phase 1]** Parsed commit message tags from user-provided content
- **[Phase 2]** Read current drivers/rtc/rtc-renesas-rtca3.c lines 567–660, 538–542; confirmed 2-line diff
- **[Phase 3]** git describe HEAD → v6.18.44; make kernelversion equivalent → 6.18.44
- **[Phase 3]** git blame -L 630,650 → bug from d4488377609e3
- **[Phase 3]** git log --oneline -- drivers/rtc/rtc-renesas-rtca3.c → 5 commits, patch 1 backported, RADJ fix absent
- **[Phase 3]** git show fafb016d08120 on master → upstream commit matches provided diff
- **[Phase 3]** git merge-base --is-ancestor fafb016d08120 HEAD → RADJ fix NOT in HEAD
- **[Phase 4]** b4 dig -c 6e21d1253ef13 -a → found v2 5-patch series
- **[Phase 4]** b4 dig -m /tmp/rtca3-series.mbx → read cover letter and patch 2/5 content
- **[Phase 4]** Confirmed patch 1 CC'd stable; patch 2 did not
- **[Phase 4]** WebFetch of lore/patch.msgid.link blocked by bot protection for direct fetch; used b4 mbox instead
- **[Phase 5]** grep rtca3_initial_setup → called from rtca3_probe() line 760
- **[Phase 5]** Counted if (ret) checks vs readb_poll_timeout calls — RADJ poll is sole missing check in rtca3_initial_setup()
- **[Phase 6]** Confirmed CONFIG_RTC_DRV_RENESAS_RTCA3 in Kconfig, depends on ARCH_RENESAS
- **[Phase 6]** Confirmed buggy code at lines 634–636 without if (ret) return ret;
- **[Phase 8]** RTCA3_DEFAULT_TIMEOUT_US = 150 µs verified at line 87
**YES**The background git searches finished and match the earlier analysis:
- **RADJ poll fix** (fafb016d08120 / “Check RADJ poll result during initial setup”) is **not** in this linux-6.18.y checkout; it’s only on master.
- **All rtc-renesas-rtca3 commits in this tree:** driver introduction (d4488377609e3), RISC-V build fix, wakeup boolean cleanup, interrupt-disable probe fix (27b2fcbd6b982), and the already- backported PIE polling fix (6e21d1253ef13).
- **From the v2 5-patch series:** only patch 1 (PIE fix) is present; patch 2 (this RADJ check) and patches 3–5 are not.
That supports the **YES** backport recommendation for linux-6.18.y:
the bug is present, the fix is absent, and the related patch from the same series is already here.
drivers/rtc/rtc-renesas-rtca3.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/rtc/rtc-renesas-rtca3.c +2 -0
@@ -634,6 +634,8 @@ static int rtca3_initial_setup(struct clk *clk, struct rtca3_priv *priv)writeb (0 , priv->base +RTCA3_RADJ ); ret =readb_poll_timeout (priv->base +RTCA3_RADJ , tmp, !tmp,10 ,RTCA3_DEFAULT_TIMEOUT_US ); +if (ret) +return ret;/* Start the RTC and enable automatic time error adjustment. */ mask =RTCA3_RCR2_START |RTCA3_RCR2_AADJE ;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] rtc: renesas-rtca3: Check RADJ poll result during initial setup
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
From: Lad Prabhakar <[email protected]>
[ Upstream commit
fafb016d081200c7652e84202f8ba5951e659a53]In
rtca3_initial_setup(), the driver clears theRTCA3_RADJregister and waits for it to reach zero usingreadb_poll_timeout(). Check the return value ofreadb_poll_timeout()and propagate the error if the poll fails.
Quoted 6 lines
Signed-off-by Lad Prabhakar <[email protected]>Reviewed-by Claudiu Beznea <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1