ALSA: hda/realtek: add quirk for Lenovo Yoga 7 2-in-1 16AKP10
Subsystems (31)
Sasha Levin
maintainerPATCH 1/1 perf/amd/ibs: Avoid race between event add and NMI
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 1b044ff3c17e9d7fd93ffc0ba541ccdeb992d7f5 ]
Consider the following race:
--------
o OP_CTL contains stale value: OP_CTL[Val]=1, OP_CTL[En]=0
o A new IBS OP event is being added
o [P]: Process context, [N]: NMI context
[P] perf_ibs_add(event) {
[P] if (test_and_set_bit(IBS_ENABLED, pcpu->state))
[P] return;
[P] /* pcpu->state = IBS_ENABLED */
[P]
[P] pcpu->event = event;
[P]
[P] perf_ibs_start(event) {
[P] set_bit(IBS_STARTED, pcpu->state);
[P] /* pcpu->state = IBS_ENABLED | IBS_STARTED */
[P] clear_bit(IBS_STOPPING, pcpu->state);
[P] /* pcpu->state = IBS_ENABLED | IBS_STARTED */ [N] --> NMI due to genuine FETCH event. perf_ibs_handle_irq()
[N] called for OP PMU as well.
[N]
[N] perf_ibs_handle_irq(perf_ibs) {
[N] event = pcpu->event; /* See line 6 */
[N]
[N] if (!test_bit(IBS_STARTED, pcpu->state)) /* false */
[N] return 0;
[N]
[N] if (WARN_ON_ONCE(!event)) /* false */
[N] goto fail;
[N]
[N] if (!(*buf++ & perf_ibs->valid_mask)) /* false due to stale
[N] * IBS_OP_CTL value */
[N] goto fail;
[N]
[N] ...
[N]
[N] perf_ibs_enable_event() // *Accidentally* enable the event.
[N] }
[N]
[N] /*
[N] * Repeated NMIs may follow due to accidentally enabled IBS OP [N] * event if the sample period is very low. It could also lead [N] * to pcpu->state corruption if the event gets throttled due [N] * to too frequent NMIs. [N] */
[P] perf_ibs_enable_event(); [P] } [P] } --------
We cannot safely clear IBS_{FETCH|OP}_CTL while disabling the event, because the register might be read again later. So, clear the register in the enable path - before we update pcpu->state and enable the event. This guarantees that any NMI that lands in the gap finds Val=0 and bails out cleanly.
---
LLM Generated explanations, may be completely bogus:
Now I have a thorough understanding. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: perf/amd/ibs (AMD Instruction-Based Sampling perf PMU driver)
- **Action verb**: "Avoid" (almost always indicates fixing a bug)
- **Summary**: Prevent race between adding a perf event and NMI handling in IBS
### Step 1.2: Tags
- **Signed-off-by: Ravi Bangoria** - the author, AMD IBS subsystem expert
- **Signed-off-by: Peter Zijlstra (Intel)** - perf core maintainer, committed the patch
- **Acked-by: Namhyung Kim** - another perf subsystem maintainer
- **Link**:
https://patch.msgid.link/[email protected]
- patch 5/5 (originally numbered 6 including cover letter) in a series
- **No Fixes: tag** - expected for manual review candidates
- **No Cc: stable tag** - expected
Record: Strong reviewer/maintainer endorsement. No syzbot or bug reports.
### Step 1.3: Commit Body
The commit body provides an extremely detailed, step-by-step walkthrough of the race:
1. OP_CTL has stale Val=1, En=0 from a previous IBS sample
2. In process context, perf_ibs_add() → perf_ibs_start() sets IBS_STARTED
3. Before perf_ibs_enable_event() is called, an NMI arrives (from a FETCH event)
4. NMI handler sees IBS_STARTED=true, reads stale OP_CTL[Val]=1, treats it as valid
5. NMI handler calls perf_ibs_enable_event(), **accidentally** enabling the OP event
6. Results in: repeated NMIs, pcpu->state corruption, potential throttle issues
**Failure mode**: NMI storm and state corruption.
### Step 1.4: Hidden Bug Fix Detection
This is explicitly described as a race condition fix - not disguised at all.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files changed**: 1 (arch/x86/events/amd/ibs.c)
- **Lines added**: +8 (6 comment lines + 1 blank + 1 code line)
- **Lines removed**: 0
- **Functions modified**: perf_ibs_start()
- **Scope**: Single-function surgical fix
### Step 2.2: Code Flow Change
**Before**: After computing config, perf_ibs_start() sets IBS_STARTED, clears IBS_STOPPING, and enables the event. The IBS control MSR may contain stale Val=1 data from a previous sample.
**After**: Before setting IBS_STARTED, the code calls perf_ibs_disable_event(perf_ibs, hwc, 0) which writes 0 to the IBS control MSR, clearing Val and En bits. Any NMI arriving in the window between this write and the actual event enable will read Val=0 and bail out.
### Step 2.3: Bug Mechanism
**Category**: Race condition between process context and NMI context
- The NMI handler (perf_ibs_handle_irq) is called for both FETCH and OP PMUs on every IBS NMI (see perf_ibs_nmi_handler at line 1396-1411)
- A stale Val=1 in the OP_CTL MSR fools the handler into thinking a valid sample exists
- The handler then re-enables the event prematurely
### Step 2.4: Fix Quality
- **Obviously correct**: A single MSR zero-write before enabling, using an existing function
- **Minimal/surgical**: 1 functional line + comments
- **Regression risk**: Extremely low - clearing a register before writing new values into it is safe. The MSR was going to be written anyway a few instructions later by perf_ibs_enable_event()
- **No red flags**: Single function, single file, existing API
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
The IBS state machine code (set_bit/clear_bit for STARTED/STOPPING) was introduced by:
- 5a50f529170113 (Peter Zijlstra, 2016-03-16): "Fix race with IBS_STARTING state"
- 85dc600263c229 (Peter Zijlstra, 2016-03-21): "Fix pmu::stop() nesting"
Both were merged in kernel 4.7. The race condition has existed since then — present in **all active stable trees**.
### Step 3.2: No Fixes: tag (expected)
### Step 3.3: File History
Recent changes to ibs.c are mostly feature additions (ldlat filtering, min_period, etc.) and cleanups (MSR rename, syscore changes). This fix doesn't conflict with any of them.
### Step 3.4: Author
Ravi Bangoria is the AMD IBS subsystem maintainer/expert with 15+ commits to arch/x86/events/amd/ibs.c. This fix carries strong authority.
### Step 3.5: Dependencies
This is patch 5/5 in a series titled "perf/amd/ibs: Assorted fixes":
1. "Account interrupt for discarded samples"
2. "Limit ldlat->l3missonly dependency to Zen5"
3. "Preserve PhyAddrVal bit when clearing PhyAddr MSR"
4. "Avoid calling perf_allow_kernel() from the IBS NMI handler"
5. "Avoid race between event add and NMI" (this patch)
**Critical finding**: This patch is **completely standalone**. It only adds a call to the existing perf_ibs_disable_event() function. It does not depend on any changes from patches 1-4 (which address unrelated bugs).
---
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: Patch Discussion
- Found via patchew.org and spinics.net
- Upstream commit: 1b044ff3c17e9d7fd93ffc0ba541ccdeb992d7f5
- Merged into tip/perf/core on Feb 27, 2026 by Peter Zijlstra
- v2 series (v1 was at different URL, split from enhancements)
### Step 4.2: Reviewers
- **Namhyung Kim** Acked the entire series
- **Peter Zijlstra** (perf core maintainer) committed it
- All appropriate subsystem maintainers were involved
### Step 4.3-4.5: No specific bug report (author-found via code analysis), no stable-specific discussion found.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
- perf_ibs_start() (modified) - called from perf_ibs_add() during event scheduling
- perf_ibs_disable_event() (called, not modified) - writes 0 to IBS control MSR
### Step 5.2: Callers of perf_ibs_start
- perf_ibs_add() → perf_ibs_start() — called during perf event scheduling to CPU
- This is a standard perf PMU operation, triggered whenever a perf event using IBS is scheduled
### Step 5.3-5.4: Call Chainperf_event_open() → context scheduling → perf_ibs_add() → perf_ibs_start(). The race is triggerable from userspace by using perf record with IBS events on AMD processors. This is a common usage path.
### Step 5.5: Similar Patterns
The existing IBS state machine already had two prior race fixes (5a50f52 and 85dc600) for similar NMI vs. process context races. This is a third variant of the same class of bug.
---
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Buggy Code in Stable
The vulnerable code (set_bit(IBS_STARTED, ...) followed by perf_ibs_enable_event() without clearing stale MSR data) has existed since kernel 4.7 (2016). It exists in **all active stable trees**:
5.4.y, 5.10.y, 5.15.y, 6.1.y, 6.6.y, 6.12.y.
### Step 6.2: Backport Complications
The perf_ibs_start() function has seen minor changes over the years (8b0bed7d in v5.9 added config variable, fa5d0a82 added min_period check), but the core structure — compute config, set STARTED, enable event — has remained stable. The MSR accessor names changed (wrmsrl → wrmsrq) in newer trees, but the older trees still have perf_ibs_disable_event() with the same signature. The patch should apply cleanly to recent stable trees, and with trivial adjustments to older ones.
### Step 6.3: No related fixes already in stable for this specific race.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem
- **Path**: arch/x86/events/amd/ibs.c
- **Subsystem**: x86 perf/PMU (AMD IBS)
- **Criticality**: IMPORTANT — AMD IBS is used by all AMD processor users running perf profiling, which is standard practice for performance analysis
### Step 7.2: Activity
Actively maintained by Ravi Bangoria at AMD with regular fixes and enhancements.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is Affected
All users of AMD processors (Zen and later) using perf with IBS events. This includes server workloads, desktop profiling, and CI systems running performance testing.
### Step 8.2: Trigger Conditions
- Both IBS FETCH and IBS OP events are in use (or hardware has residual FETCH state)
- NMI from FETCH arrives during OP event initialization
- OP_CTL MSR has stale Val=1 from a previous sample
- More likely with low sample periods (high sampling frequency)
- Triggered from unprivileged perf usage (with appropriate perf_event_paranoid)
### Step 8.3: Failure Mode
- **NMI storm**: Repeated NMIs can occur if the sample period is very low
- **State corruption**: pcpu->state can become corrupted if the event gets throttled
- **Severity**: HIGH — NMI storms can make a system unresponsive; state corruption can lead to further crashes or undefined behavior
### Step 8.4: Risk-Benefit Ratio
- **Benefit**: Prevents NMI storms and state corruption on AMD systems during IBS profiling — HIGH benefit
- **Risk**: Single function call to an existing function, writing 0 to an MSR before writing new values — VERY LOW risk
- **Ratio**: Extremely favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes a concrete race condition between process context and NMI context
- Can cause NMI storms and state corruption (HIGH severity)
- Single line of functional code + comments (VERY LOW risk)
- Uses existing perf_ibs_disable_event() function (no new code paths)
- Self-contained — no dependencies on other patches
- Written by the AMD IBS maintainer, committed by perf core maintainer
- Acked by Namhyung Kim (another perf maintainer)
- Bug exists in all stable trees (since v4.7, 2016)
- Obviously correct — clearing a register before enabling it
**AGAINST backporting:**
- No user-reported bug or syzbot report (found via code analysis)
- Part of a 5-patch series (but confirmed standalone)
- No explicit stable nomination
### Step 9.2: Stable Rules Checklist
1. **Obviously correct and tested?** YES — single MSR write, committed by PeterZ, Acked by Namhyung
2. **Fixes a real bug?** YES — documented race causing NMI storms and state corruption
3. **Important issue?** YES — NMI storm = system hang; state corruption = undefined behavior
4. **Small and contained?** YES — 1 functional line in 1 function in 1 file
5. **No new features or APIs?** Correct — no new features
6. **Can apply to stable trees?** YES — clean apply expected
### Step 9.3: Exception Categories
Not an exception category — this is a standard race condition bug fix.
### Step 9.4: Decision
Strong YES. This is a textbook stable backport candidate: a minimal, obviously correct fix for a real race condition with severe consequences (NMI storms, state corruption), written and reviewed by the appropriate maintainers.
---
## Verification
- [Phase 1] Parsed tags: Signed-off-by (Bangoria, PeterZ), Acked-by (Namhyung Kim), Link to patchew/lore
- [Phase 2] Diff analysis: 1 functional line added (perf_ibs_disable_event(perf_ibs, hwc, 0)) + 7 comment/blank lines in perf_ibs_start()
- [Phase 2] Verified perf_ibs_disable_event() with config=0 writes 0 to the MSR (lines 451-459 of ibs.c)
- [Phase 2] Verified NMI handler checks valid_mask at line 1261 — stale Val=1 bypasses this check
- [Phase 2] Verified NMI handler is called for both FETCH and OP PMUs at lines 1402-1403
- [Phase 3] git blame: IBS_STARTED state machine introduced by 5a50f529170113 (v4.7, 2016) and refined by 85dc600263c229 (v4.7, 2016) — present in all stable trees
- [Phase 3] git log --author="Ravi Bangoria": 15+ commits to ibs.c — confirmed subsystem expert
- [Phase 3] Verified no dependencies on other patches in series — only uses existing perf_ibs_disable_event()
- [Phase 4] patchew.org: confirmed patch 5/5 in "Assorted fixes" series, all Acked by Namhyung
- [Phase 4] spinics.net: confirmed upstream commit 1b044ff3c17e9d7fd93ffc0ba541ccdeb992d7f5, merged Feb 27, 2026
- [Phase 4] Verified series patches 1-4 are independent bug fixes (different issues)
- [Phase 5] Verified perf_ibs_start() called from perf_ibs_add() (line 568), a standard PMU scheduling path
- [Phase 6] git log v6.6.. and v6.1..: ibs.c has had changes but core start() structure is preserved
- [Phase 8] Failure mode: NMI storm + state corruption → severity HIGH
- UNVERIFIED: Could not access lore.kernel.org directly due to Anubis bot protection — used patchew.org and spinics.net mirrors instead
**YES**
arch/x86/events/amd/ibs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/events/amd/ibs.c +8 -0
@@ -490,6 +490,14 @@ static void perf_ibs_start(struct perf_event *event, int flags) } config |= period >>4 ; +/* +* Reset the IBS_{FETCH|OP}_CTL MSR before updating pcpu->state. +* Doing so prevents a race condition in which an NMI due to other +* source might accidentally activate the event before we enable +* it ourselves. +*/ +perf_ibs_disable_event (perf_ibs, hwc,0 ); +/* * Set STARTED before enabling the hardware, such that a subsequent NMI * must observe it.
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amd/display: Fix dcn401_optimize_bandwidth
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit 002f32db0d4292f117994c330928d2374887b28e ]
[Why&How]
We should check for != zstate disallow and programming extend blank from a different struct.
---
LLM Generated explanations, may be completely bogus:
Now I have a complete picture. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: drm/amd/display (AMD GPU display controller)
- Action verb: "Fix"
- Summary: Fix dcn401_optimize_bandwidth function
Record: [drm/amd/display] [Fix] [Corrects zstate condition and struct access in dcn401_optimize_bandwidth]
**Step 1.2: Tags**
- Reviewed-by: Leo Chen, Dmytro Laktyushkin (AMD display engineers)
- Tested-by: Dan Wheeler (AMD test engineer)
- Signed-off-by: Charlene Liu (author), Ivan Lipski (submitter), Alex Deucher (AMD GPU maintainer)
- No Fixes: tag, no Cc: stable (expected for autosel candidates)
Record: Two reviewers, one tester, submitted through AMD's standard display patch process. Author is an AMD display team member.
**Step 1.3: Commit Body**
The message says "We should check for != zstate disallow and programming extend blank from a different struct." This describes two bugs:
1. The zstate check condition was too restrictive
2. The extended blank register value was being read from the wrong struct
Record: Two bugs described. Both relate to incorrect programming of extended blank during bandwidth optimization for DCN4.01 display hardware.
**Step 1.4: Hidden Bug Fix Detection**
Not hidden — explicitly labeled as "Fix" with clear description.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- 1 file changed:
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
- 2 lines changed (1 condition, 1 struct access)
- Function modified: dcn401_optimize_bandwidth
- Scope: Single-file, single-function surgical fix
**Step 2.2: Code Flow Change**
Change 1 (line 1476→1486):
- Before: if (zstate_support == DCN_ZSTATE_SUPPORT_ALLOW) — only enters the extended blank programming block when zstate is exactly ALLOW
- After: if (zstate_support != DCN_ZSTATE_SUPPORT_DISALLOW) — enters for ALL allow modes
The enum dcn_zstate_support_state has values: UNKNOWN, ALLOW, ALLOW_Z8_ONLY, ALLOW_Z8_Z10_ONLY, ALLOW_Z10_ONLY, DISALLOW. The old code missed Z8_ONLY, Z8_Z10_ONLY, and Z10_ONLY modes.
Change 2 (line 1484):
- Before: pipe_ctx->dlg_regs.min_dst_y_next_start — reads from old DML1 struct _vcs_dpi_display_dlg_regs_st
- After: pipe_ctx->hubp_regs.dlg_regs.min_dst_y_next_start — reads from DML2.1 struct dml2_dchub_per_pipe_register_set
**Step 2.3: Bug Mechanism**
Bug 1 (Logic/correctness): Wrong condition excludes valid z-state power modes from extended blank programming. This is a logic bug where the original code was copied from DCN20 which only had ALLOW/DISALLOW, but DCN401 has additional modes (Z8, Z10, etc.).
Bug 2 (Wrong struct access): DCN401 uses DML2.1 which populates pipe_ctx->hubp_regs. The old pipe_ctx->dlg_regs is populated by DML2.0's dml21_update_pipe_ctx_dchub_regs, which was removed in commit 63ab80d9ac0a. Reading from the wrong struct yields zero/stale data.
**Step 2.4: Fix Quality**
- Obviously correct: aligns with how all other DCN clk_mgr code checks zstate (!= DISALLOW), and aligns with how all other DCN401 code accesses hubp_regs
- Minimal/surgical: exactly 2 lines
- No regression risk: both changes narrow in on the correct behavior
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: Blame**
The buggy code was introduced by commit 70839da636050 (Aurabindo Pillai, 2024-04-19) "drm/amd/display: Add new DCN401 sources". This commit first appeared in v6.11.
The dlg_regs bug was latent until commit 63ab80d9ac0a (Rafal Ostrowski, 2024-12-17) "drm/amd/display: DML2.1 Post-Si Cleanup" which removed dml21_update_pipe_ctx_dchub_regs that was populating pipe_ctx->dlg_regs. This commit is in v6.14+ only.
Record: zstate bug exists since v6.11. dlg_regs bug became active in v6.14 when the function populating the old struct was removed.
**Step 3.2: No Fixes: tag** (expected)
**Step 3.3: File History**
Recent file changes are mostly unrelated (NULL ptr deref fix, DPP guards, cursor offload). No prerequisites for this fix.
**Step 3.4: Author**
Charlene Liu is a regular AMD display team contributor with many commits in the subsystem. Ivan Lipski is the submitter who regularly contributes AMD display fixes.
**Step 3.5: Dependencies**
No dependencies. The fix is standalone — both hubp_regs and the zstate enum values exist since v6.11.
## PHASE 4: MAILING LIST
**Step 4.1: Original Submission**
Found at: https://yhbt.net/lore/amd- gfx/[email protected]/
Part of a 9-patch series "DC Patches February 18, 2026". This is patch 5/9. The series includes other display fixes (cursor, DPIA, compiler warnings).
**Step 4.2: Reviewers**
Appropriate AMD display maintainers and engineers were CC'd: Harry Wentland, Leo Li, Aurabindo Pillai, Wayne Lin, Tom Chung, and the specific reviewers Leo Chen and Dmytro Laktyushkin.
**Step 4.3: Bug Report**
No specific bug report link found. This appears to be found during internal code review/testing at AMD.
**Step 4.4: Series Independence**
Other patches in the series (cursor pos fix, DPIA fix, type mismatch) are independent. This fix is standalone.
**Step 4.5: No stable-specific discussion found.**
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Modified Function** dcn401_optimize_bandwidth — called during display bandwidth optimization after clock updates.
**Step 5.2: Callers**dcn401_optimize_bandwidth is a hardware sequencer function registered in the DCN401 init table. It is called during DC bandwidth optimization, which occurs on display mode changes, resolution changes, and power state transitions.
**Step 5.3: Callees**
The affected code calls pipe_ctx->plane_res.hubp->funcs->program_extended_blank() which programs display hardware registers for extended blanking during z-state power saving.
**Step 5.4: Call Chain**
Reachable via standard display mode setting paths (user-triggered via xrandr, display manager, etc.) and power management transitions. This is not an obscure path.
**Step 5.5: Similar Patterns**
DCN20 (dcn20_hwseq.c:2458) has the same == DCN_ZSTATE_SUPPORT_ALLOW pattern, which is potentially also a bug but uses the old DML path where pipe_ctx->dlg_regs IS populated.
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: Code Existence**
- DCN401 code exists since v6.11
- hubp_regs field exists since v6.11 (commit 00c391102abc)
- The dlg_regs regression was introduced in v6.14 (commit 63ab80d9ac0a)
- Both bugs are present in v7.0
**Step 6.2: Backport Difficulty**
The patch should apply cleanly to v7.0.y — the modified lines are unchanged from when they were introduced. For v6.14.y+, both fixes apply. For v6.12.y and earlier, only the zstate fix applies (dlg_regs is still populated there).
**Step 6.3: No related fixes in stable.**
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1:** drm/amd/display — IMPORTANT subsystem. DCN401 is AMD's display controller for newer GPUs. Display bugs directly affect user experience.
**Step 7.2:** Actively developed subsystem with frequent commits.
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1:** Affects users of AMD GPUs with DCN4.01 display controller hardware.
**Step 8.2:** Triggers during power management transitions (z-state changes) — common on laptops and energy-efficient desktops. The zstate bug triggers whenever Z8/Z10 power modes are selected instead of full Z-state.
**Step 8.3:** Failure mode is incorrect display hardware programming:
- Without extended blank programming during z-states: display artifacts, flickering, or incorrect power management behavior
- With wrong/zero value for min_dst_y_next_start: incorrect blank timing, potential display corruption
- Severity: HIGH (visible display issues for affected hardware)
**Step 8.4:**
- Benefit: HIGH — fixes real display hardware programming bugs for DCN401 users
- Risk: VERY LOW — 2-line change, obviously correct, reviewed and tested
- Ratio: Strongly favors backporting
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: Evidence**
FOR backporting:
- Fixes two real bugs: incorrect zstate condition and wrong struct access
- Small, surgical fix (2 lines)
- Reviewed by two AMD display engineers, tested
- Affects real hardware (DCN401 GPUs)
- Display bugs directly affect user experience
- Consistent with how other DCN code handles zstate and hubp_regs
AGAINST backporting:
- DCN401 is relatively new hardware (v6.11+)
- No user bug reports (found during code review)
- The dlg_regs bug only manifests in v6.14+ (after DML2.1 cleanup)
**Step 9.2: Stable Rules**
1. Obviously correct? YES — aligns with all other zstate checks and hubp_regs usage
2. Fixes real bug? YES — wrong hardware programming values
3. Important issue? YES — display correctness on affected hardware
4. Small and contained? YES — 2 lines, 1 function, 1 file
5. No new features? CORRECT — pure bug fix
6. Applies to stable? YES — cleanly for v7.0.y
**Step 9.3:** No exception category — standard bug fix.
**Step 9.4:** The evidence clearly supports backporting.
## Verification
- [Phase 1] Parsed tags: Reviewed-by Leo Chen and Dmytro Laktyushkin, Tested-by Dan Wheeler, author Charlene Liu
- [Phase 2] Diff analysis: 2 lines changed in dcn401_optimize_bandwidth(): broadened zstate condition and fixed struct access
- [Phase 2] Verified enum values at dc.h:665-671: 6 states including ALLOW, Z8_ONLY, Z8_Z10_ONLY, Z10_ONLY, DISALLOW
- [Phase 2] Verified pipe_ctx->hubp_regs is struct dml2_dchub_per_pipe_register_set containing dlg_regs with min_dst_y_next_start field
- [Phase 2] Verified pipe_ctx->dlg_regs is the OLD _vcs_dpi_display_dlg_regs_st struct (different type)
- [Phase 3] git blame: buggy code introduced in commit 70839da636050 (v6.11, "Add new DCN401 sources")
- [Phase 3] Confirmed hubp_regs added in commit 00c391102abc (also v6.11)
- [Phase 3] Confirmed dlg_regs regression introduced by 63ab80d9ac0a (v6.14, "DML2.1 Post-Si Cleanup") which removed dml21_update_pipe_ctx_dchub_regs
- [Phase 3] Verified dml21_utils.c:225 populates pipe_ctx->hubp_regs via memcpy for DCN401 (DML2.1 path)
- [Phase 3] Verified DCN401 uses DML2.1 (dcn401_resource.c has .using_dml21 = true)
- [Phase 3] Verified other DCN401 code uses pipe_ctx->hubp_regs.dlg_regs (dcn401_hwseq.c:2889-2892)
- [Phase 4] Found original submission at lore (patch 5/9 in DC Patches Feb 18 2026 series)
- [Phase 4] Appropriate AMD display maintainers were CC'd
- [Phase 5] Confirmed program_extended_blank is registered in hubp function tables for DCN31/DCN35
- [Phase 6] Verified 63ab80d9ac0a is NOT in v6.12/v6.13 but IS in v6.14+
- [Phase 6] Both bugs present in v7.0
- [Phase 8] Display correctness issue for DCN401 GPU users during power state transitions
The fix is small, surgical, obviously correct, reviewed, tested, and fixes real display hardware programming bugs for DCN401 users. It meets all stable kernel criteria.
**YES**
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +2 -2
@@ -1492,7 +1492,7 @@ void dcn401_optimize_bandwidth( dc->clk_mgr, context, true); -if (context->bw_ctx.bw.dcn.clk.zstate_support ==DCN_ZSTATE_SUPPORT_ALLOW ) { +if (context->bw_ctx.bw.dcn.clk.zstate_support !=DCN_ZSTATE_SUPPORT_DISALLOW ) {for (i =0 ; i < dc->res_pool->pipe_count; ++i) {struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
@@ -1500,7 +1500,7 @@ void dcn401_optimize_bandwidth( && pipe_ctx->stream->adjust.v_total_min == pipe_ctx->stream->adjust.v_total_max && pipe_ctx->stream->adjust.v_total_max > pipe_ctx->stream->timing.v_total) pipe_ctx->plane_res.hubp->funcs->program_extended_blank(pipe_ctx->plane_res.hubp, - pipe_ctx->dlg_regs.min_dst_y_next_start); + pipe_ctx->hubp_regs.dlg_regs.min_dst_y_next_start); } } }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rtw88: coex: Ignore BT info byte 5 from RTL8821A
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 658e3c836969e1624a7572c75684f54ec503c2ed ]
Sometimes while watching a Youtube video with Bluetooth headphones the audio has a lot of interruptions, because the 5th byte of the BT info sent by RTL8821AU has strange values, which result in coex_stat->bt_hid_pair_num being 2 or 3. When this happens rtw_coex_freerun_check() returns true, which causes rtw_coex_action_wl_connected() to call rtw_coex_action_freerun() instead of rtw_coex_action_bt_a2dp().
The RTL8821AU vendor driver doesn't do anything with the 5th byte of the BT info, so ignore it here as well.
---
LLM Generated explanations, may be completely bogus:
Good. Now I have a complete picture. Here is the full analysis:
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: wifi: rtw88: coex: (Realtek RTW88 WiFi driver, Bluetooth coexistence)
- **Action verb**: "Ignore" — indicates a hardware-specific workaround to suppress bad data
- **Summary**: Ignore erroneous BT info byte 5 from RTL8821A chip to fix Bluetooth audio interruptions
### Step 1.2: Tags
- **Signed-off-by**: Bitterblue Smith (author) + Ping-Ke Shih (subsystem maintainer)
- **Acked-by**: Ping-Ke Shih — the Realtek WiFi subsystem maintainer endorsed this
- **Link**: patch.msgid.link reference
- No Fixes: tag (expected for manual review candidates)
- No Reported-by: tag, but the commit message describes a user-visible symptom experienced by the author
- No Cc: stable (expected)
### Step 1.3: Body Analysis
The commit describes a real, user-visible bug:
- **Bug**: While watching YouTube with Bluetooth headphones, audio has frequent interruptions
- **Root cause**: RTL8821AU sends BT info with "strange values" in byte 5 (bt_info_hb2), which causes bt_hid_pair_num to be 2 or 3
- **Impact chain**: bt_hid_pair_num >= 2 → rtw_coex_freerun_check() returns true → rtw_coex_action_freerun() is called instead of rtw_coex_action_bt_a2dp() → wrong coexistence algorithm → audio stuttering
- **Vendor driver evidence**: RTL8821AU vendor driver doesn't use byte 5 at all
### Step 1.4: Hidden Bug Fix Detection
This IS a bug fix. The "Ignore" verb is a hardware workaround — the chip sends garbage data in byte 5 that causes incorrect coexistence decisions.
Record: This is a hardware quirk/workaround disguised with neutral language.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files changed**: 1 (drivers/net/wireless/realtek/rtw88/coex.c)
- **Lines added**: 3 (including blank line)
- **Lines removed**: 0
- **Function modified**: rtw_coex_bt_info_notify()
- **Scope**: Single-file surgical fix, chip-specific
### Step 2.2: Code Flow Change
**Before**: Byte 5 of BT info (bt_info_c2h[rsp_source][5]) is stored verbatim from the buffer, then copied into bt_info_hb2, and later used to compute bt_hid_pair_num, bt_hid_slot, bt_opp_exist, etc.
**After**: For RTL8821A only, byte 5 is zeroed immediately after being copied from the buffer. This means all downstream fields derived from bt_info_hb2 (like bt_hid_pair_num, bt_hid_slot, bt_opp_exist, bt_a2dp_active, bt_slave) will be based on a zero value instead of garbage.
### Step 2.3: Bug Mechanism
This is a **hardware workaround** (category h). The RTL8821A firmware sends unreliable data in byte 5 of BT info. The fix zeros it to prevent incorrect coexistence algorithm selection.
The critical impact path: bt_hid_pair_num (derived from bits 6-7 of byte 5) being >= 2 causes rtw_coex_freerun_check() at line 127 to return true, which in rtw_coex_action_wl_connected() (lines 2496-2516) causes "freerun" mode instead of the proper A2DP algorithm.
### Step 2.4: Fix Quality
- **Obviously correct**: Yes — the vendor driver ignores this byte entirely, zeroing it is the conservative approach
- **Minimal/surgical**: Yes — 2 lines of real code, chip-specific guard
- **Regression risk**: Very low — only affects RTL8821A, and only suppresses data that's already garbage
- **Red flags**: None
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
- bt_hid_pair_num extraction from bt_info_hb2 was introduced by commit 4136214f7c4683 (Yan-Hsuan Chuang, 2019-07-31) — present since very early rtw88 history
- The freerun check using bt_hid_pair_num >= 2 was added by commit 8e6947dcb95d77 (Ching-Te Ku, 2020-11-26)
- However, RTW_CHIP_TYPE_8821A was only added in v6.13 (commit d12722830ea4f, 2024-10-23)
### Step 3.2: Fixes Tag
No Fixes: tag present. The bug exists since RTL8821A support was first added in v6.13.
### Step 3.3: Related Changes
The author (Bitterblue Smith) has been the primary contributor of RTL8821A/RTL8812A support in rtw88, with numerous commits adding the chip support infrastructure. Related commit bfcee5ee924fc ("wifi:
rtw88: 8821a: Regularly ask for BT info updates") also addresses RTL8821AU BT coexistence quirks — another sign the chip's BT behavior is non-standard.
### Step 3.4: Author Context
Bitterblue Smith is the primary developer who reverse-engineered and ported RTL8821A/RTL8812A support to the rtw88 framework. They are the de facto maintainer of this chip's support. The fix is acked by the rtw88 subsystem maintainer Ping-Ke Shih.
### Step 3.5: Dependencies
The fix depends on RTW_CHIP_TYPE_8821A existing in the enum (added in v6.13). No other dependencies — the code is self-contained.
---
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1-4.5
Lore is protected by Anubis bot detection and could not be fetched. b4 dig could not find the commit (it's not yet in the local tree). However, the patch link (patch.msgid.link/[email protected]) is in the commit metadata.
The commit has **Acked-by: Ping-Ke Shih** (Realtek maintainer) AND **Signed-off-by: Ping-Ke Shih** (meaning he applied it through his tree), which is strong evidence of proper review.
Record: Could not access lore. However, maintainer ack and sign-off confirmed from commit tags.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.2: Function & Callers
The modified function is rtw_coex_bt_info_notify(). The zeroed byte 5 (bt_info_hb2) affects:
1. rtw_coex_freerun_check() via bt_hid_pair_num (line 127) — controls whether freerun or proper A2DP coex is used
2. bt_opp_exist, bt_a2dp_active, bt_slave, bt_hid_slot, bt_hid_pair_num, bt_418_hid_exist (lines 3251-3262) — all derived from byte 5
For RTL8821A, since the vendor driver ignores all of byte 5, zeroing it is the correct behavior for all these fields.
### Step 5.3-5.5
The freerun vs A2DP algorithm choice directly impacts the Bluetooth TDMA scheduling — freerun mode doesn't properly coordinate WiFi/BT time slots for A2DP streaming, causing audio dropouts.
---
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Code Existence in Stable
- RTW_CHIP_TYPE_8821A was added in v6.13 (commit d12722830ea4f)
- The coex code being modified (rtw_coex_bt_info_notify) exists in all trees, but the chip type enum only exists in v6.13+
- **Applicable stable trees**: 6.13.y, 6.14.y, 6.15.y, and this 7.0.y tree
- **NOT applicable**: 6.12.y and older (no RTL8821A support)
### Step 6.2: Backport Complications
The patch should apply cleanly to any tree with RTL8821A support (v6.13+). The surrounding code in rtw_coex_bt_info_notify() has been stable.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
- **Subsystem**: WiFi driver (drivers/net/wireless/realtek/rtw88) — IMPORTANT level
- RTL8821AU is a common USB WiFi dongle used by many Linux users
### Step 7.2: Activity
Active subsystem with regular commits from both Bitterblue Smith and Ping-Ke Shih.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
Users of RTL8821AU USB WiFi dongles who use Bluetooth headphones simultaneously (a very common use case for laptop users with USB WiFi adapters).
### Step 8.2: Trigger Conditions
- Trigger: Using Bluetooth A2DP headphones while WiFi is connected
- Very common scenario — watching video with BT headphones is an everyday task
- No special privileges needed
### Step 8.3: Failure Mode Severity
- **Failure mode**: Bluetooth audio has frequent interruptions/stuttering
- **Severity**: MEDIUM-HIGH — not a crash, but makes BT audio unusable, which is a significant functionality regression for a very common use case
### Step 8.4: Risk-Benefit
- **Benefit**: HIGH — fixes Bluetooth audio for RTL8821AU users, very common use case
- **Risk**: VERY LOW — 2 lines, chip-specific guard, vendor driver doesn't use this byte at all, maintainer-acked
- **Ratio**: Strongly favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence
**FOR backporting:**
- Fixes real user-visible bug (BT audio stuttering)
- Extremely small (2 lines of code)
- Hardware-specific quirk (only RTL8821A affected)
- Consistent with vendor driver behavior
- Acked by subsystem maintainer (Ping-Ke Shih)
- Zero regression risk for other chips
- Common use case (BT audio + WiFi)
**AGAINST backporting:**
- Only affects trees with RTL8821A support (v6.13+)
- No Fixes: tag (expected for review candidates)
- No explicit stable nomination
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** — matches vendor driver, acked by maintainer
2. Fixes a real bug? **YES** — BT audio interruptions
3. Important issue? **YES** — makes BT audio unusable with this common USB dongle
4. Small and contained? **YES** — 2 lines, single file, chip-specific
5. No new features or APIs? **CORRECT** — this is a workaround, not a feature
6. Can apply to stable trees? **YES** — clean apply to v6.13+
### Step 9.3: Exception Category
This is a **hardware quirk/workaround** — a classic exception category that is automatically YES for stable.
---
## Verification
- [Phase 1] Parsed tags: Acked-by and Signed-off-by from Ping-Ke Shih (subsystem maintainer)
- [Phase 2] Diff analysis: 2 lines added after buffer copy in rtw_coex_bt_info_notify(), zeroes byte 5 for RTL8821A only
- [Phase 2] Verified impact path: byte 5 → bt_info_hb2 → bt_hid_pair_num at line 3258 → rtw_coex_freerun_check() at line 127 → wrong algorithm at lines 2496-2516
- [Phase 3] git blame: bt_hid_pair_num extraction from 2019, freerun check from 2020, RTL8821A chip type added v6.13
- [Phase 3] RTW_CHIP_TYPE_8821A added in commit d12722830ea4f (v6.13)
- [Phase 3] RTL8821A driver (rtw8821a.c) added in commit 32e284a238806 (v6.13)
- [Phase 3] Author is the primary RTL8821A/RTL8812A contributor with many commits in rtw88
- [Phase 4] Lore access blocked by Anubis. UNVERIFIED: could not read mailing list discussion
- [Phase 5] Traced bt_hid_pair_num usage: line 127 (rtw_coex_freerun_check), line 1530 (algorithm selection), lines 3258-3262 (418 HID detection)
- [Phase 6] Applicable to stable trees v6.13.y and newer only (RTL8821A support not present in older trees)
- [Phase 6] Patch applies cleanly — no conflicting changes in surrounding code
- [Phase 8] Failure mode: BT A2DP audio stuttering when WiFi connected, severity MEDIUM-HIGH
---
This is a textbook hardware quirk fix: a 2-line, chip-specific workaround that fixes a real user-visible Bluetooth audio problem, is consistent with the vendor driver, and is endorsed by the subsystem maintainer. The regression risk is negligible since it only affects RTL8821A and only zeroes a byte containing garbage data. It meets all stable kernel criteria.
**YES**
drivers/net/wireless/realtek/rtw88/coex.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw88/coex.c +3 -0
@@ -3095,6 +3095,9 @@ void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)for (i =0 ; i <COEX_BTINFO_LENGTH ; i++) coex_stat->bt_info_c2h[rsp_source][i] = buf[i]; +if (rtwdev->chip->id ==RTW_CHIP_TYPE_8821A ) + coex_stat->bt_info_c2h[rsp_source][5 ] =0 ; +/* get the same info from bt, skip it */ if (coex_stat->bt_info_c2h[rsp_source][1] == coex_stat->bt_info_lb2 && coex_stat->bt_info_c2h[rsp_source][2] == coex_stat->bt_info_lb3 &&
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 btrfs: tracepoints: get correct superblock from dentry in event btrfs_sync_file()
In reply to Sasha LevinFrom: Goldwyn Rodrigues <[email protected]>
[ Upstream commit a85b46db143fda5869e7d8df8f258ccef5fa1719 ]
If overlay is used on top of btrfs, dentry->d_sb translates to overlay's super block and fsid assignment will lead to a crash.
Use file_inode(file)->i_sb to always get btrfs_sb.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
include/trace/events/btrfs.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/trace/events/btrfs.h +7 -4
@@ -769,12 +769,15 @@ TRACE_EVENT(btrfs_sync_file, ),TP_fast_assign ( - const struct dentry *dentry = file->f_path.dentry; -const struct inode *inode =d_inode (dentry); + struct dentry *dentry = file_dentry(file); +struct inode *inode =file_inode (file); +struct dentry *parent =dget_parent (dentry); +struct inode *parent_inode =d_inode (parent); -TP_fast_assign_fsid (btrfs_sb (file->f_path.dentry->d_sb)); +dput (parent); +TP_fast_assign_fsid (btrfs_sb (inode->i_sb)); __entry->ino =btrfs_ino (BTRFS_I (inode)); - __entry->parent =btrfs_ino (BTRFS_I (d_inode (dentry->d_parent))); + __entry->parent =btrfs_ino (BTRFS_I (parent_inode)); __entry->datasync = datasync; __entry->root_objectid =btrfs_root_id (BTRFS_I (inode)->root); ),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda/realtek: Add quirk for CSL Unity BF24B
In reply to Sasha LevinFrom: Zhang Heng <[email protected]>
[ Upstream commit de65275fc94e2e0acc79bd016d60889bf251ccd9 ]
The CSL Unity BF24B all-in-one PC uses a Realtek ALC662 rev3 audio codec and requires the correct GPIO configuration to enable sound output from both the speakers and the headphone.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a comprehensive analysis. Let me compile the findings.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: ALSA: hda/realtek
- Action verb: "Add quirk" — this is adding a hardware-specific workaround
- Summary: Adding GPIO quirk for CSL Unity BF24B all-in-one PC to enable audio output
- Record: [ALSA/HDA/Realtek] [Add quirk] [GPIO config to enable speakers/headphone on CSL Unity BF24B]
**Step 1.2: Tags**
- Link: https://bugzilla.kernel.org/show_bug.cgi?id=221258 — user- filed bug report
- Signed-off-by: Zhang Heng (author, regular Realtek quirk contributor)
- Link: patch.msgid.link (for tracking the patch)
- Signed-off-by: Takashi Iwai (ALSA subsystem maintainer — applied the patch)
- No Fixes: tag (expected — this is a quirk addition, not fixing a code defect)
- No Cc: stable (expected — this is why we're reviewing it)
- Record: Bugzilla report from real user. Signed off by the ALSA maintainer.
**Step 1.3: Commit Body**
- Bug: CSL Unity BF24B all-in-one PC has no sound output from speakers or headphones
- Codec: Realtek ALC662 rev3
- Root cause: GPIO configuration needed to enable the amplifier
- Record: Complete audio failure on specific hardware without GPIO toggle workaround.
**Step 1.4: Hidden Bug Fix Detection**
- This is not a hidden bug fix — it's an explicit hardware quirk addition. The device literally has no audio without it.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- Files changed: 1 (sound/hda/codecs/realtek/alc662.c)
- Lines added: ~25 (new function + enum + fixup entry + quirk entry)
- Functions modified: none existing; one new function added (alc662_fixup_csl_amp)
- Scope: single-file, surgical, self-contained
**Step 2.2: Code Flow Change**
1. New function alc662_fixup_csl_amp:
- HDA_FIXUP_ACT_PRE_PROBE: Sets GPIO mask and direction for bits
0+1
- HDA_FIXUP_ACT_INIT: Toggles GPIO 0+1 high, waits 100ms, then low — to enable the amplifier
2. New enum ALC662_FIXUP_CSL_GPIO added at end of existing enum
3. New fixup table entry linking enum to function
4. New quirk table entry: SND_PCI_QUIRK(0x1022, 0xc950, "CSL Unity BF24B", ALC662_FIXUP_CSL_GPIO)
**Step 2.3: Bug Mechanism**
- Category: Hardware workaround (h)
- The CSL Unity BF24B's amplifier requires a GPIO toggle pulse to enable. Without it, the amp stays off and no sound comes out.
**Step 2.4: Fix Quality**
- The pattern is nearly identical to alc245_fixup_hp_x360_amp in alc269.c (lines 1448-1465), which toggles GPIO0 similarly. This new one toggles GPIO0+GPIO1 (mask 0x03).
- Obviously correct — follows well-established patterns used dozens of times in this driver.
- Minimal regression risk — only affects devices with PCI SSID 0x1022:0xc950.
- Takashi Iwai noted a minor inefficiency (extra GPIO write from alc_auto_init_amp) but accepted the patch as-is, planning cleanup later.
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: Blame**
- The ALC662 quirk infrastructure has been in the kernel for many years. The file was recently split from sound/pci/hda/patch_realtek.c in commit aeeb85f26c3bb (July 2025, kernel 7.0-rc cycle), which was itself moved from sound/pci/hda/ to sound/hda/codecs/ in 6014e9021b28e.
- The ALC662 fixup enum and table existed in patch_realtek.c long before the split.
**Step 3.2: No Fixes: tag** — expected for a quirk addition.
**Step 3.3: File History**
- Recent changes are all quirk additions — this is a very common pattern for this file.
- The author (Zhang Heng) has contributed many similar quirks: Acer Swift, HP Laptop, ASUS ROG, Lenovo Yoga, etc.
**Step 3.4: Author**
- Zhang Heng is a prolific Realtek quirk contributor with 10+ similar commits in the tree.
**Step 3.5: Dependencies**
- This is fully standalone. Uses only existing APIs (alc_update_gpio_data, alc_spec).
- For stable trees (6.x), the patch would need to target sound/pci/hda/patch_realtek.c instead. The functions and structures are identical there (verified: alc_update_gpio_data appears 14 times in pre-split patch_realtek.c).
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: Patch Discussion**
- Found full discussion on patchew.org. Takashi Iwai reviewed the patch and asked about the necessity of setting gpio_mask/gpio_dir in PRE_PROBE. He proposed a cleaner GPIO helper approach.
- Despite reservations about minor inefficiency, Iwai explicitly stated:
*"I'm going to take your patch for now, but we might need to reconsider the implementation"*.
- The patch was accepted as v1, no subsequent versions.
**Step 4.2: Reviewers**
- Takashi Iwai (ALSA subsystem maintainer) directly reviewed and applied it.
**Step 4.3: Bug Report**
- Bugzilla #221258 — user tested with hda-verb commands setting GPIO mask, direction, and data to confirm the workaround works. The user's manual commands were:
- SET_GPIO_MASK 0x03, SET_GPIO_DIRECTION 0x03, SET_GPIO_DATA 0x03, then toggle
**Step 4.4: Series Context**
- Single standalone patch, not part of a series.
**Step 4.5: Stable Discussion**
- No explicit stable nomination found, but audio quirks are routinely backported.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Functions**
- New: alc662_fixup_csl_amp — only called via the fixup framework for matching PCI SSID
- Uses: alc_update_gpio_data (well-tested existing function, used 14+ times across the driver)
**Step 5.2: Callers**
- Called only by the HDA fixup framework when a device with PCI SSID 0x1022:0xc950 is detected.
**Step 5.3-5.5**: The function follows an identical pattern to alc245_fixup_hp_x360_amp, which is well-established and proven.
## PHASE 6: CROSS-REFERENCING AND STABLE TREE ANALYSIS
**Step 6.1: Buggy Code in Stable**
- The ALC662 codec support exists in all stable trees. The alc662_fixups[] table and alc662_fixup_tbl[] quirk table have been present since early kernel versions.
- The functions used (alc_update_gpio_data, msleep, etc.) exist in all active stable trees.
**Step 6.2: Backport Complications**
- **Key issue**: In 7.0, the driver was split into sound/hda/codecs/realtek/alc662.c. In stable 6.x trees, the equivalent code lives in sound/pci/hda/patch_realtek.c. The patch will need path adjustment but the code structures are identical.
- Record: Minor mechanical adjustment needed for file path; code applies cleanly to older structure.
**Step 6.3: No related fixes already in stable.**
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1**: Subsystem is ALSA/HDA (audio). Criticality: IMPORTANT — audio is essential for desktop/laptop users.
**Step 7.2**: Very actively developed — constant quirk additions for new hardware.
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Who is Affected**
- Users of CSL Unity BF24B all-in-one PCs. Without this quirk, they have **zero audio output**.
**Step 8.2: Trigger Conditions**
- Every boot, every resume from suspend. Audio is completely non- functional without the quirk.
**Step 8.3: Failure Mode Severity**
- Complete loss of audio functionality on the device. Severity: HIGH for affected users.
**Step 8.4: Risk-Benefit Ratio**
- BENEFIT: High — enables audio on a specific PC model that has zero sound without it
- RISK: Very low — 25 lines, only affects one PCI SSID, follows proven patterns, reviewed by subsystem maintainer
- Ratio: Strongly favorable
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: Evidence Summary**
- FOR: Hardware quirk for broken audio; user-filed bugzilla; subsystem maintainer reviewed and applied; follows identical pattern to existing quirks; small and surgical; standalone
- AGAINST: File path needs adjustment for stable (mechanical); Takashi noted minor inefficiency (but accepted anyway)
- UNRESOLVED: Could not access bugzilla directly (anti-bot protection), but bug context confirmed through mailing list discussion
**Step 9.2: Stable Rules Checklist**
1. Obviously correct and tested? **YES** — follows proven pattern, reviewed by maintainer, tested by user with hda-verb
2. Fixes a real bug? **YES** — zero audio output on specific hardware
3. Important issue? **YES** — complete loss of audio functionality
4. Small and contained? **YES** — 25 lines in one file
5. No new features or APIs? **YES** — only a device-specific workaround
6. Can apply to stable? **YES** — needs file path adjustment but code is compatible
**Step 9.3: Exception Category**
- This is a textbook **HARDWARE QUIRK/WORKAROUND** — explicitly listed as a YES exception for stable.
## Verification
- [Phase 1] Parsed tags: Link to bugzilla.kernel.org #221258, signed off by Takashi Iwai (ALSA maintainer)
- [Phase 2] Diff analysis: 25 lines added — new fixup function, enum entry, fixup table entry, quirk table entry
- [Phase 2] Pattern match: alc662_fixup_csl_amp is nearly identical to alc245_fixup_hp_x360_amp at alc269.c:1448-1465
- [Phase 3] git log: file split from patch_realtek.c in aeeb85f26c3bb (Jul 2025), previously moved in 6014e9021b28e
- [Phase 3] git log --author: Zhang Heng has 10+ similar quirk commits in this tree
- [Phase 3] Verified alc_update_gpio_data exists 14 times in pre-split patch_realtek.c
- [Phase 4] Patchew.org: full discussion retrieved; Takashi reviewed, questioned PRE_PROBE gpio_mask but accepted patch
- [Phase 4] Takashi Iwai explicitly stated: "I'm going to take your patch for now"
- [Phase 4] User tested with hda-verb commands confirming GPIO toggle enables audio
- [Phase 5] alc_update_gpio_data is a well-tested exported function used across the driver
- [Phase 6] ALC662 support and fixup infrastructure exist in all active stable trees
- [Phase 6] Backport needs path adjustment:
sound/hda/codecs/realtek/alc662.c → sound/pci/hda/patch_realtek.c
- [Phase 8] Failure mode: complete audio loss on affected hardware, severity HIGH
- UNVERIFIED: Could not directly access bugzilla #221258 (anti-bot protection), but context confirmed via mailing list
This is a textbook hardware quirk addition — small, self-contained, fixes complete audio failure on a specific device, follows proven patterns, reviewed and signed off by the subsystem maintainer. It falls directly into the "quirks and workarounds" exception category that is automatically appropriate for stable.
**YES**
sound/hda/codecs/realtek/alc662.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/hda/codecs/realtek/alc662.c +25 -0
@@ -255,6 +255,25 @@ static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,alc_fixup_headset_mode (codec, fix, action); } +static void alc662_fixup_csl_amp (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : + spec->gpio_mask |=0x03 ; + spec->gpio_dir |=0x03 ; +break ; +case HDA_FIXUP_ACT_INIT : +/* need to toggle GPIO to enable the amp */ +alc_update_gpio_data (codec,0x03 , true); +msleep (100 ); +alc_update_gpio_data (codec,0x03 , false); +break ; + } +} +enum {ALC662_FIXUP_ASPIRE ,ALC662_FIXUP_LED_GPIO1 ,
@@ -313,6 +332,7 @@ enum {ALC897_FIXUP_HEADSET_MIC_PIN2 ,ALC897_FIXUP_UNIS_H3C_X500S ,ALC897_FIXUP_HEADSET_MIC_PIN3 , + ALC662_FIXUP_CSL_GPIO, }; static const struct hda_fixup alc662_fixups[] = {
@@ -766,11 +786,16 @@ static const struct hda_fixup alc662_fixups[] = { { } }, }, + [ALC662_FIXUP_CSL_GPIO ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc662_fixup_csl_amp, + }, };static const struct hda_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1019 ,0x9087 ,"ECS" ,ALC662_FIXUP_ASUS_MODE2 ),SND_PCI_QUIRK (0x1019 ,0x9859 ,"JP-IK LEAP W502" ,ALC897_FIXUP_HEADSET_MIC_PIN3 ), +SND_PCI_QUIRK (0x1022 ,0xc950 ,"CSL Unity BF24B" ,ALC662_FIXUP_CSL_GPIO ),SND_PCI_QUIRK (0x1025 ,0x022f ,"Acer Aspire One" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x0241 ,"Packard Bell DOTS" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x0308 ,"Acer Aspire 8942G" ,ALC662_FIXUP_ASPIRE ),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: stm32: dcmi: stop the dma transfer on overrun
In reply to Sasha LevinFrom: Alain Volmat <[email protected]>
[ Upstream commit 4847286b87ccda7bdec8245f35c07203ce9eb0ed ]
Ensure to stop the dma transfer whenever receiving a overrun to avoid having a buffer partially filled with a frame and partially with the next frame.
---
LLM Generated explanations, may be completely bogus:
Now I have all the necessary information. Let me compile my comprehensive analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: media: stm32: dcmi:
- **Action verb**: "stop" - implies fixing incorrect behavior (not stopping something that should be stopped)
- **Summary**: Stops DMA transfer on hardware overrun to prevent frame data corruption
### Step 1.2: Tags
- Signed-off-by: Alain Volmat <[email protected]> - Author, STMicroelectronics employee (the SoC vendor)
- Signed-off-by: Sakari Ailus <[email protected]> - media subsystem co-maintainer
- Signed-off-by: Mauro Carvalho Chehab <[email protected]> - media subsystem maintainer
- No Fixes: tag, no Reported-by:, no Cc: stable (expected for autosel candidates)
### Step 1.3: Commit Body
The commit explicitly describes data corruption: *"avoid having a buffer partially filled with a frame and partially with the next frame"*. This is frame-level data corruption during video capture. The mechanism is:
when DCMI hardware overruns, DMA continues writing into the active buffer, mixing two different frames.
### Step 1.4: Hidden Bug Fix Detection
Despite using "ensure to stop" rather than "fix", this IS a data corruption fix. The word "ensure" indicates adding a missing safety action. The description of mixed frames in a buffer is a concrete, real- world data corruption scenario.
Record: This is a real data corruption fix disguised with neutral language.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- Single file modified: drivers/media/platform/st/stm32/stm32-dcmi.c
- Function modified: dcmi_irq_thread() (the threaded IRQ handler)
- ~12 lines added, 0 lines removed (net)
- Scope: single-function surgical fix
### Step 2.2: Code Flow Change
**BEFORE**: When IT_OVR (overrun) occurs, the handler just increments counters and falls through. DMA continues to run, potentially filling the buffer with data from the next frame.
**AFTER**: When IT_OVR occurs:
1. Disable DCMI capture (reg_clear(dcmi->regs, DCMI_CR, CR_CAPTURE))
2. Increment counters (existing code)
3. Release spinlock
4. Terminate DMA (dmaengine_terminate_sync)
5. Restart capture cleanly (dcmi_restart_capture)
6. Return IRQ_HANDLED early
### Step 2.3: Bug Mechanism
**Category**: Data corruption / logic fix. The overrun condition means the DCMI FIFO overflowed and data was lost. Without stopping DMA, the buffer ends up with partial frame N data followed by frame N+1 data, delivering a corrupt buffer to userspace.
### Step 2.4: Fix Quality
- **Obviously correct**: Yes - the terminate+restart pattern is already used in dcmi_process_jpeg() in the same file
- **Minimal/surgical**: Yes - only the overrun handler is modified
- **Regression risk**: Low - dmaengine_terminate_sync() is safe in threaded IRQ context; dcmi_restart_capture() has its own internal locking
- **Locking correctness**: Verified - spinlock released before dmaengine_terminate_sync (which may sleep); dcmi_restart_capture takes its own lock internally
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
The overrun handler code was introduced by commit 1be0a2b702308f (2019, v5.2 cycle) which added overrun counting, and the irq thread structure from 37404f91ef8b91 (2017, v4.14 cycle). The buggy behavior (not stopping DMA on overrun) was intentionally introduced by commit a1029f552c3f (2018, v4.17 cycle) titled *"rework overrun/error case"* which REMOVED the DMA stop/restart on overrun. That 2018 commit's rationale was: *"Dma will be restarted on current frame transfer completion."* The new commit reverses this decision because the assumption was wrong - DMA does not properly self-recover on overrun.
### Step 3.2: No Fixes tag present
The implicit Fixes target would be a1029f552c3f ("rework overrun/error case", v4.17) which exists in ALL active stable trees.
### Step 3.3: File History
The dcmi_irq_thread function has been stable since 2019. Recent changes to this file are minor cleanups (style, API renames) that don't affect the overrun path.
### Step 3.4: Author Context
Alain Volmat is from STMicroelectronics (the SoC vendor). He is an active contributor to the STM32 media subsystem, maintaining both DCMI and DCMIPP drivers. The patch was reviewed and signed off by both media subsystem co-maintainers.
### Step 3.5: Dependencies
The patch was submitted as 4/12 in a series. However, patches 1-3 touch unrelated code paths (pm_ptr, dma config at probe, descriptor creation). Patch 5 reworks locking (makes dcmi_restart_capture caller-locked), but patch 4 works correctly with the CURRENT dcmi_restart_capture which has its own internal locking. This patch is self-contained.
---
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: Original Submission
Found at http://lists.infradead.org/pipermail/linux-arm- kernel/2026-January/1091896.html. Part of series v2 "media: stm32:
dcmi: stability & performance enhancements" (12 patches). Cover letter explicitly states: *"This series improve stability of the capture by fixing the handling of the overrun which was leading to captured frame corruption."*
### Step 4.2: Reviewers
Signed off by Sakari Ailus (media co-maintainer) and Mauro Carvalho Chehab (media maintainer). The patch has proper maintainer chain sign- off.
### Step 4.3-4.5: Bug Report / Stable Discussion
The bug was found during development by the hardware vendor (STMicroelectronics). No explicit stable nomination was found, nor any objections.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.2: Function Analysisdcmi_irq_thread is the threaded IRQ handler, called whenever the DCMI hardware fires an interrupt (overrun, error, or frame complete). The IT_OVR flag is set by the hardware when the DCMI internal FIFO overflows. The dcmi_restart_capture → dcmi_start_capture → dcmi_start_dma chain properly sets up a new DMA transfer and re- enables capture.
### Step 5.3-5.4: The DMA stop + restart pattern
The same pattern exists in dcmi_process_jpeg() at line 434-440:dmaengine_terminate_sync followed by dcmi_restart_capture. The overrun fix replicates this proven pattern.
### Step 5.5: Similar Patternsdcmi_process_jpeg already uses the exact same terminate+restart pattern. dcmi_dma_callback also calls dcmi_restart_capture after DMA completion. This is a well-established pattern in the driver.
---
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Buggy Code in Stable
The buggy overrun handler (just counting, not stopping DMA) exists since v4.17 (commit a1029f552c3f). It is present in ALL active stable trees (5.4, 5.10, 5.15, 6.1, 6.6, 6.12).
### Step 6.2: Backport Complications
The patch modifies a single function with clean context. The file path changed from stm32/stm32-dcmi.c to st/stm32/stm32-dcmi.c in 6.5+, but the function code is identical in context. Minor adjustment may be needed for older trees.
### Step 6.3: No related fixes already in stable for this overrun issue.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
- **Subsystem**: drivers/media/platform (embedded camera driver)
- **Criticality**: PERIPHERAL (specific STM32 hardware) but important for embedded/IoT users
- STM32 SoCs are widely used in embedded systems, industrial cameras, IoT devices
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
STM32 DCMI users - embedded systems with camera interfaces on STM32MP1 SoCs.
### Step 8.2: Trigger Conditions
Overrun occurs when the camera sends data faster than DMA can drain the DCMI FIFO. This is common during high-resolution or high-framerate capture, or under system load. Not timing-dependent - it's a hardware FIFO overflow condition.
### Step 8.3: Failure Mode Severity
**Data corruption** - frames delivered to userspace contain mixed data from two different frames. For embedded camera applications (industrial vision, surveillance, medical), this is a **HIGH** severity issue since corrupted frames can lead to incorrect decisions.
### Step 8.4: Risk-Benefit
- **Benefit**: HIGH - prevents data corruption in active video capture on STM32 platforms
- **Risk**: LOW - ~12 lines, single function, follows proven existing pattern in the same driver, correct locking, no API changes
- **Ratio**: Strongly favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes real data corruption (mixed frames in buffer)
- Small, surgical fix (12 lines in one function)
- Follows proven existing pattern in same driver (dcmi_process_jpeg)
- Author is from the hardware vendor (STMicroelectronics)
- Signed off by both media subsystem maintainers
- Correct locking model (spinlock released before sleeping call)
- Buggy code exists in all active stable trees
- Self-contained - does not depend on other patches in the series
**AGAINST backporting:**
- Part of a 12-patch series (but verified standalone correctness)
- Later patches (5, 7) further modify this code (but patch 4 is correct without them)
- No explicit Cc: stable (expected for autosel candidates)
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** - pattern matches existing code in same driver, vendor-tested
2. Fixes a real bug? **YES** - data corruption (mixed frames)
3. Important issue? **YES** - data corruption during video capture
4. Small and contained? **YES** - 12 lines, single function
5. No new features/APIs? **YES** - no new features
6. Can apply to stable? **YES** - code context is unchanged in stable trees
### Step 9.3: No exception categories apply; this is a straightforward bug fix.
---
## Verification
- [Phase 1] Parsed tags: SOBs from author (STMicroelectronics), Sakari Ailus, Mauro Carvalho Chehab
- [Phase 2] Diff analysis: ~12 lines added to overrun path in dcmi_irq_thread(), adds DMA stop + restart
- [Phase 3] git blame: overrun handler code from commit 1be0a2b702308f (2019, v5.2); bug-causing rework from a1029f552c3f (2018, v4.17)
- [Phase 3] git show a1029f552c3f: confirmed it intentionally removed DMA stop/restart on overrun - present in all stable trees
- [Phase 3] Verified dcmi_restart_capture() has internal locking - standalone patch is correct
- [Phase 4] Found original submission at lists.infradead.org; cover letter confirms frame corruption fix
- [Phase 4] Verified patch 5/12 changes dcmi_restart_capture locking, but patch 4 works with current code
- [Phase 4] Patch 7/12 changes terminate_sync to terminate_async - optimization, not required for correctness
- [Phase 5] Verified same pattern (dmaengine_terminate_sync + dcmi_restart_capture) exists in dcmi_process_jpeg() at lines 434-440
- [Phase 5] Verified dcmi_start_capture() re-enables CR_CAPTURE at line 372, matching our clear at overrun
- [Phase 6] Confirmed code exists unchanged in all active stable trees (5.4+)
- [Phase 8] Failure mode: data corruption (mixed frames) - severity HIGH
The fix is small, surgical, follows proven patterns in the same driver, and prevents real data corruption on STM32 embedded platforms.
**YES**
drivers/media/platform/st/stm32/stm32-dcmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/platform/st/stm32/stm32-dcmi.c +12 -0
@@ -447,9 +447,21 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg)spin_lock_irq (&dcmi->irqlock);if (dcmi->misr &IT_OVR ) { +/* Disable capture */ +reg_clear (dcmi->regs,DCMI_CR ,CR_CAPTURE ); + dcmi->overrun_count++; +if (dcmi->overrun_count >OVERRUN_ERROR_THRESHOLD ) dcmi->errors_count++; + +spin_unlock_irq (&dcmi->irqlock); +dmaengine_terminate_sync (dcmi->dma_chan); + +if (dcmi_restart_capture (dcmi)) +dev_err (dcmi->dev,"%s: Cannot restart capture\n" , __func__); + +return IRQ_HANDLED ; }if (dcmi->misr &IT_ERR ) dcmi->errors_count++;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: aoa/onyx: Fix OF node leak on probe failure
In reply to Sasha LevinFrom: wangdicheng <[email protected]>
[ Upstream commit e5d5aef802a5f41283084f7d443ef4fd4b65d86d ]
Add missing of_node_put() in the error path.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the Subject Line
- **Subsystem**: ALSA: aoa/onyx (Apple Onboard Audio, onyx codec)
- **Action verb**: "Fix" — direct bug fix
- **Summary**: Fixes an OF (Open Firmware) device tree node reference leak when the probe function fails
### Step 1.2: Parse All Commit Message Tags
- **Signed-off-by**: wangdicheng <[email protected]> (author)
- **Link**:
https://patch.msgid.link/[email protected]
(patch discussion)
- **Signed-off-by**: Takashi Iwai <[email protected]> (ALSA subsystem maintainer; this means it was reviewed/applied by the maintainer)
- No Fixes: tag (expected — that's why we're reviewing)
- No Cc: stable (expected — that's why we're reviewing)
- No Reported-by (static analysis / code review finding)
### Step 1.3: Analyze the Commit Body Text
The commit body is concise: "Add missing of_node_put() in the error path." This describes a classic OF node reference leak fix. When of_node_get() acquires a reference but the error path doesn't call of_node_put(), the node's reference count is leaked.
### Step 1.4: Detect Hidden Bug Fixes
This is an explicit bug fix, not disguised. The subject says "Fix" and the body confirms a missing cleanup call.
---
## PHASE 2: DIFF ANALYSIS - LINE BY LINE
### Step 2.1: Inventory the Changes
- **File**: sound/aoa/codecs/onyx.c
- **Lines**: +3, -1 (net +2 lines)
- **Function**: onyx_i2c_probe()
- **Scope**: Single-file surgical fix to one error path
### Step 2.2: Understand the Code Flow Change
The key flow in onyx_i2c_probe():
```978:990:sound/aoa/codecs/onyx.c
onyx->codec.init = onyx_init_codec;
onyx->codec.exit = onyx_exit_codec;
onyx->codec.node = of_node_get(node); // acquires OF node
reference
if (aoa_codec_register(&onyx->codec)) {
goto fail; // BEFORE: leaks OF node reference
}
...
fail:
kfree(onyx); // frees memory but doesn't release OF node ref
return -ENODEV;
```**After the fix**: goto fail becomes goto fail_put, which first calls of_node_put(onyx->codec.node) then falls through to fail.
### Step 2.3: Identify the Bug Mechanism
Category: **Reference counting fix / resource leak**. of_node_get() increments the device tree node refcount. If aoa_codec_register() fails, the refcount is never decremented, leaking the OF node.
### Step 2.4: Assess the Fix Quality
- **Obviously correct**: Yes — of_node_get() at line 980 must be balanced by of_node_put() on error. The remove path at line 997 already correctly calls of_node_put().
- **Minimal/surgical**: Yes — only 3 lines added, 1 changed.
- **Regression risk**: Essentially zero. The new label only executes on error paths and merely balances a reference count.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the Changed Lines
The buggy code was introduced by commit f3d9478b2ce468 ("[ALSA] snd-
aoa: add snd-aoa") by Johannes Berg, dated **2006-06-21**. This is the original addition of the entire AOA subsystem. The bug has been present for ~20 years, meaning it exists in **every supported stable tree**.
### Step 3.2: Follow the Fixes Tag
No Fixes: tag present, but the implicit fix target is f3d9478b2ce468 (2006). The same commit was referenced by the related fix 222bce5eb88d1 ("ALSA: snd-aoa: add of_node_put() in error path") which fixed a *similar* OF node leak in sound/aoa/core/gpio-feature.c but did NOT touch onyx.c.
### Step 3.3: Related Changes
- 222bce5eb88d1 — Fixed same bug class in gpio-feature.c (2018), never touched onyx.c
- The sibling codec tas.c has the **exact same bug** at lines 864-875 (acquires of_node_get(node) but goto fail doesn't release it)
### Step 3.4: Author's Other Commits
wangdicheng appears to be contributing fixes across multiple subsystems (KylinOS developer). Takashi Iwai, who applied the patch, is the ALSA subsystem maintainer — adding significant confidence.
### Step 3.5: Dependent/Prerequisite Commits
None. The fix is fully standalone. The code structure (fail label, kfree(onyx)) has been unchanged since 2006.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1-4.5: Patch Discussion
Lore.kernel.org is behind a proof-of-work challenge, and b4 dig couldn't match this commit by patch-id. However, the patch was applied by ALSA maintainer Takashi Iwai directly, which confirms it passed maintainer review. The Link tag provides the message-id for the submission.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
- onyx_i2c_probe() — the I2C driver probe function, called when the device is matched
### Step 5.2: Callersonyx_i2c_probe() is the .probe callback in onyx_driver (i2c_driver struct at line 1012). It is called by the I2C core during device enumeration/binding. This is a standard device probe path.
### Step 5.3-5.4: Reachability
The probe function is called whenever the kernel attempts to bind the onyx I2C codec to its driver. On Apple Mac hardware with this audio codec, this happens during boot. If aoa_codec_register() fails (which can happen — e.g. if the fabric isn't registered yet), this leak triggers.
### Step 5.5: Similar Patterns
As verified, sound/aoa/codecs/tas.c has the **identical bug** (lines 864-875): of_node_get(node) followed by goto fail that doesn't call of_node_put().
---
## PHASE 6: CROSS-REFERENCING AND STABLE TREE ANALYSIS
### Step 6.1: Buggy Code Existence in Stable Trees
The buggy code exists in **all** stable trees. It was introduced in 2006 (f3d9478b2ce468) and has never been fixed.
### Step 6.2: Backport Complications
The file has had minor changes (guard() conversions, alloc_obj macros) but the probe function structure around the error path is essentially unchanged since 2006. The patch should apply **cleanly** to all stable trees, possibly with trivial context adjustments (e.g. kzalloc_obj vs kzalloc).
### Step 6.3: Related Fixes Already in Stable
No. The related 222bce5eb88d1 fix was for gpio-feature.c, not onyx.c.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
- **Subsystem**: ALSA / AOA (Apple Onboard Audio) — driver-specific
- **Criticality**: PERIPHERAL — affects Apple PowerPC/Mac hardware with onyx codecs
- **Maintainer review**: Applied by Takashi Iwai (ALSA maintainer) directly
### Step 7.2: Subsystem Activity
Low activity (last substantive change was treewide refactoring). This is a mature, stable driver.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
Users of Apple Mac hardware with the pcm3052 (onyx) audio codec. This is primarily older PowerPC-based Macs.
### Step 8.2: Trigger Conditions
The leak triggers when aoa_codec_register() fails during probe. This can happen if the AOA fabric isn't registered, or if attach_codec_to_fabric() returns an error. While not extremely common, repeated probe failures (e.g. during deferred probing or error injection) would accumulate leaked OF nodes.
### Step 8.3: Failure Mode Severity
- **Failure mode**: OF node reference count leak (resource leak)
- **Severity**: LOW-MEDIUM — repeated leaks consume memory, and the leaked OF node can never be freed, but this is a one-time probe path, not a hot path
### Step 8.4: Risk-Benefit Ratio
- **Benefit**: Fixes a real resource leak that has existed for 20 years. Trivial to understand and verify.
- **Risk**: Essentially zero — 3 lines added to an error path, one goto target changed
- **Ratio**: Very favorable — minimal risk for a correct bug fix
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Compiled
**FOR backporting:**
- Fixes a real bug: missing of_node_put() causing OF node reference leak
- Extremely small and surgical fix (3 lines added, 1 changed)
- Obviously correct — verified by reading the code and comparing with the remove path
- Applied by ALSA subsystem maintainer (Takashi Iwai)
- Bug exists in all stable trees (introduced in 2006)
- Zero regression risk
- Consistent with similar fixes applied to the same subsystem (222bce5eb88d1)
**AGAINST backporting:**
- Low-severity bug (resource leak, not crash/security/corruption)
- Affects niche hardware (Apple PowerPC Macs)
- Only triggers on probe failure (not common under normal conditions)
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** — trivial fix, applied by maintainer
2. Fixes a real bug? **YES** — OF node reference leak
3. Important issue? **MEDIUM** — resource leak, not critical
4. Small and contained? **YES** — 3 lines, single file, single function
5. No new features or APIs? **YES** — pure fix
6. Can apply to stable trees? **YES** — code unchanged since 2006
### Step 9.3: Exception Categories
None applicable, but this is a standard reference counting bug fix — a very common category for stable backports.
### Step 9.4: Decision
This is a small, obvious, correct fix for a real reference counting bug. While the severity is low (resource leak on error path in niche hardware), the fix carries essentially zero regression risk and meets all stable kernel criteria.
---
## Verification
- [Phase 1] Parsed tags: Signed-off-by author + Takashi Iwai (maintainer), Link tag present
- [Phase 2] Diff analysis: 3 lines added to error path in onyx_i2c_probe(), adds missing of_node_put() after of_node_get() at line 980
- [Phase 3] git blame: buggy code introduced in f3d9478b2ce468 (2006-06-21), present in all stable trees
- [Phase 3] Related fix 222bce5eb88d1: same bug class fixed in gpio- feature.c but NOT in onyx.c
- [Phase 3] Confirmed tas.c has identical unfixed bug at lines 864-875
- [Phase 4] Lore blocked by anti-scraping; b4 dig failed to match. Patch applied by ALSA maintainer confirms review
- [Phase 5] onyx_i2c_probe() is standard I2C probe callback, called during device binding
- [Phase 5] aoa_codec_register() at sound/aoa/core/core.c:57
confirmed: can return error from attach_codec_to_fabric()
- [Phase 6] Code structure unchanged since 2006; patch should apply cleanly to all stable trees
- [Phase 6] No related fix already in stable for this specific file
- [Phase 8] Failure mode: OF node reference leak, severity LOW-MEDIUM; risk of fix: essentially zero
**YES**
sound/aoa/codecs/onyx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/aoa/codecs/onyx.c +3 -1
@@ -980,10 +980,12 @@ static int onyx_i2c_probe(struct i2c_client *client) onyx->codec.node =of_node_get (node);if (aoa_codec_register (&onyx->codec)) { - goto fail; + goto fail_put; } printk(KERN_DEBUG PFX "created and attached onyx instance\n");return 0 ; + fail_put: +of_node_put (onyx->codec.node); fail:kfree (onyx);return -ENODEV ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/bridge: waveshare-dsi: Register and attach our DSI device at probe
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit b8eb97ead862de7a321dd55a901542a372f8f1cd ]
In order to avoid any probe ordering issue, the best practice is to move the secondary MIPI-DSI device registration and attachment to the MIPI-DSI host at probe time.
Besides solving the probe ordering problems, this makes the bridge work with R-Car DU. The R-Car DU will attempt to locate the DSI host bridge in its own rcar_du_probe()->rcar_du_modeset_init()->rcar_du_encoder_init() by calling of_drm_find_bridge() which calls of_drm_find_and_get_bridge() and iterates over bridge_list to locate the DSI host bridge.
However, unless the WS driver calls mipi_dsi_attach() in probe(), the DSI host bridge .attach callback rcar_mipi_dsi_host_attach() is not called and the DSI host bridge is not added into bridge_list. Therefore the of_drm_find_and_get_bridge() called from du_probe() will never find the DSI host bridge and probe will indefinitelly fail with -EPROBE_DEFER.
The circular dependency here is, that if rcar_du_encoder_init() would manage to find the DSI host bridge, it would call the WS driver .attach callback ws_bridge_bridge_attach(), but this is too late and can never happen. This change avoids the circular dependency.
---
LLM Generated explanations, may be completely bogus:
Good - the patch applies cleanly. Now let me complete the analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: drm/bridge: waveshare-dsi:
- **Action verb**: "Register and attach" (moving registration to probe time)
- **Summary**: Moves DSI device registration/attachment from bridge .attach callback to probe() to fix circular probe ordering dependency
Record: [drm/bridge] [register/attach] [move DSI registration to probe to fix probe ordering deadlock]
### Step 1.2: Tags
- **Reviewed-by:** Luca Ceresoli (DRM bridge subsystem co-maintainer, also committer)
- **Signed-off-by:** Marek Vasut (author, well-known Renesas/DRM contributor)
- **Signed-off-by:** Luca Ceresoli (committer)
- **Link:** patch.msgid.link reference
- No Fixes: tag (expected)
- No Cc: stable (expected)
- No Reported-by tag
Record: Reviewed by subsystem maintainer. Author is a well-known kernel developer (Marek Vasut).
### Step 1.3: Commit Body
The commit describes a circular dependency:
1. R-Car DU's rcar_du_encoder_init() calls of_drm_find_bridge() to find the DSI host bridge in bridge_list
2. The DSI host bridge is only added to bridge_list via drm_bridge_add() inside rcar_mipi_dsi_host_attach()
3. rcar_mipi_dsi_host_attach() is only triggered by mipi_dsi_attach()
4. mipi_dsi_attach() (via ws_bridge_attach_dsi()) is only called from ws_bridge_bridge_attach()
5. ws_bridge_bridge_attach() only gets called once the pipeline is assembled - but the pipeline can't be assembled (step 1 fails)
Failure mode: indefinite -EPROBE_DEFER — the driver never successfully probes with R-Car DU.
Record: Real circular dependency causing permanent probe failure. The waveshare bridge cannot work with R-Car DU at all.
### Step 1.4: Hidden Bug Fix Detection
Despite not using "fix" in the subject, this IS a bug fix. "Register and attach... at probe" indicates correcting the timing of a critical operation. The body clearly describes a broken code path resulting in a permanent, unrecoverable probe failure.
Record: Yes, this is a hidden bug fix. Moving DSI registration to probe fixes a real circular dependency.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files**: 1 file changed: drivers/gpu/drm/bridge/waveshare-dsi.c
- **Lines**: +1, -6 (net -5 lines)
- **Functions modified**: ws_bridge_bridge_attach() (removed call), ws_bridge_probe() (added call)
- **Scope**: Single-file surgical fix
Record: Extremely small change — moves 1 function call from one location to another.
### Step 2.2: Code Flow Change
**Hunk 1** (ws_bridge_bridge_attach): Removes the call to ws_bridge_attach_dsi(ws) and its error check. The function now only calls drm_bridge_attach().
**Hunk 2** (ws_bridge_probe): Changes return 0 to return ws_bridge_attach_dsi(ws). DSI registration now happens at probe time.
Record: Before: DSI registration in .attach callback (lazy). After: DSI registration in .probe (eager). This breaks the circular dependency.
### Step 2.3: Bug Mechanism
This is a **probe ordering / circular dependency** fix. The bug category is "logic/correctness fix" — the code called a function at the wrong lifecycle point, creating a deadlock in the probe ordering chain.
Record: Circular dependency between R-Car DU encoder init and waveshare bridge DSI registration. Permanent EPROBE_DEFER.
### Step 2.4: Fix Quality
- Obviously correct: follows the well-established pattern from 6ef7ee48765f (sn65dsi83 bridge)
- Minimal: net -5 lines
- Regression risk: Very low. If the DSI host isn't ready at probe time, ws_bridge_attach_dsi() returns -EPROBE_DEFER and the driver will be re-probed later. All resources use devm_* management.
Record: High quality fix, minimal regression risk.
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
All code in waveshare-dsi.c was introduced by dbdea37add132 (Joseph Guo, Aug 6, 2025). The buggy pattern (DSI registration in .attach instead of .probe) has existed since the driver was first added.
Record: Bug present since driver inception (v6.18 cycle, Aug 2025). Present in 7.0.
### Step 3.2: No Fixes: tag — expected.
### Step 3.3: File History
Only 2 commits exist in 7.0 for this file:
1. dbdea37add132 — driver addition
2. 3e6339a19cfc9 — devm_drm_bridge_alloc bailout fix
In mainline, additional commits follow but are NOT in 7.0:
- b8eb97ead862d — this commit (not in 7.0)
- fca11428425e9 — DSI lanes support (not in 7.0)
- a469749640fbc — signedness bug fix (not in 7.0)
Record: Standalone fix. No prerequisite commits needed. The lanes and signedness commits are independent.
### Step 3.4: Author
Marek Vasut is a very well-known kernel contributor, particularly for Renesas/R-Car and DRM bridge subsystems.
Record: Author is a trusted, experienced kernel contributor.
### Step 3.5: Dependencies
The patch applies cleanly to 7.0 HEAD (verified via git apply --check). No dependencies on other patches.
Record: Clean apply, no dependencies.
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: Patch Discussion
- **b4 dig** found the original submission: v1 on Jan 12, 2026; v2 (applied version) on Feb 6, 2026
- v1 was identical in diff but had a shorter commit message
- Luca Ceresoli (subsystem maintainer) reviewed v1 and asked for a better description of what goes wrong
- v2 added the detailed explanation of the R-Car DU circular dependency
- The v1 message referenced 6ef7ee48765f ("drm/bridge: sn65dsi83:
Register and attach our DSI device at probe") as the precedent
Record: Patch went through v1→v2 review. Applied version is v2 with improved description. Reviewed-by from subsystem maintainer.
### Step 4.2: Recipients
Major DRM bridge maintainers were CC'd: Andrzej Hajda, Laurent Pinchart, Neil Armstrong, Maxime Ripard, Simona Vetter, Thomas Zimmermann, plus dri-devel and linux-renesas-soc lists.
Record: Properly reviewed by appropriate people.
### Step 4.3: Bug Report
No external bug report — author discovered the issue while working with R-Car DU hardware.
### Step 4.4-4.5: No related series or stable discussion found.
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.2: Functions Modified
- ws_bridge_bridge_attach(): Called by DRM framework when attaching bridge to encoder pipeline
- ws_bridge_probe(): Called by I2C subsystem on device match
### Step 5.3-5.4: Call Chain for the Bug
Verified the circular dependency path:
1. rcar_du_encoder_init() → of_drm_find_bridge() → searches bridge_list → NOT FOUND → returns -EPROBE_DEFER (confirmed in rcar_du_encoder.c line 75-77)
2. R-Car DSI bridge only enters bridge_list via drm_bridge_add() at line 943 of rcar_mipi_dsi.c, which is inside rcar_mipi_dsi_host_attach(), which requires mipi_dsi_attach() to be called first
3. Without moving ws_bridge_attach_dsi() to probe, mipi_dsi_attach() never gets called at the right time
Record: Circular dependency fully verified through code inspection.
### Step 5.5: Similar Patterns
The exact same fix was applied to sn65dsi83 bridge in commit 6ef7ee48765f (Oct 2021). This is a well-known pattern.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Code Exists in 7.0
The waveshare-dsi driver exists in 7.0 (added in dbdea37add132, which is in 7.0). The buggy code is present.
Record: Bug exists in 7.0 stable tree.
### Step 6.2: Backport Complications
Patch applies cleanly — verified. The file in 7.0 is at the exact state the patch expects.
Record: Clean apply confirmed.
### Step 6.3: No related fixes already in 7.0.
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem Criticality
DRM bridge driver — PERIPHERAL. Affects only users of waveshare DSI panels on R-Car DU hardware.
Record: PERIPHERAL subsystem, specific hardware combination.
### Step 7.2: Activity
The waveshare-dsi driver is relatively new (Aug 2025) with active development.
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
Users of waveshare DSI2DPI panels connected to R-Car DU display controllers. This is a specific embedded/industrial use case.
Record: Driver-specific, R-Car platform-specific.
### Step 8.2: Trigger Conditions
Every boot on affected hardware. The bug is deterministic — it always triggers. The system will log endless -EPROBE_DEFER messages and the display never works.
Record: 100% trigger rate on affected hardware. Deterministic.
### Step 8.3: Failure Severity
Permanent probe failure — the display hardware never initializes. The bridge never works with R-Car DU. This is a complete functionality failure.
Record: Severity HIGH — complete hardware failure on affected platforms.
### Step 8.4: Risk-Benefit
- **Benefit**: Makes waveshare bridge actually work on R-Car DU (from non-functional to functional)
- **Risk**: Very low — 1 file, net -5 lines, uses devm for cleanup, follows established pattern, reviewed by maintainer. Tested on R-Car hardware by the author.
Record: HIGH benefit for affected users, VERY LOW risk.
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes a real, deterministic bug (circular dependency → permanent EPROBE_DEFER)
- Extremely small fix: 1 file, net -5 lines
- Follows a well-established pattern (same fix applied to sn65dsi83 4+ years ago)
- Reviewed by DRM bridge subsystem maintainer (Luca Ceresoli)
- Author is a trusted senior kernel developer (Marek Vasut)
- Applies cleanly to 7.0 stable
- No dependencies on other commits
- No regression risk (devm-managed resources, EPROBE_DEFER handles ordering)
**AGAINST backporting:**
- Affects a narrow user base (waveshare DSI + R-Car DU)
- No Fixes: tag or Cc: stable (expected — this is why we're reviewing it)
- Could be seen as "enabling hardware" rather than "fixing a regression"
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** — follows established pattern, reviewed by maintainer, tested by author on R-Car
2. Fixes a real bug? **YES** — permanent EPROBE_DEFER, display never works
3. Important issue? **YES** — complete hardware failure (display never initializes)
4. Small and contained? **YES** — 1 file, net -5 lines
5. No new features or APIs? **YES** — just moves an existing call
6. Can apply to stable? **YES** — verified clean apply
### Step 9.3: Exception Categories
Not applicable — this is a straightforward bug fix, not a quirk/device- ID/DT case.
### Step 9.4: Decision
The fix resolves a deterministic probe ordering bug that completely prevents the waveshare DSI bridge from working with R-Car DU. While it affects a narrow user base, the fix is tiny, obviously correct, follows a well-established pattern, and carries essentially zero regression risk. It meets all stable kernel criteria.
## Verification
- [Phase 1] Parsed tags: Reviewed-by Luca Ceresoli, Signed-off-by Marek Vasut, Link to patch.msgid.link
- [Phase 2] Diff analysis: -5 lines removed from ws_bridge_bridge_attach(), +1 line in ws_bridge_probe(), moves ws_bridge_attach_dsi() call
- [Phase 3] git blame: all code introduced in dbdea37add132 (Aug 2025), present in 7.0
- [Phase 3] git log ancestry-path: only 3e6339a19cfc9 (devm_drm_bridge_alloc fix) between driver add and HEAD for this file
- [Phase 3] git merge-base: confirmed dbdea37add132 is in 7.0 tree
- [Phase 3] git branch --contains: b8eb97ead862d NOT in HEAD, is in core-next etc.
- [Phase 4] b4 dig -c b8eb97ead862d: found v2 at https://patch.msgid.lin
k/[email protected]
- [Phase 4] b4 dig -a: v1 (Jan 12, 2026) → v2 (Feb 6, 2026), v2 is applied version
- [Phase 4] b4 dig -w: Proper DRM bridge maintainers were CC'd
- [Phase 4] b4 dig -m: Read full thread — reviewer asked for better description, v2 added it
- [Phase 5] Verified circular dependency: rcar_du_encoder.c line 75-77 returns -EPROBE_DEFER when bridge not found; rcar_mipi_dsi.c line 943 drm_bridge_add() only called from host_attach callback
- [Phase 5] Confirmed sn65dsi83 precedent: commit 6ef7ee48765f exists and is identical pattern
- [Phase 6] git apply --check: patch applies cleanly to 7.0 HEAD
- [Phase 6] fca11428425e9 (lanes) and a469749640fbc (signedness) are independent, not dependencies
- [Phase 8] Failure mode: permanent EPROBE_DEFER on R-Car DU + waveshare DSI — display never works
**YES**
drivers/gpu/drm/bridge/waveshare-dsi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/bridge/waveshare-dsi.c +1 -6
@@ -80,11 +80,6 @@ static int ws_bridge_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) {struct ws_bridge *ws =bridge_to_ws_bridge (bridge); -int ret; - - ret =ws_bridge_attach_dsi (ws); -if (ret) -return ret;return drm_bridge_attach (encoder, ws->next_bridge, &ws->bridge, flags);
@@ -179,7 +174,7 @@ static int ws_bridge_probe(struct i2c_client *i2c) ws->bridge.of_node = dev->of_node;devm_drm_bridge_add (dev, &ws->bridge); -return 0 ; +return ws_bridge_attach_dsi (ws); }static const struct of_device_id ws_bridge_of_ids[] = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rtw89: retry efuse physical map dump on transient failure
In reply to Sasha LevinFrom: Christian Hewitt <[email protected]>
[ Upstream commit d92f6ad6483e6d430c8273eeb7be97ce85244bd5 ]
On Radxa Rock 5B with a RTL8852BE combo WiFi/BT card, the efuse physical map dump intermittently fails with -EBUSY during probe. The failure occurs in rtw89_dump_physical_efuse_map_ddv() where read_poll_timeout_atomic() times out waiting for the B_AX_EF_RDY bit after 1 second.
The root cause is a timing race during boot: the WiFi driver's chip initialization (firmware download via PCIe) overlaps with Bluetooth firmware download to the same combo chip via USB. This can leave the efuse controller temporarily unavailable when the WiFi driver attempts to read the efuse map.
The firmware download path retries up to 5 times, but the efuse read that follows has no similar logic. Address this by adding retry loop logic (also up to 5 attempts) around physical efuse map dump.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a thorough analysis. Here is the complete walkthrough:
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: wifi: rtw89 (Realtek 802.11ax wireless driver)
- **Action verb**: "retry" — indicates adding resilience to a failure path
- **Summary**: Adds retry logic for efuse physical map dump to handle transient -EBUSY failures
### Step 1.2: Tags
- **Signed-off-by**: Christian Hewitt (author), Ping-Ke Shih (rtw89 maintainer who applied it)
- **Link**: https://patch.msgid.link/20260317112155.1939569-1- [email protected] — original submission
- No Fixes: tag (expected for autosel candidate)
- No Cc: stable (expected)
- No Reported-by: — the author is the reporter/user himself
### Step 1.3: Commit Body Analysis
- **Bug description**: On Radxa Rock 5B with RTL8852BE combo WiFi/BT, efuse physical map dump intermittently fails with -EBUSY during probe.
- **Symptom**: read_poll_timeout_atomic() times out (1 second) waiting for B_AX_EF_RDY bit in rtw89_dump_physical_efuse_map_ddv().
- **Root cause**: Timing race during boot — WiFi chip initialization (firmware download via PCIe) overlaps with Bluetooth firmware download via USB to the same combo chip. The efuse controller becomes temporarily unavailable.
- **Fix approach**: Add retry loop (up to 5 attempts), matching the firmware download retry pattern already in the driver.
### Step 1.4: Hidden Bug Fix Detection
This is explicitly described as a real bug fix — probe fails intermittently, WiFi doesn't work. The commit message is clear about the failure mechanism.
Record: Real probe-time failure on real hardware. Not a hidden fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files changed**: 1 (drivers/net/wireless/realtek/rtw89/efuse.c)
- **Lines**: +19 added (new retry wrapper), minimal structural change
- **Functions modified**: rtw89_dump_physical_efuse_map() renamed to __rtw89_dump_physical_efuse_map(), new wrapper rtw89_dump_physical_efuse_map() with retry logic
- **Scope**: Single-file, surgical fix
### Step 2.2: Code Flow Change
**Before**: rtw89_dump_physical_efuse_map() calls DDV or DAV path once. If the efuse controller is busy (-EBUSY), it fails immediately and the caller propagates the error up, causing probe to fail.
**After**: The original function is renamed to __rtw89_dump_physical_efuse_map(). A new wrapper calls it in a loop (up to 5 times). On success, returns immediately. On failure, logs a warning and retries.
### Step 2.3: Bug Mechanism
**Category**: Hardware timing/resource contention during probe.
- The efuse controller is shared between WiFi and BT on combo chips
- BT firmware download via USB can hold the controller busy
- The DDV read path polls for B_AX_EF_RDY for up to 1 second, then fails
- Without retry, a transient busy state becomes a permanent probe failure
### Step 2.4: Fix Quality
- **Obviously correct**: Yes — retry on transient error is a well- established pattern
- **Minimal**: Yes — 19 lines, pure wrapper function
- **Regression risk**: Very low — only adds retries on an already- failing path; success path is unchanged (returns immediately on first !ret)
- **Pattern consistency**: Exactly matches rtw89_fw_download() at fw.c:1980 which already does for (retry = 0; retry < 5; retry++) around __rtw89_fw_download()
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
- The DDV efuse read code (rtw89_dump_physical_efuse_map_ddv) was introduced in commit e3ec7017f6a20d (v5.16-rc4, Oct 2021 — initial rtw89 driver)
- The wrapper rtw89_dump_physical_efuse_map() with DAV split came from bdfbf06c2c286d (v5.18 era, Mar 2022)
- The buggy code has been present since the driver was introduced
### Step 3.2: Fixes Tag
No Fixes: tag present. The bug is effectively a design limitation from the original driver — no retry logic was ever added for efuse reads, while firmware download had retry from the beginning.
### Step 3.3: File History
Recent changes to efuse.c are all WiFi 7 feature additions (efuse version reading, secure boot info). The core rtw89_dump_physical_efuse_map() function has been unchanged since v5.18. No prerequisites needed.
### Step 3.4: Author Check
- Christian Hewitt is the patch author (user who hit the bug on Radxa Rock 5B)
- Ping-Ke Shih is the rtw89 maintainer who signed off and applied the patch
- Maintainer sign-off provides strong confidence in the fix
### Step 3.5: Dependencies
- **No dependencies**: The patch modifies only the wrapper function and introduces no new structures, types, or dependencies
- The function signature matches all stable trees v6.1+
- In v5.16-5.17, the function signature differs (no dav parameter), requiring minor adaptation
---
## PHASE 4: MAILING LIST RESEARCH
b4 dig could not find the commit (it's a single-patch submission, not in the local tree). Lore is blocking automated access. However:
- The patch was submitted from [email protected] on 2026-03-17
- Applied by Ping-Ke Shih (rtw89 maintainer)
- The Link: tag confirms it was submitted through normal mailing list flow
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Functions Modified
- rtw89_dump_physical_efuse_map() (renamed to __ prefix, wrapped)
### Step 5.2: Callers
The wrapper rtw89_dump_physical_efuse_map() is called from 5 locations, all during probe:
1. rtw89_parse_efuse_map_ax() — twice (physical + DAV map)
2. rtw89_parse_phycap_map_ax() — once
3. rtw89_read_efuse_ver() — once
4. rtw89_efuse_read_fw_secure_ax() — once
All are invoked through chip->ops->parse_efuse_map and chip->ops->parse_phycap_map during device initialization.
### Step 5.3/5.4: Impact
If any of these callers fail, the WiFi device fails to probe — it becomes completely non-functional. The function is on the critical path for device initialization.
### Step 5.5: Similar Patterns
The exact same retry pattern already exists at fw.c:1980 for rtw89_fw_download(). This establishes precedent within the driver.
---
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Code Exists in Stable Trees
- **v5.16+**: The efuse DDV code exists (the core buggy path)
- **v5.18+**: The DDV/DAV split wrapper exists (matching the patch context)
- **v6.1, v6.6, v6.12**: The exact function rtw89_dump_physical_efuse_map() exists with identical signature and body
- RTL8852BE support has been present since v6.1
### Step 6.2: Backport Complications
The rtw89_dump_physical_efuse_map() function is **byte-for-byte identical** across v6.1, v6.6, v6.12, and mainline. The patch will apply cleanly to all active stable trees.
### Step 6.3: No Existing Fix
No related fix for this same issue exists in any stable tree.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
- **Subsystem**: Network drivers (wireless) — Realtek rtw89
- **Criticality**: IMPORTANT — WiFi connectivity affects many users, especially on SBCs and laptops
### Step 7.2: Activity
- rtw89 is actively developed with regular updates
- Ping-Ke Shih (Realtek) is the active maintainer
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
Users with RTL8852BE and other Realtek combo WiFi/BT cards on any platform where WiFi and BT firmware download can overlap during boot. The Radxa Rock 5B is specifically mentioned but any combo card could be affected.
### Step 8.2: Trigger Conditions
- **Trigger**: Boot with both WiFi and BT enabled on a combo Realtek chip
- **Frequency**: "Intermittently" — depends on boot timing
- **Unprivileged**: N/A — this is a probe-time issue, not user-triggered
### Step 8.3: Severity
- **Failure mode**: Complete WiFi probe failure — device doesn't work at all
- **Severity**: HIGH — total loss of WiFi functionality
- No crash or data corruption, but complete feature loss
### Step 8.4: Risk-Benefit Ratio
- **Benefit**: HIGH — prevents intermittent probe failures on real hardware
- **Risk**: VERY LOW — 19 lines, pure retry wrapper, success path unchanged, follows existing driver pattern
- **Ratio**: Strongly favorable for backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting**:
- Fixes a real probe failure on real hardware (Radxa Rock 5B, RTL8852BE)
- Small, self-contained, obviously correct (19 lines, single file)
- Follows an existing pattern in the same driver (rtw89_fw_download retry loop)
- Applied with maintainer sign-off (Ping-Ke Shih)
- No dependencies — standalone fix
- Applies cleanly to all active stable trees (v6.1+)
- When the bug triggers, WiFi is completely non-functional
- Combo WiFi/BT timing race is a generic issue affecting multiple boards
**AGAINST backporting**:
- No Fixes: tag or Cc: stable (expected, not a negative signal)
- Could be seen as adding "new logic" rather than fixing existing logic
- The failure is intermittent, not 100% reproducible
### Step 9.2: Stable Rules Checklist
1. **Obviously correct and tested?** YES — retry pattern is well- established, maintainer-approved
2. **Fixes a real bug?** YES — intermittent probe failure causes total WiFi loss
3. **Important issue?** YES — complete loss of WiFi connectivity during probe
4. **Small and contained?** YES — 19 lines, 1 file, pure wrapper
5. **No new features or APIs?** Correct — no new features, only resilience
6. **Can apply to stable?** YES — verified identical function across v6.1, v6.6, v6.12
### Step 9.3: Exception Category
Not an exception category — this is a standard bug fix.
### Step 9.4: Decision
The fix is small, surgical, obviously correct, follows an existing pattern, fixes a real hardware issue causing complete WiFi loss, and was approved by the subsystem maintainer. The risk-benefit ratio strongly favors backporting.
---
## Verification
- [Phase 1] Parsed tags: Signed-off-by from Christian Hewitt (author) and Ping-Ke Shih (maintainer). Link to patch.msgid.link.
- [Phase 2] Diff analysis: 19 lines added — renames existing function with __ prefix, wraps it in retry loop (up to 5 attempts). No behavioral change on success path.
- [Phase 3] git blame: Buggy code (no retry) introduced in e3ec7017f6a20d (v5.16-rc4, initial rtw89 driver, Oct 2021). Present in all stable trees since v5.16.
- [Phase 3] git blame: Wrapper function with DAV split introduced in bdfbf06c2c286d (v5.18 era). Present in v6.1+.
- [Phase 3] git log: No related fixes to this issue exist in history.
- [Phase 3] Author: Christian Hewitt is an external contributor; Ping-Ke Shih (Realtek, rtw89 maintainer) signed off.
- [Phase 4] b4 dig: Could not find commit in local tree. Lore blocked by anti-bot measures. Confirmed patch was submitted via normal mailing list flow (Link: tag present).
- [Phase 5] Grep callers: rtw89_dump_physical_efuse_map() called from 5 locations, all in probe path (parse_efuse_map, parse_phycap_map, read_efuse_ver, read_fw_secure). Failure = total probe failure.
- [Phase 5] Pattern match: Identical retry pattern exists at fw.c:1980 (rtw89_fw_download() wrapping __rtw89_fw_download() with for (retry = 0; retry < 5; retry++)).
- [Phase 6] Verified function exists identically in v6.1, v6.6, v6.12 by git show of each tag. Patch applies cleanly.
- [Phase 6] RTL8852BE PCI entry (9695dc2e4be90) present since v6.1.
- [Phase 6] efuse.c in v5.16 has different signature (no dav param); backport to 5.x would need rework.
- [Phase 8] Failure mode: Complete WiFi probe failure — device non- functional. Severity: HIGH.
- UNVERIFIED: Could not access lore.kernel.org discussion for reviewer feedback or stable nominations (anti-bot blocking). This does not change the decision — the fix is technically sound independent of reviewer commentary.
**YES**
drivers/net/wireless/realtek/rtw89/efuse.c | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/efuse.c +21 -2
@@ -185,8 +185,8 @@ static int rtw89_dump_physical_efuse_map_dav(struct rtw89_dev *rtwdev, u8 *map,return 0 ; } -static int rtw89_dump_physical_efuse_map (struct rtw89_dev *rtwdev,u8 *map, -u32 dump_addr,u32 dump_size,bool dav) +static int __rtw89_dump_physical_efuse_map (struct rtw89_dev *rtwdev,u8 *map, +u32 dump_addr,u32 dump_size,bool dav) {int ret;
@@ -208,6 +208,25 @@ static int rtw89_dump_physical_efuse_map(struct rtw89_dev *rtwdev, u8 *map,return 0 ; } +static int rtw89_dump_physical_efuse_map (struct rtw89_dev *rtwdev,u8 *map, +u32 dump_addr,u32 dump_size,bool dav) +{ +int retry; +int ret; + +for (retry =0 ; retry <5 ; retry++) { + ret =__rtw89_dump_physical_efuse_map (rtwdev, map, dump_addr, + dump_size, dav); +if (!ret) +return 0 ; + +rtw89_warn (rtwdev,"efuse dump (dav=%d) failed, retrying (%d)\n" , + dav, retry); + } + +return ret; +} +#define invalid_efuse_header (hdr1, hdr2) \ ((hdr1) == 0xff || (hdr2) == 0xff)#define invalid_efuse_content (word_en, i) \
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 netfilter: nfnetlink_queue: make hash table per queue
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 936206e3f6ff411581e615e930263d6f8b78df9d ]
Sharing a global hash table among all queues is tempting, but it can cause crash:
BUG: KASAN: slab-use-after-free in nfqnl_recv_verdict+0x11ac/0x15e0 [nfnetlink_queue] [..] nfqnl_recv_verdict+0x11ac/0x15e0 [nfnetlink_queue] nfnetlink_rcv_msg+0x46a/0x930 kmem_cache_alloc_node_noprof+0x11e/0x450
struct nf_queue_entry is freed via kfree, but parallel cpu can still encounter such an nf_queue_entry when walking the list.
Alternative fix is to free the nf_queue_entry via kfree_rcu() instead, but as we have to alloc/free for each skb this will cause more mem pressure.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
include/net/netfilter/nf_queue.h | 1 - net/netfilter/nfnetlink_queue.c | 139 +++++++++++-------------------- 2 files changed, 49 insertions(+), 91 deletions(-)
include/net/netfilter/nf_queue.h +0 -1
@@ -23,7 +23,6 @@ struct nf_queue_entry {struct nf_hook_state state;bool nf_ct_is_unconfirmed;u16 size;/* sizeof(entry) + saved route keys */ -u16 queue_num;/* extra space to store route keys */ };
net/netfilter/nfnetlink_queue.c +49 -90
248 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 gpio: cgbc: normalize return value of gpio_get
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 49621f1c97788216f2f10f1a9e903f216e289f5d ]
The GPIO get callback is expected to return 0 or 1 (or a negative error code). Ensure that the value returned by cgbc_gpio_get() is normalized to the [0, 1] range.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a complete analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: gpio: cgbc:
- Action verb: "normalize" (implies correcting incorrect behavior)
- Summary: Normalizes the return value of the GPIO get callback to the [0, 1] range
**Step 1.2: Tags**
- Signed-off-by: Dmitry Torokhov - author, prolific kernel/input/GPIO contributor
- Link: to lore patch submission
- Signed-off-by: Bartosz Golaszewski - GPIO subsystem maintainer who applied it
- No Fixes: tag, no Cc: stable tag (but sibling patches in the same series DO have these tags)
**Step 1.3: Commit Body**
- Clearly states the API contract: GPIO get callback must return 0, 1, or negative error
- States the driver violates this by returning non-normalized values (e.g., 2, 4, 8, etc.)
- The fix "normalizes" to [0, 1]
**Step 1.4: Hidden Bug Fix Detection**
- YES - this is a bug fix. The driver violates the gpio_chip API contract. With the gpiolib sanitization commit (86ef402d805d) present in v6.15+, this violation causes either -EBADE errors or runtime warnings.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- 1 file changed: drivers/gpio/gpio-cgbc.c
- 2 lines removed, 2 lines added (net 0 change)
- Function modified: cgbc_gpio_get()
- Scope: single-file, single-function surgical fix
**Step 2.2: Code Flow Change**
- BEFORE: return (int)(val & (u8)BIT(offset)); — returns the raw bit value (could be 1, 2, 4, 8, 16, 32, 64, 128)
- AFTER: return !!(val & BIT(offset)); — returns 0 or 1
- Also removes unnecessary else after return ret
**Step 2.3: Bug Mechanism**
- Category: Logic/correctness fix (API contract violation)
- The BIT(offset) for offset > 0 yields values > 1 (BIT(1)=2, BIT(2)=4, etc.)
- The old code masks val with BIT(offset), returning the bit's position value rather than 0/1
- With gpiolib sanitize (86ef402d805d in v6.15+), returning values > 1 triggers -EBADE or a warning
**Step 2.4: Fix Quality**
- Obviously correct: !! is the standard C idiom for boolean normalization
- Minimal/surgical: 2-line change in a single function
- Zero regression risk: !! can only produce 0 or 1, which is exactly what's expected
- The fix is identical in pattern to all 6 other patches in the series
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: Blame**
- The buggy return (int)(val & (u8)BIT(offset)) line was introduced by commit 4342bf63b64b0 (Thomas Richard, 2024-10-01) when the cgbc GPIO driver was first created in v6.13-rc1.
**Step 3.2: Fixes Target**
- The commit doesn't have a Fixes: tag, but the sibling patches reference Fixes: 86ef402d805d ("gpiolib: sanitize the return value of gpio_chip::get()"), which was added in v6.15-rc1.
**Step 3.3: Related Changes**
- This is part of a 7-patch series by Dmitry Torokhov, all normalizing gpio_get return values across different drivers.
- The gpiolib core workaround (ec2cceadfae72) landed in v7.0-rc2, adding normalization + warning in gpiolib itself.
- The cgbc_gpio_get function has been unchanged since its creation — no conflicting changes.
**Step 3.4: Author**
- Dmitry Torokhov is a highly respected kernel developer (input subsystem maintainer, Google). He reported the problem with the gpiolib sanitize commit and contributed the driver-side fixes.
**Step 3.5: Dependencies**
- The fix touches only cgbc_gpio_get() which is unchanged since the driver was created. No dependencies on any other patches.
- The diff applies cleanly to any tree containing the cgbc driver (v6.13+).
## PHASE 4: MAILING LIST RESEARCH
**Step 4.1: Original Patch Discussion**
- Patch 2/7 in series [PATCH 1/7] gpio: bd9571mwv: normalize return value of gpio_get
- 11 messages in thread. Applied by Bartosz Golaszewski (GPIO maintainer).
- Discussion revealed Dmitry recommended reverting 86ef402d805d for stable but keeping it for 7.0. Bartosz instead sent ec2cceadfae72 to normalize in gpiolib core (with Cc: stable).
**Step 4.2: Reviewers**
- Applied directly by Bartosz Golaszewski (GPIO subsystem maintainer)
- No explicit Reviewed-by on the cgbc patch, but the entire series was applied together
**Step 4.3-4.5: Bug Context**
- The underlying issue is well-documented: commit 86ef402d805d broke many GPIO drivers that returned non-normalized values. The cgbc driver is one of them.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1-5.4: Function Analysis**
- cgbc_gpio_get() is the .get callback for the cgbc GPIO chip, assigned at probe time (line 173)
- It's called by gpiolib core (gpiochip_get()) whenever any consumer reads this GPIO
- For Congatec Board Controller GPIO, this affects 14 GPIO pins (pins 0-13)
- Pins with offset > 0 would return values > 1, triggering the bug
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: Code Existence in Stable**
- cgbc driver: exists in v6.13+ stable trees
- gpiolib sanitize (86ef402d805d): exists in v6.15+ stable trees
- gpiolib normalize workaround (ec2cceadfae72, Cc: stable): exists in v7.0, will be backported to v6.15+
**Step 6.2: Backport Complexity**
- The cgbc_gpio_get() function is IDENTICAL in all stable trees from v6.13 onwards
- The patch applies cleanly to any tree with the cgbc driver
**Step 6.3: Impact Matrix**
- **v6.13-v6.14 stable**: Driver exists, sanitize check absent. Bug is latent (no user-visible effect since gpiolib didn't check). Low priority.
- **v6.15+ stable**: Driver AND sanitize check exist. Without
ec2cceadfae72: driver returns -EBADE for pins > 0 (broken!). With ec2cceadfae72 but without this fix: driver works but triggers a warning on every gpio_get for pins 1-13.
## PHASE 7: SUBSYSTEM CONTEXT
- Subsystem: GPIO (drivers/gpio/) - IMPORTANT, used by many embedded/SBC platforms
- The Congatec Board Controller is used in embedded industrial computing
- Criticality: PERIPHERAL (specific hardware), but users of this hardware depend on it
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Affected Users**
- Users of Congatec Board Controller hardware with GPIO
**Step 8.2: Trigger Conditions**
- Any read of GPIO pins 1-13 (offset > 0) triggers the bug
- This is a normal operation path, not an edge case
**Step 8.3: Failure Severity**
- Without gpiolib workaround: GPIO reads return error (-EBADE) for most pins → MEDIUM-HIGH (driver broken)
- With gpiolib workaround: Warning emitted on every read → LOW-MEDIUM (functional but noisy)
**Step 8.4: Risk-Benefit**
- BENEFIT: Fixes incorrect driver behavior, eliminates runtime warnings, prevents potential breakage
- RISK: Virtually zero — !! normalization is trivially correct
- RATIO: Very favorable
## PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
1. Fixes a real API contract violation that causes warnings or errors in v6.15+ trees
2. 2-line change, trivially correct (!! normalization)
3. Sibling patches in the same series have Fixes: and Cc: stable tags
4. Applied by GPIO subsystem maintainer
5. Author is a top-tier kernel developer
6. Zero regression risk
7. Clean apply to all stable trees containing the driver
**Evidence AGAINST backporting:**
1. The gpiolib core workaround (ec2cceadfae72) already handles this at the framework level
2. No explicit Fixes: or Cc: stable on this specific patch
3. For v6.13-v6.14 where the sanitize check doesn't exist, the bug is latent
**Stable Rules Checklist:**
1. Obviously correct? YES — !! is trivially correct
2. Fixes a real bug? YES — API violation causing errors/warnings
3. Important issue? MEDIUM — driver broken or warning-spewing without fix
4. Small and contained? YES — 2 lines in 1 function
5. No new features? Correct — pure bug fix
6. Applies to stable? YES — cleanly
## Verification
- [Phase 1] Parsed tags: Signed-off-by Dmitry Torokhov and Bartosz Golaszewski, Link to patch submission
- [Phase 2] Diff analysis: 2 lines changed in cgbc_gpio_get(), (int)(val & (u8)BIT(offset)) → !!(val & BIT(offset))
- [Phase 3] git blame: buggy code introduced in 4342bf63b64b0 (v6.13-rc1), present in stable 6.13+
- [Phase 3] git show 86ef402d805d: confirmed sanitize commit in v6.15-rc1, makes non-[0,1] returns an error
- [Phase 3] git show ec2cceadfae72: confirmed gpiolib normalize workaround in v7.0-rc2 with Cc: stable
- [Phase 3] git tag --contains: verified cgbc in v6.13+, sanitize in v6.15+, normalize in v7.0
- [Phase 3] git diff shows cgbc_gpio_get() unchanged since driver creation — clean apply
- [Phase 4] b4 mbox: found 11-message thread, all 7 patches applied by Bartosz Golaszewski
- [Phase 4] Mailing list discussion: Dmitry recommended reverting sanitize for stable; Bartosz instead sent gpiolib normalize fix
- [Phase 4] Sibling patches (e2fa075d5ce19, 2bb995e6155cb, fb22bb9701d48) all have Fixes: 86ef402d805d and Cc: stable
- [Phase 5] cgbc_gpio_get() is the .get callback called by gpiolib on every GPIO read
- [Phase 6] Confirmed driver exists in 6.13+ and sanitize check in 6.15+; patch applies cleanly
- [Phase 8] For offset > 0, BIT(offset) yields values 2-128; returning these violates API and triggers warnings/errors
The fix is small, surgical, trivially correct, and eliminates incorrect API behavior that causes runtime warnings in stable trees. The sibling patches explicitly target stable. The absence of Cc: stable on this specific patch appears to be an oversight or inconsistency within the series.
**YES**
drivers/gpio/gpio-cgbc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-cgbc.c +2 -2
@@ -47,8 +47,8 @@ static int cgbc_gpio_get(struct gpio_chip *chip, unsigned int offset)if (ret)return ret; -else -return (int )(val & (u8 )BIT (offset)); + +return !!(val &BIT (offset)); } static int __cgbc_gpio_set(struct gpio_chip *chip, unsigned int offset,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 HID: logitech-hidpp: Check bounds when deleting force-feedback effects
In reply to Sasha LevinFrom: Günther Noack <[email protected]>
[ Upstream commit e606d8329be1e19b7eb3e0c6c72a73cbbb25ae3d ]
Without this bounds check, this might otherwise overwrite index -1.
Triggering this condition requires action both from the USB device and from userspace, which reduces the scenarios in which it can be exploited.
---
LLM Generated explanations, may be completely bogus:
## Analysis
### PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Parse subject line**
Record: Subsystem HID: logitech-hidpp:, action verb Check (adding a missing check). Summary: add missing bounds-check when deleting force- feedback effects.
**Step 1.2: Parse commit message tags**
Record:
- Cc: Lee Jones <[email protected]> (HID area reviewer, not stable)
- Signed-off-by: Günther Noack <[email protected]> (author - Google security engineer)
- Reviewed-by: Lee Jones <[email protected]>
- Signed-off-by: Jiri Kosina <[email protected]> (HID maintainer)
- **NOT** present: Cc: [email protected], Fixes:, Reported- by:, Link:
- No syzbot, no user bug report, no sanitizer report
**Step 1.3: Analyze commit body**
Record: Author describes a missing bounds check that "might otherwise overwrite index -1". Explicitly notes reduced exploitability:
"Triggering this condition requires action both from the USB device and from userspace, which reduces the scenarios in which it can be exploited." This is a security-hardening fix with an author-acknowledged limited attack surface.
**Step 1.4: Hidden bug fix?**
Record: Not hidden at all - clearly a bug fix (missing bounds check preventing OOB write). The "Check bounds" phrasing is classic stable- style bug fix language.
### PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
Record: 1 file modified: drivers/hid/hid-logitech-hidpp.c. 9 lines added, 6 removed. Single function modified: hidpp_ff_work_handler(), single switch case: HIDPP_FF_DESTROY_EFFECT. Classification: single- file surgical fix.
**Step 2.2: Code flow change**
Record:
- BEFORE: In HIDPP_FF_DESTROY_EFFECT, unconditionally writes data->effect_ids[wd->params[0]-1] = -1 when effect_id >= 0. No bounds check on wd->params[0].
- AFTER: First reads slot = wd->params[0], then wraps the writes in if (slot > 0 && slot <= data->num_effects).
- This is an error-path / invalid-state handling fix, but on a normal runtime path.
**Step 2.3: Bug mechanism**
Record: Category (f) Memory safety - bounds check added. Specific
mechanism: wd->params[0] is set by hidpp_ff_find_effect() (line 2478), which returns 0 when the requested effect_id is not present in data->effect_ids[]. For HIDPP_FF_EFFECTID_AUTOCENTER, it's set to data->slot_autocenter (initially 0 before autocenter is uploaded). When params[0] == 0, the expression params[0] - 1 promotes through int arithmetic to -1, causing data->effect_ids[-1] = -1 - an out-of- bounds write of a fixed value -1 at index -1 of a kzalloc-allocated int* array. The analogous HIDPP_FF_DOWNLOAD_EFFECT case (lines 2493-2502) already contains the exact same defensive check if (slot > 0 && slot <= data->num_effects)
- this fix restores symmetry.
**Step 2.4: Fix quality**
Record: Obviously correct - mirrors existing defensive check from the same function's DOWNLOAD case. Minimal/surgical. Zero regression risk:
the added condition only suppresses an invalid index write; it doesn't restrict any legitimate behavior. No red flags.
### PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: git blame**
Record: The buggy HIDPP_FF_DESTROY_EFFECT handler was introduced by commit ff21a635dd1a9c (Edwin Velds, 2016-01-11) "HID: logitech-hidpp:
Force feedback support for the Logitech G920". git describe --contains places it at v4.6-rc1~107^2^4~1 - first appeared in v4.6. The code has been stable for ~10 years and is present in every supported stable tree.
**Step 3.2: Follow Fixes: tag**
Record: No Fixes: tag in the commit, but git blame identifies the introducing commit as ff21a635dd1a9c (v4.6). That original commit is in all stable trees that fork from ≥v4.6, which is every currently- supported stable tree (5.4, 5.10, 5.15, 6.1, 6.6, 6.12, 6.19).
**Step 3.3: Related recent changes**
Record: Recent related work:
- f7a4c78bfeb32 (Feb 2026) - Lee Jones, "Prevent use-after-free on force feedback initialisation failure" - UAF fix in same FF path, no Cc: stable.
- 1547d41f9f19d (Jan 2026) - Günther Noack, "Check maxfield in hidpp_get_report_length()" - hardening fix, **has** Cc: stable.
- This commit is standalone and self-contained; not part of a series (b4 dig -a shows only v1).
**Step 3.4: Author's other commits**
Record: Günther Noack (Google) has been actively hardening HID drivers against malicious/fake USB devices: HID: asus: avoid memory leak, HID: magicmouse: Do not crash on missing msc->input (+Cc stable), HID: prodikeys: Check presence of pm->input_ep82 (+Cc stable), `HID:
logitech-hidpp: Check maxfield in hidpp_get_report_length()` (+Cc stable). Author is credible, security-focused, and knows stable conventions.
**Step 3.5: Dependencies**
Record: No dependencies. Standalone, self-contained fix.
### PHASE 4: MAILING LIST / EXTERNAL RESEARCH
**Step 4.1: b4 dig original submission**
Record: b4 dig -c e606d8329be1e returned a single-message thread at h ttps://lore.kernel.org/all/[email protected]/. b4 dig -a confirms only v1 was posted - no revision history.
**Step 4.2: Recipients**
Record: b4 dig -w shows patch was sent to Filipe Laíns, Bastien Nocera, Jiri Kosina (HID maintainer), Benjamin Tissoires (HID co- maintainer), Lee Jones, [email protected], linux- [email protected]. Appropriate audience.
**Step 4.3: Bug report**
Record: No bug report referenced; no syzbot/KASAN/KMSAN tag. Appears to be a code-audit / hardening finding by the author.
**Step 4.4: Thread discussion**
Record: Thread saved to /tmp/hidpp_thread.mbox. Contents:
- Lee Jones: "LGTM. Reviewed-by: Lee Jones <[email protected]>"
- Jiri Kosina: "Applied, thanks."
- **No reviewer suggested Cc: stable**. No NAKs, no concerns raised.
**Step 4.5: Stable-list discussion**
Record: No evidence of prior stable-list discussion for this particular bug.
### PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Functions in diff**
Record: Only hidpp_ff_work_handler() (switch case HIDPP_FF_DESTROY_EFFECT).
**Step 5.2: Callers / trigger path**
Record: hidpp_ff_work_handler is the workqueue callback scheduled by hidpp_ff_queue_work(). The DESTROY path is queued by hidpp_ff_erase_effect() (line 2712), which is assigned to ff->erase (line 2877). ff->erase is the standard input-layer callback invoked when userspace calls EVIOCRMFF ioctl on /dev/input/eventX of the FF device. So the buggy code is reachable via a standard userspace ioctl on any user with access to the device node (typically needs input group membership, or root).
**Step 5.3: Callees**
Record: hidpp_ff_find_effect() iterates data->effect_ids[] and returns i+1 if found, 0 otherwise. The return value 0 directly causes the params[0]-1 = -1 OOB when the destroy command proceeds.
**Step 5.4: Reachability**
Record: Buggy path is reachable from userspace: EVIOCRMFF ioctl → ff->erase → hidpp_ff_erase_effect → hidpp_ff_queue_work(HIDPP_FF_DESTROY_EFFECT) → workqueue → hidpp_ff_work_handler. Needs a Logitech HID++ FF-capable device (e.g., G920 wheel) and a userspace condition that erases an effect not present in the driver's tracking array (race between operations, stale effect_id, or autocenter destroy before upload).
**Step 5.5: Similar patterns**
Record: The same function already has the correct pattern in HIDPP_FF_DOWNLOAD_EFFECT (lines 2494-2502): slot = response.fap.params[0]; if (slot > 0 && slot <= data->num_effects) { ... }. This fix brings DESTROY into symmetry with DOWNLOAD.
### PHASE 6: CROSS-REFERENCING AND STABLE TREE ANALYSIS
**Step 6.1: Buggy code in stable trees?**
Record: The buggy code was added in v4.6 (Jan 2016) and is virtually unchanged since then (blame shows only a whitespace/comment tweak in 2024). Present in every supported stable tree: 5.4.y, 5.10.y, 5.15.y, 6.1.y, 6.6.y, 6.12.y, 6.19.y.
**Step 6.2: Backport complications**
Record: Minimal. Recent churn in the function: Yan Zhen (2024, comment typo fix) and Lee Jones (2026, adjacent UAF fix in init path - not this function). The switch statement body targeted by this patch is identical to what has been in the tree since 2016. Clean apply expected on all stable branches, modulo trivial context adjustments.
**Step 6.3: Related fixes in stable**
Record: No prior fix for this specific OOB. Some adjacent FF hardening (UAF fix f7a4c78bfeb32) exists in mainline but also lacks Cc: stable.
### PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: Subsystem criticality**
Record: drivers/hid/hid-logitech-hidpp.c - HID driver for specific Logitech HID++ devices (G920 wheel, MX mice, etc.). Classification:
PERIPHERAL (hardware-specific driver), but FF is a userspace-reachable subsystem where games commonly issue erase/upload ioctls, so realistic number of users on systems with a G920/G923 wheel.
**Step 7.2: Subsystem activity**
Record: Actively developed, with a mix of feature additions (new device support) and security hardening (see Günther Noack's string of commits). Mature codebase.
### PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Affected users**
Record: Users of Logitech HID++ FF-capable devices (G920/G923 wheels and similar). Not universal - driver-specific. Requires the device to be plugged in and a userspace FF client (game, test tool, etc.).
**Step 8.2: Trigger conditions**
Record: Author states "requires action both from the USB device and from userspace." In practice: userspace invokes EVIOCRMFF with an effect_id that the driver cannot find in data->effect_ids[] (e.g., effect never uploaded, already erased, or device returned unexpected slot) AND the device responds successfully to the destroy command. Not triggerable by an unprivileged attacker alone; requires access to the evdev node.
**Step 8.3: Failure mode**
Record: Out-of-bounds write of the fixed value -1 (0xFFFFFFFF) at index -1 of the kzalloced data->effect_ids[] array (an int *). This corrupts 4 bytes immediately before the allocation - likely slab metadata / redzone or an adjacent slab object. Severity: HIGH (memory corruption), but with limited exploitability because (a) both value and offset are fixed (not attacker-controlled), (b) requires non-trivial combination of device + userspace state. Not directly security-critical as a remote/local privilege escalation primitive, but an unambiguous memory-safety bug.
**Step 8.4: Benefit/risk**
Record:
- BENEFIT: Fixes a 10-year-old memory-corruption bug in a userspace- reachable code path. Medium-low because the trigger is narrow, but non-zero - silent slab corruption can manifest as hard-to-debug crashes.
- RISK: Extremely low. 9-line purely additive bounds-check that mirrors an existing check in the same function. Zero regression potential on normal operation.
- Ratio: Low benefit but near-zero risk → favorable for stable.
### PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
- Clear out-of-bounds memory write (OOB pattern - recognized stable category).
- Bug present in all stable trees since v4.6 (2016).
- Fix is 9 lines, in a single function, obviously correct.
- Mirrors existing defensive check in the same function (HIDPP_FF_DOWNLOAD_EFFECT).
- Reviewed by Lee Jones; applied by HID maintainer Jiri Kosina.
- Author is a security-focused developer doing ongoing HID hardening.
- Clean apply expected on all stable branches.
- Zero regression risk.
**Evidence AGAINST backporting:**
- Author explicitly noted reduced exploitability ("requires action both from the USB device and from userspace").
- Author did NOT include Cc: [email protected], despite including it on several similar HID hardening commits in the same timeframe. This is a deliberate signal from a stable-aware author.
- No Fixes: tag, no bug report, no syzbot/KASAN evidence of real-world triggers.
- Trigger requires specific hardware (Logitech FF wheel) + specific userspace sequence.
- Bug has been present 10 years without reported user impact.
**Stable rules checklist:**
1. Obviously correct and tested? YES - mirrors existing pattern; reviewed and applied.
2. Fixes a real bug? YES - OOB write is a real memory-safety bug.
3. Important issue? BORDERLINE - memory corruption but with narrow, non- attacker-controlled trigger.
4. Small and contained? YES - 9 insertions, 6 deletions, one function.
5. No new features? YES - pure defensive check.
6. Applies cleanly? YES - expected clean on all active stable branches.
**Exception categories:** Not applicable (not a device- ID/quirk/DT/build/doc fix).
**Decision rationale:**
This is a borderline case. Technically, it is a legitimate memory-safety fix for a bug in userspace-reachable code that has been in the tree for a decade. The patch is small, obviously correct, and zero-risk. OOB writes are a canonical stable-backport category per the rule set.
The strongest counter-signal is the author's deliberate omission of `Cc:
stable while including it on peer hardening patches, combined with the explicit statement about limited exploitability. However, per the task instructions, the absence of Cc: stable` is explicitly NOT a negative signal, and the technical criteria for stable are met.
Weighing the risk (near-zero) against the benefit (fixes a real OOB write, even if rarely triggered), this is the kind of defensive bounds- check fix that stable trees routinely accept. Memory corruption with a hardcoded value at a hardcoded offset is still memory corruption.
### Verification
- [Phase 1] Parsed tags from commit message: found Signed-off-by (Noack, Kosina), Reviewed-by (Jones), Cc (Jones). No Cc: stable, no Fixes:, no Reported-by:, no Link:.
- [Phase 2] Diff analysis: 9 lines added, 6 removed, single file, single function (hidpp_ff_work_handler), single case (HIDPP_FF_DESTROY_EFFECT). Confirmed by git show e606d8329be1e.
- [Phase 2] Confirmed symmetry with existing check in HIDPP_FF_DOWNLOAD_EFFECT by reading drivers/hid/hid-logitech- hidpp.c lines 2493-2511.
- [Phase 3] git blame -L 2502,2515 drivers/hid/hid-logitech-hidpp.c:
buggy code introduced by ff21a635dd1a9c (Edwin Velds, 2016-01-11).
- [Phase 3] git describe --contains ff21a635dd1a9c:
v4.6-rc1~107^2^4~1 (present since v4.6, 2016).
- [Phase 3] git log --author="[email protected]" --oneline: confirmed author's pattern of HID hardening work, including Cc: stable-tagged peer commits (17abd396, cee8337e, 1547d41f).
- [Phase 4] b4 dig -c e606d8329be1e: matched single thread at lore.kernel.org/all/[email protected]/.
- [Phase 4] b4 dig -a: only v1 was posted - no revisions.
- [Phase 4] b4 dig -w: recipients include HID maintainers (Kosina, Tissoires) and linux-input.
- [Phase 4] Read saved mbox /tmp/hidpp_thread.mbox: Lee Jones gave Reviewed-by, Jiri Kosina said "Applied, thanks." No stable request or concerns raised.
- [Phase 5] Confirmed reachability: hidpp_ff_erase_effect() wired to ff->erase (line 2877), reachable via EVIOCRMFF ioctl. Confirmed hidpp_ff_find_effect returns 0 when effect not found (line 2457).
- [Phase 5] Confirmed the buggy params[0]-1 = -1 path when the returned slot is 0.
- [Phase 6] Confirmed ff21a635dd1a9c pre-dates all active stable branches (branch points are all after v4.6).
- [Phase 7] Subsystem drivers/hid/ - PERIPHERAL driver for specific Logitech HID++ devices with FF.
- [Phase 8] Failure mode: OOB write of fixed value -1 at fixed offset -1 → slab corruption, severity HIGH but limited exploitability primitive.
- UNVERIFIED: Did not run per-branch apply test on each stable tree, but the function body is unchanged since 2016 so clean apply is highly likely.
- UNVERIFIED: Could not find any user-reported crash or bug report pointing to this specific OOB (no bug-tracker links in the commit message or on the mailing list).
The fix is small, obviously correct, low-risk, and addresses a real out- of-bounds write in a userspace-reachable path. Even with the author's deliberate omission of Cc: stable, the technical stable criteria are met, and bounds-check fixes of this nature are routinely backported.
**YES**
drivers/hid/hid-logitech-hidpp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/hid/hid-logitech-hidpp.c +9 -6
@@ -2502,12 +2502,15 @@ static void hidpp_ff_work_handler(struct work_struct *w) }break ;case HIDPP_FF_DESTROY_EFFECT : -if (wd->effect_id >=0 ) -/* regular effect destroyed */ - data->effect_ids[wd->params[0 ]-1 ] =-1 ; -else if (wd->effect_id >=HIDPP_FF_EFFECTID_AUTOCENTER ) -/* autocenter spring destroyed */ - data->slot_autocenter =0 ; + slot = wd->params[0 ]; +if (slot >0 && slot <= data->num_effects) { +if (wd->effect_id >=0 ) +/* regular effect destroyed */ + data->effect_ids[slot-1 ] =-1 ; +else if (wd->effect_id >=HIDPP_FF_EFFECTID_AUTOCENTER ) +/* autocenter spring destroyed */ + data->slot_autocenter =0 ; + }break ;case HIDPP_FF_SET_GLOBAL_GAINS : data->gain = (wd->params[0 ] <<8 ) + wd->params[1 ];
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 x86: shadow stacks: proper error handling for mmap lock
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit 52f657e34d7b21b47434d9d8b26fa7f6778b63a0 ]
김영민 reports that shstk_pop_sigframe() doesn't check for errors from mmap_read_lock_killable(), which is a silly oversight, and also shows that we haven't marked those functions with "__must_check", which would have immediately caught it.
So let's fix both issues.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
arch/x86/kernel/shstk.c | 3 ++- include/linux/mmap_lock.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/shstk.c +2 -1
@@ -351,7 +351,8 @@ static int shstk_pop_sigframe(unsigned long *ssp) need_to_check_vma =PAGE_ALIGN (*ssp) == *ssp;if (need_to_check_vma) -mmap_read_lock_killable (current->mm); +if (mmap_read_lock_killable (current->mm)) +return -EINTR ; err =get_shstk_data (&token_addr, (unsigned long __user *)*ssp);if (unlikely (err))
include/linux/mmap_lock.h +3 -3
@@ -322,7 +322,7 @@ static inline void mmap_write_lock_nested(struct mm_struct *mm, int subclass)__mmap_lock_trace_acquire_returned (mm, true, true); } -static inline int mmap_write_lock_killable (struct mm_struct *mm) +static inline int __must_check mmap_write_lock_killable (struct mm_struct *mm) {int ret;
@@ -369,7 +369,7 @@ static inline void mmap_read_lock(struct mm_struct *mm)__mmap_lock_trace_acquire_returned (mm, false, true); } -static inline int mmap_read_lock_killable (struct mm_struct *mm) +static inline int __must_check mmap_read_lock_killable (struct mm_struct *mm) {int ret;
@@ -379,7 +379,7 @@ static inline int mmap_read_lock_killable(struct mm_struct *mm)return ret; } -static inline bool mmap_read_trylock (struct mm_struct *mm) +static inline bool __must_check mmap_read_trylock (struct mm_struct *mm) {bool ret;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 sched: Fix incorrect schedstats for rt and dl thread
In reply to Sasha LevinFrom: Dengjun Su <[email protected]>
[ Upstream commit c0e1832ba6dad7057acf3f485a87e0adccc23141 ]
For RT and DL thread, only 'set_next_task_(rt/dl)' will call 'update_stats_wait_end_(rt/dl)' to update schedstats information. However, during the migration process, 'update_stats_wait_start_(rt/dl)' will be called twice, which will cause the values of wait_max and wait_sum to be incorrect. The specific output as follows:
$ cat /proc/6046/task/6046/sched | grep wait wait_start : 0.000000 wait_max : 496717.080029 wait_sum : 7921540.776553
A complete schedstats information update flow of migrate should be __update_stats_wait_start() [enter queue A, stage 1] ->__update_stats_wait_end() [leave queue A, stage 2] ->__update_stats_wait_start() [enter queue B, stage 3] ->__update_stats_wait_end() [start running on queue B, stage 4]
Stage 1: prev_wait_start is 0, and in the end, wait_start records the time of entering the queue.
Stage 2: task_on_rq_migrating(p) is true, and wait_start is updated to the waiting time on queue A.
Stage 3: prev_wait_start is the waiting time on queue A, wait_start is the time of entering queue B, and wait_start is expected to be greater than prev_wait_start. Under this condition, wait_start is updated to (the moment of entering queue B) - (the waiting time on queue A). Stage 4: the final wait time = (time when starting to run on queue B)
- (time of entering queue B) + (waiting time on queue A) = waiting time on queue B + waiting time on queue A.
The current problem is that stage 2 does not call __update_stats_wait_end to update wait_start, which causes the final computed wait time = waiting time on queue B + the moment of entering queue A, leading to incorrect wait_max and wait_sum.
Add 'update_stats_wait_end_(rt/dl)' in 'update_stats_dequeue_(rt/dl)' to update schedstats information when dequeue_task.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a thorough analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: sched (core scheduler)
- **Action verb**: "Fix"
- **Summary**: Fixes incorrect schedstats wait_max and wait_sum for RT and DL tasks during migration
Record: [sched] [fix] [incorrect schedstats for RT/DL threads during migration]
### Step 1.2: Tags
- Signed-off-by: Dengjun Su <[email protected]> - author from MediaTek
- Signed-off-by: Peter Zijlstra (Intel) <[email protected]> - scheduler maintainer accepted the patch
- `Link: https://patch.msgid.link/20260204115959.3183567-1-
[email protected]` - patch submission link
- No Fixes: tag (expected for our review pipeline)
- No Cc: stable tag (expected)
- No Reported-by (author discovered it themselves)
Record: Accepted by Peter Zijlstra, the primary scheduler maintainer. Single patch (not a series).
### Step 1.3: Commit Body Analysis
The commit provides a detailed 4-stage explanation of how wait accounting should work during migration:
1. Enter queue A: wait_start = time of entering
2. Leave queue A (migration): wait_start should be updated to "wait time on A"
3. Enter queue B: wait_start adjusted by subtracting "wait time on A"
4. Start running on B: final wait = time on B + time on A
**The bug**: Stage 2 is missing for RT/DL — update_stats_wait_end is not called during dequeue, so the raw timestamp from Stage 1 persists. This causes __update_stats_wait_start in Stage 3 to compute an absurdly large value (subtracting a timestamp from a timestamp, rather than a delta from a timestamp), resulting in wildly incorrect wait_max (496717ms) and wait_sum (7921540ms) values.
Record: Bug is clearly described with a concrete demonstration of incorrect output. The root cause (missing update_stats_wait_end call during dequeue) is clearly identified.
### Step 1.4: Hidden Bug Fix?
This is explicitly a bug fix, not disguised.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- kernel/sched/rt.c: +5 lines, -1 line (net +4)
- kernel/sched/deadline.c: +3 lines, 0 removed (net +3)
- Functions modified: update_stats_dequeue_rt(), update_stats_dequeue_dl()
- Scope: Surgical fix to two parallel functions
### Step 2.2: Code Flow Change
**RT (update_stats_dequeue_rt):**
- Before: Only recorded sleep/block stats on DEQUEUE_SLEEP
- After: Also calls update_stats_wait_end_rt() when p != rq->curr before the existing sleep/block handling
**DL (update_stats_dequeue_dl):**
- Before: Only recorded sleep/block stats on DEQUEUE_SLEEP
- After: Also calls update_stats_wait_end_dl() when p != rq->curr before the existing sleep/block handling
### Step 2.3: Bug Mechanism
This is a **logic/correctness bug** — the RT and DL scheduler classes were missing the update_stats_wait_end call in their update_stats_dequeue functions, which the fair scheduler class already has. Looking at the fair scheduler reference:
```1420:1446:kernel/sched/fair.c
update_stats_dequeue_fair(struct cfs_rq *cfs_rq, struct sched_entity
*se, int flags)
{
if (!schedstat_enabled())
return;
if (se != cfs_rq->curr)
update_stats_wait_end_fair(cfs_rq, se); // <-- THIS WAS MISSING
IN RT/DL
if ((flags & DEQUEUE_SLEEP) && entity_is_task(se)) {
// ... sleep/block stats
}
}
```The fix adds the identical pattern to RT and DL.
### Step 2.4: Fix Quality
- **Obviously correct**: Directly parallels the CFS implementation
- **Minimal/surgical**: 7 net lines added across 2 files
- **Regression risk**: Extremely low — calls update_stats_wait_end_rt/dl which is already an existing function; the p != rq->curr guard ensures it only operates on waiting tasks (not the running task). Furthermore, __update_stats_wait_end has built-in migration handling (sets wait_start = delta and returns early when task_on_rq_migrating).
## PHASE 3: GIT HISTORY
### Step 3.1: Blame
Both update_stats_dequeue_rt and update_stats_dequeue_dl were entirely introduced by:
- 57a5c2dafca8e ("sched/rt: Support schedstats for RT sched class") - Sep 2021
- b5eb4a5f6521d ("sched/dl: Support schedstats for deadline sched class") - Sep 2021
Both merged in **v5.16-rc1**. The bug has been present since v5.16.
### Step 3.2: Fixes Target
No explicit Fixes: tag, but the bug clearly traces to 57a5c2dafca8 and b5eb4a5f6521d.
### Step 3.3: File History
No other commits have touched the update_stats_dequeue_rt/dl functions since their introduction (the DL server schedstat fix 9c602adb799e7 only changed __schedstats_from_dl_se() and the wait_start/wait_end wrappers, not update_stats_dequeue_dl).
### Step 3.4: Author
Dengjun Su from MediaTek. First contribution to the scheduler subsystem. However, the patch is accepted by Peter Zijlstra, the scheduler maintainer, which is a strong quality signal.
### Step 3.5: Dependencies
This patch is standalone. It only adds calls to existing functions (update_stats_wait_end_rt, update_stats_wait_end_dl) that are already present in all stable trees since v5.16. No prerequisite patches needed.
Note: For stable trees < v6.12, the DL side might need minor adaptation because 9c602adb799e7 (v6.12) changed the DL schedstats wrapper pattern. In older trees, update_stats_wait_end_dl takes different parameter styles, but the fix concept is the same.
## PHASE 4: MAILING LIST
b4 dig could not find the original submission. The Link: tag points to patch.msgid.link which serves lore content. The patch was accepted by Peter Zijlstra, the primary scheduler maintainer, which is a strong endorsement.
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Modified Functions
- update_stats_dequeue_rt() — called from dequeue_rt_entity()
- update_stats_dequeue_dl() — called from dequeue_task_dl() (indirectly via dequeue_dl_entity)
### Step 5.2: Callers
- update_stats_dequeue_rt is called from dequeue_rt_entity() (rt.c:1414), which is called from dequeue_task_rt() — this is the main RT task dequeue path, triggered on every RT task dequeue (migration, sleep, etc.)
- update_stats_dequeue_dl is called from code in deadline.c at the dequeue_dl_entity path
### Step 5.4: Reachability
The buggy code path is triggered whenever an RT or DL task migrates between CPUs. This is common in multi-core systems with RT workloads, especially when using CPU affinity changes or load balancing.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Buggy Code in Stable
The buggy code was introduced in v5.16. It exists in all active stable
trees: 6.1.y, 6.6.y, 6.12.y, etc.
### Step 6.2: Backport Complications
For the RT side: The update_stats_dequeue_rt function has been unchanged since v5.16 in all stable trees. The patch should apply cleanly.
For the DL side: Commit 9c602adb799e7 (v6.12) changed the DL schedstat wrapper pattern. For stable trees < 6.12 (i.e., 6.6.y, 6.1.y), the update_stats_dequeue_dl function has schedstat_enabled() check inline rather than in the wrapper. A minor context adjustment may be needed, but the fix is conceptually identical.
### Step 6.3: No other fix for this bug exists in stable.
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
- kernel/sched/ — **CORE** subsystem (scheduler)
- Scheduler statistics (schedstat) are used by performance monitoring tools and reported via /proc/[pid]/sched
### Step 7.2: Activity
The scheduler is one of the most actively developed subsystems.
## PHASE 8: IMPACT AND RISK
### Step 8.1: Affected Users
- All users running RT or DL tasks on multi-core systems with schedstat enabled
- This affects monitoring/debugging workflows for real-time systems (embedded, audio, industrial)
### Step 8.2: Trigger Conditions
- Task migration of RT/DL tasks (common on multi-core systems)
- schedstat must be enabled (common for monitoring)
### Step 8.3: Failure Mode
- **Incorrect statistics**: wait_max and wait_sum report wildly inflated values (shown: 496717ms wait_max)
- Severity: **MEDIUM** — no crash or data corruption, but provides misleading scheduling statistics that could cause incorrect tuning decisions for real-time systems
### Step 8.4: Risk-Benefit
- **Benefit**: Corrects misleading scheduler statistics for RT/DL tasks during migration. Important for real-time system monitoring.
- **Risk**: Very low — 7 lines, follows exact CFS pattern, only affects statistics (not scheduling decisions), guarded by schedstat_enabled() and p != rq->curr.
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes a real, demonstrable bug (incorrect schedstat values shown in commit message)
- Small, surgical fix (7 net lines)
- Obviously correct — mirrors the existing fair scheduler pattern exactly
- Accepted by Peter Zijlstra, the primary scheduler maintainer
- Bug has existed since v5.16 (affects all active stable trees)
- No dependencies on other patches
- Very low regression risk (statistics-only code path)
- Standalone single patch
**AGAINST backporting:**
- No crash/security/corruption — only incorrect statistics
- No Reported-by (single author, may not be widely noticed)
- Statistics correctness is a lower priority than crash fixes
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** — mirrors CFS pattern, accepted by maintainer
2. Fixes a real bug? **YES** — incorrect schedstat values for RT/DL on migration
3. Important issue? **MEDIUM** — not a crash, but incorrect diagnostic data for real-time systems
4. Small and contained? **YES** — 7 lines across 2 files
5. No new features/APIs? **YES** — no new features
6. Can apply to stable? **YES** — standalone fix, may need minor context adjustment for < 6.12
### Step 9.3: Exception Categories
Not an exception category — this is a standard correctness bug fix.
### Step 9.4: Decision
This is a clear, correct bug fix that affects scheduler statistics for RT and DL tasks. While not a crash or security fix, it corrects meaningfully wrong data that users rely on for real-time performance monitoring. The fix is tiny, obviously correct (mirrors CFS), accepted by the scheduler maintainer, and has essentially zero regression risk. It meets all stable kernel criteria.
## Verification
- [Phase 1] Parsed tags: Signed-off-by Peter Zijlstra (scheduler maintainer), Link to patch.msgid.link
- [Phase 2] Diff analysis: +5 lines in rt.c, +3 lines in deadline.c; adds update_stats_wait_end_rt/dl() calls matching CFS pattern
- [Phase 2] Verified CFS reference: update_stats_dequeue_fair (fair.c:1420-1446) calls update_stats_wait_end_fair with se != cfs_rq->curr guard — RT/DL fix mirrors this exactly
- [Phase 2] Verified __update_stats_wait_end (stats.c:21-46) has task_on_rq_migrating handling that preserves delta as wait_start — the mechanism described in commit message
- [Phase 3] git blame: update_stats_dequeue_rt introduced by 57a5c2dafca8 (v5.16-rc1), untouched since
- [Phase 3] git blame: update_stats_dequeue_dl introduced by b5eb4a5f6521 (v5.16-rc1), untouched since
- [Phase 3] git describe: Both original commits in v5.16-rc1 — bug present in all stable trees (6.1.y, 6.6.y, 6.12.y)
- [Phase 3] Author check: Dengjun Su has no prior scheduler commits, but patch accepted by PeterZ
- [Phase 4] b4 dig failed to find submission; lore.kernel.org blocked by anti-scraping
- [Phase 5] Callers: update_stats_dequeue_rt called from dequeue_rt_entity() (verified at rt.c:1414); update_stats_dequeue_dl called during DL dequeue path
- [Phase 6] 9c602adb799e7 (v6.12) changed DL wrapper pattern — may need minor backport adjustment for 6.6.y/6.1.y
- [Phase 8] Failure mode: incorrect wait_max/wait_sum in /proc/[pid]/sched, severity MEDIUM
**YES**
kernel/sched/deadline.c | 4 ++++ kernel/sched/rt.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
kernel/sched/deadline.c +4 -0
@@ -2142,10 +2142,14 @@ update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se, int flags) {struct task_struct *p =dl_task_of (dl_se); +struct rq *rq =rq_of_dl_rq (dl_rq);if (!schedstat_enabled ())return ; +if (p != rq->curr) +update_stats_wait_end_dl (dl_rq, dl_se); +if ((flags &DEQUEUE_SLEEP )) {unsigned int state;
kernel/sched/rt.c +6 -1
@@ -1302,13 +1302,18 @@ update_stats_dequeue_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, int flags) {struct task_struct *p =NULL ; +struct rq *rq =rq_of_rt_rq (rt_rq);if (!schedstat_enabled ())return ; -if (rt_entity_is_task (rt_se)) +if (rt_entity_is_task (rt_se)) { p =rt_task_of (rt_se); +if (p != rq->curr) +update_stats_wait_end_rt (rt_rq, rt_se); + } +if ((flags &DEQUEUE_SLEEP ) && p) {unsigned int state;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: pcie: don't dump on reset handshake in dump
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 4a481720106d6bad1521d0e0322fd74fa2f6c464 ]
When a FW dump happens, possibly even because of a reset handshake timeout, there's no point in attempting to dump again. Since all the callers of the function outside the transport itself are from the FW dump infrastructure, just split the internal function and make the external one not dump on timeout.
---
LLM Generated explanations, may be completely bogus:
Now I have a complete picture of the call chain. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: wifi: iwlwifi: pcie: (Intel WiFi PCIe transport layer)
- **Action verb**: "don't dump" - this is preventing incorrect behavior (a bug fix)
- **Summary**: Prevent triggering a firmware dump when a reset handshake timeout occurs during an already-in-progress firmware dump
Record: [wifi: iwlwifi: pcie] [prevent/avoid] [Don't recursively trigger FW dump on reset handshake timeout during dump collection]
### Step 1.2: Tags
- **Signed-off-by**: Johannes Berg (author, iwlwifi maintainer)
- **Reviewed-by**: Emmanuel Grumbach (key iwlwifi developer)
- **Signed-off-by**: Miri Korenblit (iwlwifi submitter)
- **Link**: patch.msgid.link URL (lore-blocked by Anubis)
- No Fixes: tag (expected), no Reported-by, no Cc: stable
Record: Written by the iwlwifi maintainer, reviewed by another senior iwlwifi developer. No explicit stable nomination.
### Step 1.3: Commit Body Analysis
The message explains: When a FW dump happens (possibly due to a reset handshake timeout), there's no point in attempting to dump again. External callers of iwl_trans_pcie_fw_reset_handshake() are all from the FW dump infrastructure, so the fix splits the internal function and makes the external one not trigger a dump on timeout.
Record: Bug = recursive dump attempt when reset handshake times out during dump. Symptom = attempting to dump from within dump context (potential hang/deadlock). Root cause = all external callers are from dump infrastructure but the function unconditionally triggers a new dump on timeout.
### Step 1.4: Hidden Bug Fix Detection
This is explicitly described as preventing incorrect behavior. The "don't dump" phrasing directly describes fixing a problematic code path. Not hidden.
Record: This is a clear bug fix - preventing recursive dumps that can cause system instability.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files changed**: 1 (drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans-gen2.c)
- **Lines changed**: ~10 added, ~3 removed (net ~7 lines)
- **Functions modified**: iwl_trans_pcie_fw_reset_handshake() refactored into _iwl_trans_pcie_fw_reset_handshake() + wrapper; _iwl_trans_pcie_gen2_stop_device() updated to call internal version
- **Scope**: Single-file surgical fix
### Step 2.2: Code Flow Change
- **Before**: iwl_trans_pcie_fw_reset_handshake() always calls iwl_op_mode_dump_error() on timeout with !reset_done. All callers (both from dump infrastructure and from stop_device) get the same behavior.
- **After**: Internal _iwl_trans_pcie_fw_reset_handshake(trans, dump_on_timeout) takes a parameter. External callers (from dump infrastructure via iwl_trans_pcie_fw_reset_handshake()) get dump_on_timeout=false. Internal caller (_iwl_trans_pcie_gen2_stop_device) passes dump_on_timeout=true.
### Step 2.3: Bug Mechanism
The call chain for the bug:
1. FW dump starts via iwl_fw_dbg_collect_sync() → iwl_fw_error_ini_dump() → iwl_dump_ini_file_gen() → iwl_dump_ini_trigger() → calls iwl_trans_pcie_fw_reset_handshake()
2. If handshake times out, old code calls iwl_op_mode_nic_error() and iwl_op_mode_dump_error()
3. iwl_op_mode_dump_error() → iwl_mvm_dump_error() → iwl_fw_error_collect() → triggers another dump
4. This is a **recursive dump attempt from within dump context** - at minimum wasteful, potentially causing deadlocks or hangs
Record: [Logic/correctness fix] [Recursive dump trigger: the function triggers a new dump on timeout even when already called from within the dump infrastructure]
### Step 2.4: Fix Quality
- Obviously correct: the parameter cleanly separates the two behaviors
- Minimal and surgical: only changes the necessary function and its callers
- No regression risk: internal caller preserves original behavior (dump_on_timeout=true), external callers gain new safe behavior (dump_on_timeout=false)
- No API changes: external function signature is unchanged
Record: High quality fix. Minimal regression risk. Obviously correct.
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
- The function was originally introduced in commit 906d4eb84408a4 (Dec 2020) as a static function
- It was made public (non-static, exported) in 85ccbdc4d3930f (Feb 2025, v6.15)
- The dump-triggering code on timeout was added in 7391b2a4f7dbb7 (Dec 2024, "rework firmware error handling")
- Additional external callers added in bb6d4dc9d3f624 (Apr 2025, v6.16)
Record: Bug introduced when 85ccbdc4d3930f (v6.15) made the function public and called it from the dump infrastructure. The dump-on-timeout behavior was present from 7391b2a4f7dbb7 but harmless when function was static (only called from stop_device, not from dump context).
### Step 3.2: Fixes Tag
No Fixes: tag present (expected).
### Step 3.3: File History
Recent commits to this file include several fixes: 43049a3c00c8c (fix non-MSIX handshake register), eda36f5195d6c (reinit device properly during TOP reset), e5d110fec068c (fix locking on invalid TOP reset). This area is actively being fixed.
Record: Active area with multiple recent fixes. Standalone fix - no series dependencies.
### Step 3.4: Author
Johannes Berg is THE iwlwifi maintainer - the primary author and maintainer of the entire iwlwifi subsystem.
Record: Author is the subsystem maintainer. Maximum authority.
### Step 3.5: Dependencies
The fix requires 85ccbdc4d3930f (makes function public) and 7391b2a4f7dbb7 (adds dump-on-timeout logic) to be present. Both are in v6.15+.
Record: Depends on code from v6.15+. Can apply standalone within that constraint.
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1-4.5
Lore.kernel.org is protected by Anubis anti-bot measures. The Link: in the commit message points to the patch discussion. The patch was submitted as part of a series through the iwlwifi maintainer tree. It was reviewed by Emmanuel Grumbach (Reviewed-by tag), a senior iwlwifi developer.
Record: Could not access lore directly. Patch was reviewed and approved through normal iwlwifi workflow.
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.4: Function Call Tracing
The external function iwl_trans_pcie_fw_reset_handshake() is called from:
1. fw/dbg.c:2714 - during split dump (IWL_FW_INI_APPLY_POLICY_SPLIT_DUMP_RESET)
2. fw/dbg.c:2722 - during non-split dump with RESET_DURING_ASSERT capability
Both callers are deep inside the dump collection path:iwl_fw_dbg_collect_sync() → iwl_fw_error_ini_dump() → iwl_dump_ini_file_gen() → iwl_dump_ini_trigger() → iwl_trans_pcie_fw_reset_handshake()
If timeout triggers iwl_op_mode_dump_error(), it calls back into iwl_mvm_dump_error() → iwl_fw_error_collect(), creating a recursive dump situation.
Record: The buggy path is reachable during any FW error dump on Intel WiFi hardware. This affects all Intel WiFi users with modern firmware.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Buggy Code Existence
- 85ccbdc4d3930f (prerequisite) is in v6.15+ (verified with git merge-base --is-ancestor)
- NOT in v6.14 or earlier
- File was moved to gen1_2/ in c8a00a6e89ff (v6.19)
Record: Bug exists in v6.15+. Only relevant for stable trees 6.15.y through 7.0.y (and beyond).
### Step 6.2: Backport Complications
For 7.0.y: Should apply cleanly (file path matches current tree). For 6.15-6.18: file was at pcie/trans-gen2.c, would need path adjustment.
Record: Clean apply for 7.0.y. Minor path conflict for older trees.
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
WiFi driver (iwlwifi) - used by vast majority of Intel WiFi laptops and desktops. **IMPORTANT** criticality level.
### Step 7.2: Activity
Very active subsystem with frequent fixes and updates.
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
All users of Intel WiFi hardware with firmware that supports reset handshake during dumps (modern Intel WiFi devices).
### Step 8.2: Trigger Conditions
- Firmware crash occurs (not uncommon on Intel WiFi)
- FW dump collection starts
- Reset handshake during dump times out
- System is in a state where !reset_done is true
### Step 8.3: Failure Mode Severity
When triggered, the system attempts a recursive dump from within dump context. This can cause:
- Deadlock if dump-related locks are already held (the mvm->mutex locking in iwl_mvm_dump_error with IWL_ERR_CONTEXT_FROM_OPMODE asserts the lock is held, and re-entering dump collection with it held could deadlock)
- At minimum: wasted resources, confusing error logs, delayed recovery
- **Severity**: HIGH (potential deadlock/hang during error recovery)
### Step 8.4: Risk-Benefit
- **Benefit**: HIGH - prevents recursive dumps that can hang the system during WiFi FW error recovery
- **Risk**: VERY LOW - single-file, ~10 line change, obviously correct parameter addition, preserves existing behavior for internal caller
- **Ratio**: Strongly favorable
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes a real bug: recursive dump attempt from within dump context
- Potential for deadlocks/hangs during FW error recovery
- Affects widely-used Intel WiFi hardware
- Written by THE iwlwifi maintainer (Johannes Berg)
- Reviewed by senior iwlwifi developer (Emmanuel Grumbach)
- Small, surgical, single-file fix (~10 lines net)
- Obviously correct - parameter addition with clear semantics
- No API changes, no new features
**AGAINST backporting:**
- No Fixes: tag or Cc: stable (expected - that's why it needs review)
- No explicit user reports of the hang/deadlock
- Only affects relatively recent kernels (v6.15+)
- Theoretical trigger (but realistic - FW crashes do happen)
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** - trivial function split, reviewed by subsystem experts
2. Fixes a real bug? **YES** - recursive dump can deadlock/hang
3. Important issue? **YES** - potential system hang during WiFi error recovery
4. Small and contained? **YES** - single file, ~10 lines
5. No new features or APIs? **YES** - no changes
6. Can apply to stable? **YES** - cleanly for 7.0.y
### Step 9.3: Exception Categories
Not applicable - this is a standard bug fix.
### Step 9.4: Decision
This is a well-crafted fix by the subsystem maintainer that prevents recursive firmware dumps which could cause deadlocks or hangs on Intel WiFi hardware during error recovery. The fix is small, obviously correct, and carries very low regression risk.
## Verification
- [Phase 1] Parsed tags: Signed-off-by Johannes Berg, Reviewed-by Emmanuel Grumbach, Link to patch.msgid.link
- [Phase 2] Diff analysis: Single file, ~10 lines net change. Function split with dump_on_timeout parameter. External callers get false, internal caller gets true.
- [Phase 3] git blame: Function made public in 85ccbdc4d3930f (v6.15). Dump-on-timeout added in 7391b2a4f7dbb7.
- [Phase 3] git merge-base --is-ancestor: Confirmed 85ccbdc4d3930f is in v6.15 but NOT in v6.14 or v6.13
- [Phase 3] Author check: Johannes Berg is the iwlwifi subsystem maintainer
- [Phase 4] Lore access blocked by Anubis; b4 dig confirmed related commits
- [Phase 5] Traced callers: iwl_trans_pcie_fw_reset_handshake() called from fw/dbg.c:2714 and fw/dbg.c:2722, both within dump collection path
- [Phase 5] Traced dump recursion path: iwl_op_mode_dump_error() → iwl_mvm_dump_error() → iwl_fw_error_collect() → triggers new dump
- [Phase 6] Bug exists in v6.15+ (verified). File at gen1_2/ path since v6.19 (verified)
- [Phase 8] Failure mode: Potential deadlock/hang during FW error recovery, severity HIGH
- UNVERIFIED: Could not verify mailing list discussion due to lore being bot-protected
- UNVERIFIED: No direct evidence of users hitting this recursive dump scenario in practice, but the code path is clearly reachable during any FW crash
**YES**
.../wireless/intel/iwlwifi/pcie/gen1_2/trans-gen2.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans-gen2.c +10 -3
@@ -95,7 +95,9 @@ static void iwl_pcie_gen2_apm_stop(struct iwl_trans *trans, bool op_mode_leave) CSR_GP_CNTRL_REG_FLAG_INIT_DONE); } -void iwl_trans_pcie_fw_reset_handshake (struct iwl_trans *trans) +static void +_iwl_trans_pcie_fw_reset_handshake (struct iwl_trans *trans, +bool dump_on_timeout) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);int ret;
@@ -133,7 +135,7 @@ void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans)"timeout waiting for FW reset ACK (inta_hw=0x%x, reset_done %d)\n" , inta_hw, reset_done); -if (!reset_done) { +if (!reset_done && dump_on_timeout) {struct iwl_fw_error_dump_mode mode = { .type =IWL_ERR_TYPE_RESET_HS_TIMEOUT , .context = IWL_ERR_CONTEXT_FROM_OPMODE,
@@ -147,6 +149,11 @@ void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans) trans_pcie->fw_reset_state =FW_RESET_IDLE ; } +void iwl_trans_pcie_fw_reset_handshake (struct iwl_trans *trans) +{ +_iwl_trans_pcie_fw_reset_handshake (trans, false); +} +static void _iwl_trans_pcie_gen2_stop_device (struct iwl_trans *trans) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);
@@ -163,7 +170,7 @@ static void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)* should assume that the firmware is already dead. */ trans->state =IWL_TRANS_NO_FW ; -iwl_trans_pcie_fw_reset_handshake (trans); +_iwl_trans_pcie_fw_reset_handshake (trans, true); } trans_pcie->is_down = true;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net: sfp: add quirks for Hisense and HSGQ GPON ONT SFP modules
In reply to Sasha LevinFrom: John Pavlick <[email protected]>
[ Upstream commit 95aca8602ef70ffd3d971675751c81826e124f90 ]
Several GPON ONT SFP sticks based on Realtek RTL960x report 1000BASE-LX at 1300MBd in their EEPROM but can operate at 2500base-X. On hosts capable of 2500base-X (e.g. Banana Pi R3 / MT7986), the kernel negotiates only 1G because it trusts the incorrect EEPROM data.
Add quirks for:
- Hisense-Leox LXT-010S-H
- Hisense ZNID-GPON-2311NA
- HSGQ HSGQ-XPON-Stick
Each quirk advertises 2500base-X and ignores TX_FAULT during the module's ~40s Linux boot time.
Tested on Banana Pi R3 (MT7986) with OpenWrt 25.12.1, confirmed 2.5Gbps link and full throughput with flow offloading.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
drivers/net/phy/sfp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/phy/sfp.c +16 -0
@@ -543,6 +543,22 @@ static const struct sfp_quirk sfp_quirks[] = {SFP_QUIRK ("HUAWEI" ,"MA5671A" , sfp_quirk_2500basex, sfp_fixup_ignore_tx_fault_and_los), +// Hisense LXT-010S-H is a GPON ONT SFP (sold as LEOX LXT-010S-H) that +// can operate at 2500base-X, but reports 1000BASE-LX / 1300MBd in its +// EEPROM +SFP_QUIRK ("Hisense-Leox" ,"LXT-010S-H" , sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault), + +// Hisense ZNID-GPON-2311NA can operate at 2500base-X, but reports +// 1000BASE-LX / 1300MBd in its EEPROM +SFP_QUIRK ("Hisense" ,"ZNID-GPON-2311NA" , sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault), + +// HSGQ HSGQ-XPON-Stick can operate at 2500base-X, but reports +// 1000BASE-LX / 1300MBd in its EEPROM +SFP_QUIRK ("HSGQ" ,"HSGQ-XPON-Stick" , sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault), +// Lantech 8330-262D-E and 8330-265D can operate at 2500base-X, but // incorrectly report 2500MBd NRZ in their EEPROM. // Some 8330-265D modules have inverted LOS, while all of them report
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ixgbevf: add missing negotiate_features op to Hyper-V ops table
In reply to Sasha LevinFrom: Michal Schmidt <[email protected]>
[ Upstream commit 4821d563cd7f251ae728be1a6d04af82a294a5b9 ]
Commit a7075f501bd3 ("ixgbevf: fix mailbox API compatibility by negotiating supported features") added the .negotiate_features callback to ixgbe_mac_operations and populated it in ixgbevf_mac_ops, but forgot to add it to ixgbevf_hv_mac_ops. This leaves the function pointer NULL on Hyper-V VMs.
During probe, ixgbevf_negotiate_api() calls ixgbevf_set_features(), which unconditionally dereferences hw->mac.ops.negotiate_features(). On Hyper-V this results in a NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 0000000000000000 [...] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine [...] Workqueue: events work_for_cpu_fn RIP: 0010:0x0 [...] Call Trace: ixgbevf_negotiate_api+0x66/0x160 [ixgbevf] ixgbevf_sw_init+0xe4/0x1f0 [ixgbevf] ixgbevf_probe+0x20f/0x4a0 [ixgbevf] local_pci_probe+0x50/0xa0 work_for_cpu_fn+0x1a/0x30 [...]
Add ixgbevf_hv_negotiate_features_vf() that returns -EOPNOTSUPP and wire it into ixgbevf_hv_mac_ops. The caller already handles -EOPNOTSUPP gracefully.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
drivers/net/ethernet/intel/ixgbevf/vf.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/intel/ixgbevf/vf.c +7 -0
@@ -709,6 +709,12 @@ static int ixgbevf_negotiate_features_vf(struct ixgbe_hw *hw, u32 *pf_features)return err; } +static int ixgbevf_hv_negotiate_features_vf (struct ixgbe_hw *hw, +u32 *pf_features) +{ +return -EOPNOTSUPP ; +} +/** * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address * @hw: pointer to the HW structure
@@ -1142,6 +1148,7 @@ static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = { .setup_link = ixgbevf_setup_mac_link_vf, .check_link = ixgbevf_hv_check_mac_link_vf, .negotiate_api_version = ixgbevf_hv_negotiate_api_version_vf, + .negotiate_features = ixgbevf_hv_negotiate_features_vf, .set_rar = ixgbevf_hv_set_rar_vf, .update_mc_addr_list = ixgbevf_hv_update_mc_addr_list_vf, .update_xcast_mode = ixgbevf_hv_update_xcast_mode,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 hwmon: (pmbus/isl68137) Add support for Renesas RAA228942 and RAA228943
In reply to Sasha LevinFrom: Dawei Liu <[email protected]>
[ Upstream commit 7c760db74c9f30da7281c7f450d0676ec78ec3e6 ]
Add I2C device IDs for Renesas RAA228942 and RAA228943.
At the Linux PMBus hwmon interface level currently supported by this driver, these devices are compatible with the existing 2-rail non-TC controllers, so devicetree will use fallback compatibles and no dedicated OF match entries are needed.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a complete analysis. Let me compile the findings.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: hwmon: (pmbus/isl68137)
- Action verb: "Add support"
- Summary: Add I2C device IDs for two new Renesas voltage regulators (RAA228942 and RAA228943)
- Record: This is a device ID addition, not a bug fix.
**Step 1.2: Tags**
- Signed-off-by: Dawei Liu <[email protected]> (author, Renesas employee)
- Link: lore.kernel.org mail link
- Signed-off-by: Guenter Roeck <[email protected]> (hwmon subsystem maintainer - accepted the patch)
- No Fixes: tag (expected for candidates)
- No Cc: stable (expected for candidates)
- No Reported-by, Tested-by, or Reviewed-by
**Step 1.3: Commit Body**
- States that these devices "are compatible with the existing 2-rail non-TC controllers"
- Explicitly says "devicetree will use fallback compatibles and no dedicated OF match entries are needed"
- This is a pure hardware enablement addition
**Step 1.4: Hidden Bug Fix?**
- No. This is not a hidden bug fix. It is straightforward device ID addition.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- Documentation/hwmon/isl68137.rst: +20 lines (documentation for two new devices)
- drivers/hwmon/pmbus/isl68137.c: +2 lines (two I2C device ID table entries)
- Total: +22 lines, 0 removed
- Scope: Trivially small, single-file code change + docs
**Step 2.2: Code Flow**
- Two entries added to the raa_dmpvr_id[] I2C device ID table:
- {"raa228942", raa_dmpvr2_2rail_nontc}
- {"raa228943", raa_dmpvr2_2rail_nontc}
- These use the existing raa_dmpvr2_2rail_nontc variant, which was introduced in commit 51fb91ed5a6fa (v5.10 era). The variant disables TEMP3 and configures 2-page mode.
- No new code paths, no new functions, no logic changes
**Step 2.3: Bug Mechanism**
- Category: Hardware device ID addition (exception category h)
- Without these IDs, the kernel cannot bind the existing ISL68137 PMBus driver to these Renesas parts
**Step 2.4: Fix Quality**
- Obviously correct: merely adding two string/enum pairs to an existing table
- Minimal and surgical
- Zero regression risk: only affects systems with these specific I2C devices
- No new code paths, APIs, or behavioral changes
## PHASE 3: GIT HISTORY
**Step 3.1: Blame**
- The raa_dmpvr_id[] table has been present since commit f621d61fd59f4 (2020). The raa_dmpvr2_2rail_nontc variant was added in commit 51fb91ed5a6fa (2020, v5.10 era).
- Both are present in all active stable trees (5.10+, 5.15+, 6.1+, 6.6+)
**Step 3.2: Fixes Tag**
- No Fixes: tag (not applicable - this is a device ID addition, not a bug fix)
**Step 3.3: File History**
- Prior identical-pattern commit: 2190ad55a601d added RAA228244 and RAA228246 in the same manner. This was a v6.18/6.19 timeframe commit.
- The pattern of adding new Renesas device IDs to this driver is well established.
**Step 3.4: Author**
- Dawei Liu is a Renesas employee ([email protected]), appropriate for submitting Renesas device support.
**Step 3.5: Dependencies**
- No dependencies. The raa_dmpvr2_2rail_nontc enum value and its case statement already exist in stable trees back to 5.10.
## PHASE 4: MAILING LIST RESEARCH
**Step 4.1-4.5:** Lore is behind bot protection and cannot be fetched. However, the Link: tag confirms the patch was submitted via the standard process and accepted by hwmon maintainer Guenter Roeck. The b4 dig of the prior similar commit (2190ad55a601d) confirmed it was part of a normal patch series accepted through the standard hwmon tree.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1-5.5:**
- The only code change is adding entries to a static struct i2c_device_id table.
- When the I2C subsystem finds a device matching "raa228942" or "raa228943", it will call isl68137_probe() with the raa_dmpvr2_2rail_nontc variant.
- The raa_dmpvr2_2rail_nontc case (lines 413-416) simply disables TEMP3, falls through to the 2-rail handler. This is well-tested code used by RAA228228, RAA228244, and RAA228246.
- No new code paths are created.
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1:** The driver exists in all active stable trees (5.10+). The raa_dmpvr2_2rail_nontc variant exists since 5.10.
**Step 6.2:** The patch adds 2 lines to the I2C ID table and documentation. It will apply cleanly or with trivial context adjustments (the table is in alphabetical order).
**Step 6.3:** No related fixes already in stable for these specific devices.
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1:** drivers/hwmon/pmbus - hardware monitoring for PMBus voltage regulators. Criticality: PERIPHERAL (specific hardware). However, PMBus voltage regulators are used in servers and embedded systems where stable kernels are common.
**Step 7.2:** Actively maintained by Guenter Roeck, with regular device ID additions.
## PHASE 8: IMPACT AND RISK
**Step 8.1:** Affects users of Renesas RAA228942/RAA228943 hardware specifically.
**Step 8.2:** Without these IDs, the driver cannot bind to the hardware at all. Users with this hardware have no workaround on stable kernels.
**Step 8.3:** Failure mode without fix: hardware is completely inaccessible. Severity: MEDIUM (functional but not crash/corruption).
**Step 8.4:**
- Benefit: Enables hardware monitoring for users with these specific Renesas voltage regulators on stable kernels.
- Risk: Essentially zero. Two table entries using an existing, well- tested variant.
- Ratio: Very favorable benefit/risk.
## PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
- Device ID addition to existing driver - explicitly allowed exception category
- Trivially small (2 lines of code)
- Uses existing, well-tested variant (raa_dmpvr2_2rail_nontc) present since v5.10
- Zero regression risk
- Accepted by subsystem maintainer (Guenter Roeck)
- Author is from the chip vendor (Renesas)
- Enables real hardware for real users
**Evidence AGAINST backporting:**
- Not a bug fix - purely hardware enablement
- Affects only users with these specific Renesas parts (narrow audience)
**Stable Rules Checklist:**
1. Obviously correct? **YES** - trivial table addition
2. Fixes a real bug? **No** - but device ID additions are an explicit exception
3. Important? Moderately - enables hardware for users who have it
4. Small and contained? **YES** - 2 lines of code + docs
5. No new features/APIs? **YES** - no new features, just ID binding
6. Can apply to stable? **YES** - clean apply expected
**Exception Category:** Device ID addition to existing driver - this is one of the explicitly listed categories that ARE allowed in stable despite being "additions."
## Verification
- [Phase 1] Parsed tags: Signed-off-by from Renesas author + hwmon maintainer Guenter Roeck; Link to lore
- [Phase 2] Diff analysis: +2 lines in I2C ID table (raa228942/raa228943 as raa_dmpvr2_2rail_nontc), +20 lines docs
- [Phase 3] git blame: ID table present since f621d61fd59f4 (2020); nontc variant since 51fb91ed5a6fa (2020, v5.10 era)
- [Phase 3] git tag --contains 51fb91ed5a6fa: present in p-5.10, p-5.15, all active stable trees
- [Phase 3] git log: prior identical-pattern commit 2190ad55a601d (RAA228244/RAA228246) confirmed
- [Phase 3] git log --author: author is Renesas employee
- [Phase 4] b4 dig: lore blocked by bot protection; confirmed standard hwmon maintainer acceptance via prior similar commit
- [Phase 5] Code reading: raa_dmpvr2_2rail_nontc case at line 413 disables TEMP3, falls through to 2-rail; well-tested
- [Phase 6] Verified existing variant in tree at lines 76, 413, 498-500, 549-551
- [Phase 6] No raa228942/raa228943 references found anywhere in current tree (grep confirmed)
- [Phase 8] Risk: zero regression potential from static table entry addition
- UNVERIFIED: Could not read lore discussion due to bot protection
This is a textbook device ID addition - the simplest and safest type of stable backport. Two lines adding I2C device IDs to an existing driver using an existing, well-tested variant. Zero regression risk, enables hardware for real users.
**YES**
Documentation/hwmon/isl68137.rst | 20 ++++++++++++++++++++ drivers/hwmon/pmbus/isl68137.c | 2 ++ 2 files changed, 22 insertions(+)
Documentation/hwmon/isl68137.rst +20 -0
@@ -394,6 +394,26 @@ Supported chips: Provided by Renesas upon request and NDA + * Renesas RAA228942 + + Prefix: 'raa228942' + + Addresses scanned: - + + Datasheet: + + Provided by Renesas upon request and NDA + + * Renesas RAA228943 + + Prefix: 'raa228943' + + Addresses scanned: - + + Datasheet: + + Provided by Renesas upon request and NDA + * Renesas RAA229001 Prefix: 'raa229001'
drivers/hwmon/pmbus/isl68137.c +2 -0
@@ -498,6 +498,8 @@ static const struct i2c_device_id raa_dmpvr_id[] = { {"raa228228", raa_dmpvr2_2rail_nontc}, {"raa228244", raa_dmpvr2_2rail_nontc}, {"raa228246", raa_dmpvr2_2rail_nontc}, + {"raa228942", raa_dmpvr2_2rail_nontc}, + {"raa228943", raa_dmpvr2_2rail_nontc}, {"raa229001", raa_dmpvr2_2rail}, {"raa229004", raa_dmpvr2_2rail}, {"raa229141", raa_dmpvr2_2rail_pmbus},
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 7.0-6.18] hwmon: (pmbus/isl68137) Add support for Renesas RAA228942 and RAA228943
Sashiko AI review found 1 potential issue(s): - [High] Unchecked dereference of `i2c_match_id()` in probe function causes a kernel panic when using Device Tree fallback compatibles, forcing…
Sashiko AI review found 1 potential issue(s):
- [High] Unchecked dereference of i2c_match_id() in probe function causes a kernel panic when using Device Tree fallback compatibles, forcing unnecessary driver updates. --
commit b782f8e0961d8ebf5fabe49f49ad99e6bb11a058
Author: Dawei Liu <[email protected]>
hwmon: (pmbus/isl68137) Add support for Renesas RAA228942 and RAA228943
This commit adds I2C device IDs for the Renesas RAA228942 and RAA228943 chips. The commit message notes that devicetree will use fallback compatibles and no dedicated OF match entries are needed.
Quoted 4 lines
At the Linux PMBus hwmon interface level currently supported by this driver, these devices are compatible with the existing 2-rail non-TC controllers, so devicetree will use fallback compatibles and no dedicated OF match entries are needed.
If no dedicated OF match entries are needed and fallback compatibles are used, does this addition to the I2C device ID table serve as a workaround for a NULL pointer dereference during probe?
Looking at isl68137_probe():
drivers/hwmon/pmbus/isl68137.c:isl68137_probe() {
...
switch (i2c_match_id(raa_dmpvr_id, client)->driver_data) {
case raa_dmpvr1_2rail:
...
}If a device is probed via a fallback compatible and its exact name isn't present in the raa_dmpvr_id table, wouldn't i2c_match_id() return NULL and cause a kernel panic when dereferencing ->driver_data?
drivers/hwmon/pmbus/isl68137.c static const struct i2c_device_id raa_dmpvr_id[] = { · line 504
Quoted 12 lines
drivers/hwmon/pmbus/isl68137.c +2
-0@@ -498,6 +498,8 @@ static const struct i2c_device_id raa_dmpvr_id[] = { {"raa228228", raa_dmpvr2_2rail_nontc}, {"raa228244", raa_dmpvr2_2rail_nontc}, {"raa228246", raa_dmpvr2_2rail_nontc}, + {"raa228942", raa_dmpvr2_2rail_nontc}, + {"raa228943", raa_dmpvr2_2rail_nontc}, {"raa229001", raa_dmpvr2_2rail}, {"raa229004", raa_dmpvr2_2rail},
Could isl68137_probe() be updated to use i2c_get_match_data() instead?
This would extract match data directly from the OF fallback node without panicking, making the raa_dmpvr_id additions unnecessary.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 btrfs: use BTRFS_FS_UPDATE_UUID_TREE_GEN flag for UUID tree rescan check
In reply to Sasha LevinFrom: Dave Chen <[email protected]>
[ Upstream commit e70e3f858e084aee34a2206e5f4dd49a47673f6a ]
The UUID tree rescan check in open_ctree() compares fs_info->generation with the superblock's uuid_tree_generation. This comparison is not reliable because fs_info->generation is bumped at transaction start time in join_transaction(), while uuid_tree_generation is only updated at commit time via update_super_roots().
Between the early BTRFS_FS_UPDATE_UUID_TREE_GEN flag check and the late rescan decision, mount operations such as file orphan cleanup from an unclean shutdown start transactions without committing them. This advances fs_info->generation past uuid_tree_generation and produces a false-positive mismatch.
Use the BTRFS_FS_UPDATE_UUID_TREE_GEN flag directly instead. The flag was already set earlier in open_ctree() when the generations were known to match, and accurately represents "UUID tree is up to date" without being affected by subsequent transaction starts.
---
LLM Generated explanations, may be completely bogus:
Now I have a complete picture. Let me compile the final analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
Record: [btrfs] [use] [Replace unreliable generation comparison with reliable flag for UUID tree rescan check]
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
- **Reviewed-by:** Filipe Manana <[email protected]> — Filipe is a prolific btrfs maintainer/developer (verified: 5+ recent commits in btrfs)
- **Signed-off-by:** Dave Chen <[email protected]> — Author
- **Signed-off-by:** Robbie Ko <[email protected]> — Co- author/submitter from Synology
- **Signed-off-by:** Filipe Manana <[email protected]> — Committer path
- **Signed-off-by:** David Sterba <[email protected]> — Btrfs tree maintainer
No Fixes: tag, no Reported-by, no Link, no Cc: stable. Absence is expected.
Record: Patch was reviewed by Filipe Manana (btrfs expert) and committed through Filipe and David Sterba (btrfs maintainer). Strong review chain.
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
The commit explains:
- **Bug mechanism:** fs_info->generation is bumped at transaction start time in join_transaction(), while uuid_tree_generation is only updated at commit time in update_super_roots().
- **What goes wrong:** Between the early BTRFS_FS_UPDATE_UUID_TREE_GEN flag check and the late UUID rescan decision, mount operations (orphan cleanup from unclean shutdown) start transactions without committing them. This advances fs_info->generation past uuid_tree_generation, producing a **false-positive mismatch**.
- **Result:** Unnecessary UUID tree rescan on mount after unclean shutdown.
- **Fix:** Use the BTRFS_FS_UPDATE_UUID_TREE_GEN flag directly instead of re-comparing generations.
Record: Real bug — false-positive UUID tree rescan triggered on mount after unclean shutdown. Root cause is generation counter advancing from uncommitted transactions between the flag-set point and the check point.
### Step 1.4: DETECT HIDDEN BUG FIXES
This IS a real bug fix, though the commit message doesn't use the word "fix" directly. The language "not reliable," "false-positive mismatch," and the explanation of the broken mechanism clearly describe a bug being corrected.
Record: Yes, this is a real bug fix for an incorrect condition that triggers unnecessary rescans.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
- **File:** fs/btrfs/disk-io.c — 1 line changed (1 removed, 1 added)
- **Function:** open_ctree() — the main btrfs mount function
- **Scope:** Single-file, single-line, surgical fix
Record: 1 file, 1 line change, in open_ctree(). Minimal scope.
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
**Before (line 3677):**
```c fs_info->generation != btrfs_super_uuid_tree_generation(disk_super) ```
Compares current in-memory generation counter vs. on-disk uuid_tree_generation.
**After:**
```c !test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags) ```
Tests the flag that was set earlier at line 3537 when generations were known to match.
Record: Normal mount path affected. Changes the condition from an unreliable runtime comparison to a stable flag check.
### Step 2.3: IDENTIFY THE BUG MECHANISM
This is a **logic/correctness bug**. The comparison fs_info->generation != uuid_tree_generation was correct at the time it was originally written, but commit 44c0ca211a4da (Boris Burkov, 2020) refactored the code to move orphan cleanup and other rw mount operations *before* this check via btrfs_start_pre_rw_mount(). Those operations start transactions (confirmed: btrfs_orphan_cleanup() calls btrfs_start_transaction() at line 3870 of inode.c), which bumps fs_info->generation (confirmed: join_transaction() at line 392 of transaction.c). The on-disk uuid_tree_generation doesn't change until update_super_roots() at commit time (confirmed: line 1985-1986 of transaction.c).
Record: Logic bug category. Condition became incorrect after code was reordered by refactoring commit 44c0ca211a4da.
### Step 2.4: ASSESS THE FIX QUALITY
- Obviously correct: The flag BTRFS_FS_UPDATE_UUID_TREE_GEN is already set at line 3537 exactly when the generations match, and is unaffected by transaction starts
- Minimal/surgical: 1 line change
- No regression risk: The flag is already the authoritative indicator (used by update_super_roots() at commit time)
- Reviewed by Filipe Manana
Record: Fix quality is excellent. Obviously correct, minimal, no regression risk.
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
The buggy line (3677) was introduced by commit 44c0ca211a4da9 (Boris Burkov, 2020-11-18) — "btrfs: lift read-write mount setup from mount and remount". This refactoring moved rw mount setup into btrfs_start_pre_rw_mount() but left the generation comparison in open_ctree() after the call, creating the false-positive window.
Record: Buggy code introduced by 44c0ca211a4da (v5.11). Present in all active stable trees from 5.15+.
### Step 3.2: FOLLOW THE FIXES TAG
No Fixes: tag, but the bug was introduced by 44c0ca211a4da. The earlier fix attempt (75ec1db8717a8 by Josef Bacik, 2020) set the flag *before* the problematic code paths, specifically to prevent this exact class of bug. But the 44c0ca211a4da refactoring reintroduced the problem by moving more transaction-starting code between the flag set and the rescan check, without updating the check to use the flag.
Record: 44c0ca211a4da introduced the bug. It's in v5.11+ (all active stable trees).
### Step 3.3: CHECK FILE HISTORY
Recent file history shows active maintenance with various fixes. No dependency concerns.
Record: Standalone fix, no prerequisites needed.
### Step 3.4: AUTHOR
Dave Chen from Synology is a btrfs contributor. Robbie Ko from Synology is also a known btrfs contributor with multiple commits. Filipe Manana reviewed.
Record: Authors are active btrfs contributors, reviewer is btrfs expert.
### Step 3.5: DEPENDENCIES
The fix depends on BTRFS_FS_UPDATE_UUID_TREE_GEN flag existing and being set early in open_ctree(). This was added by 75ec1db8717a8 (Josef Bacik, 2020, v5.6, CC stable 4.19+). Verified: The flag and the early set_bit at line 3537 exist in current code.
Record: No additional dependencies. The flag infrastructure exists since v5.6.
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1-4.5
b4 dig could not find the specific patch submission (the commit may be very recent or submitted through a different path). Web searches also couldn't reach lore due to anti-bot protection. The commit message and review chain (Reviewed-by: Filipe Manana, SOBs from Filipe Manana and David Sterba) confirm it went through proper btrfs review.
Record: Could not access mailing list discussion directly. Review chain confirms proper vetting.
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: KEY FUNCTIONS
Modified function: open_ctree() — the main btrfs filesystem mount function.
### Step 5.2: CALLERSopen_ctree() is called during every btrfs mount. This is a universally exercised path.
### Step 5.3-5.4: TRIGGER PATH
The false-positive triggers when:
1. Filesystem had an unclean shutdown (so orphan items exist)
2. Mount starts a transaction during orphan cleanup → bumps generation
3. UUID rescan check falsely detects a mismatch → triggers unnecessary rescan
This is extremely common — every btrfs mount after crash/power failure.
Record: Bug path is very commonly triggered (any mount after unclean shutdown).
### Step 5.5: SIMILAR PATTERNS
Josef Bacik's commit 75ec1db8717a8 fixed the exact same class of bug earlier (log replay bumping generation), showing this is a recurring pattern.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: BUGGY CODE IN STABLE
The bug was introduced in 44c0ca211a4da (v5.11). It exists in stable
trees: 5.15.y, 6.1.y, 6.6.y, 6.12.y, and now 7.0.
### Step 6.2: BACKPORT COMPLICATIONS
The fix is a single-line change. The surrounding code context may differ slightly between stable trees, but the essential structure (uuid_root check with generation comparison) should be present in all affected trees.
Record: Clean apply expected in most trees; minor conflicts possible in very old trees due to surrounding code changes.
### Step 6.3: RELATED FIXES
No other fix for this specific issue found in history.
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: SUBSYSTEM CRITICALITY
btrfs (fs/btrfs/) — IMPORTANT. Major Linux filesystem used in many distributions (SUSE, openSUSE, Fedora) and NAS products (Synology, which is where this fix comes from).
### Step 7.2: ACTIVITY
Very actively developed and maintained. Multiple fixes merged during 7.0 cycle.
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: WHO IS AFFECTED
All btrfs users who experience unclean shutdowns (crash, power failure, hard reset).
### Step 8.2: TRIGGER CONDITIONS
- Trigger: Mount after unclean shutdown when orphan items exist → very common
- No special privileges needed, just mounting the filesystem
- Deterministic (not timing-dependent)
### Step 8.3: FAILURE MODE SEVERITY
- **Not a crash or data corruption** — the UUID tree rescan is unnecessary but harmless
- **Performance impact:** The rescan walks the entire UUID tree, verifying every entry. On a filesystem with many subvolumes/snapshots, this can be expensive and slow down mount time significantly
- **User-visible symptom:** "checking UUID tree" message in dmesg on every mount after unclean shutdown, plus slower mount
Record: Severity: MEDIUM. Unnecessary expensive operation during mount. No data risk.
### Step 8.4: RISK-BENEFIT RATIO
- **Benefit:** Eliminates unnecessary UUID tree rescans on mount after unclean shutdown. Improves mount time for btrfs users (especially those with many subvolumes)
- **Risk:** Extremely low — 1-line change, obviously correct, uses a flag that was designed for exactly this purpose
- **Ratio:** Very favorable
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: EVIDENCE
**FOR backporting:**
- Fixes a real bug: unnecessary UUID tree rescan triggered by false- positive generation mismatch
- Extremely small and surgical: 1 line change
- Obviously correct: uses the flag designed for this exact purpose
- Reviewed by Filipe Manana (btrfs expert)
- Bug affects all btrfs users who experience unclean shutdowns
- Bug exists since v5.11 (all active stable trees)
- No regression risk
- The flag infrastructure is already present in all stable trees
**AGAINST backporting:**
- Not a crash, security issue, or data corruption
- The unnecessary rescan is a performance issue, not a correctness issue (the rescan itself is harmless)
- No Fixes: or Cc: stable tags from the author (expected — that's why we're reviewing)
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **YES** — trivial 1-line change reviewed by btrfs expert
2. Fixes a real bug that affects users? **YES** — unnecessary expensive operation on mount after crash
3. Important issue? **MEDIUM** — performance issue on common path, not crash/corruption
4. Small and contained? **YES** — 1 line, 1 file
5. No new features or APIs? **YES** — no new features
6. Can apply to stable trees? **YES** — simple change to code present since v5.11
### Step 9.3: EXCEPTION CATEGORIES
Not an exception category, but a straightforward bug fix.
### Step 9.4: DECISION
This is a clean, minimal, obviously correct fix for a real bug that causes unnecessary expensive UUID tree rescans during btrfs mount after unclean shutdown. It was reviewed by btrfs expert Filipe Manana and committed through the proper btrfs maintainer chain. While not a crash or security issue, it fixes a genuine problem that affects all btrfs users who experience power failures or crashes, and the risk of regression from this 1-line change is essentially zero. This meets stable kernel criteria.
## Verification
- [Phase 1] Parsed tags: Reviewed-by Filipe Manana, SOBs from Dave Chen, Robbie Ko, Filipe Manana, David Sterba
- [Phase 2] Diff analysis: 1 line changed in open_ctree() at line 3677 of disk-io.c — replaces fs_info->generation != btrfs_super_uuid_tree_generation(disk_super) with !test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags)
- [Phase 3] git blame: buggy line introduced by commit 44c0ca211a4da (Boris Burkov, v5.11, 2020-11-18)
- [Phase 3] git show 75ec1db8717a8: confirmed this is the original fix that added the flag and early set_bit, with CC: stable 4.19+
- [Phase 3] Verified join_transaction() bumps generation at transaction.c:392
- [Phase 3] Verified btrfs_orphan_cleanup() starts transactions at inode.c:3870
- [Phase 3] Verified update_super_roots() uses the flag to write uuid_tree_generation at transaction.c:1985-1986
- [Phase 3] Verified the flag is set early at disk-io.c:3535-3537
- [Phase 3] Verified btrfs_start_pre_rw_mount() calls orphan cleanup at disk-io.c:3119, before the UUID rescan check at line 3677
- [Phase 3] git merge-base: 44c0ca211a4da is in v5.11 but not v5.10; bug exists in stable trees 5.15+
- [Phase 4] b4 dig: could not find original submission thread
- [Phase 4] UNVERIFIED: Could not access lore.kernel.org discussion due to anti-bot protection
- [Phase 5] open_ctree() called on every btrfs mount — universal code path
- [Phase 5] Trigger: mount after unclean shutdown → orphan cleanup → transaction → generation bump → false positive
- [Phase 7] btrfs is an important filesystem used by major distributions and NAS vendors
- [Phase 8] Failure mode: unnecessary UUID tree rescan (walks entire tree), severity MEDIUM (performance, not crash)
**YES**
fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/disk-io.c +1 -1
@@ -3674,7 +3674,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_deviceif (fs_info->uuid_root && (btrfs_test_opt (fs_info,RESCAN_UUID_TREE ) || - fs_info->generation !=btrfs_super_uuid_tree_generation (disk_super))) { + !test_bit (BTRFS_FS_UPDATE_UUID_TREE_GEN , &fs_info->flags))) {btrfs_info (fs_info,"checking UUID tree" ); ret =btrfs_check_uuid_tree (fs_info);if (ret) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 Bluetooth: hci_ll: Enable BROKEN_ENHANCED_SETUP_SYNC_CONN for WL183x
In reply to Sasha LevinFrom: Stefano Radaelli <[email protected]>
[ Upstream commit 1c0bc11cd445ba8235ac8ec87d5999b6769ed8b9 ]
TI WL183x controllers advertise support for the HCI Enhanced Setup Synchronous Connection command, but SCO setup fails when the enhanced path is used. The only working configuration is to fall back to the legacy HCI Setup Synchronous Connection (0x0028).
This matches the scenario described in commit 05abad857277 ("Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk").
Enable HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN automatically for devices compatible with:
- ti,wl1831-st
- ti,wl1835-st
- ti,wl1837-st
---
LLM Generated explanations, may be completely bogus:
Now let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
- **Subsystem prefix**: Bluetooth: hci_ll:
- **Action verb**: "Enable" — enabling a quirk workaround for broken hardware
- **Summary**: Enable the BROKEN_ENHANCED_SETUP_SYNC_CONN quirk for TI WL183x Bluetooth controllers because SCO setup fails when using the enhanced path.
Record: [Bluetooth: hci_ll] [Enable] [Hardware quirk for broken enhanced SCO setup on WL183x]
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
- **Signed-off-by: Stefano Radaelli** — patch author (Variscite employee, embedded board vendor)
- **Signed-off-by: Luiz Augusto von Dentz** — Bluetooth subsystem maintainer who merged it
- No Fixes: tag (expected for review candidates)
- No Cc: stable (expected)
- No Reported-by (author found the bug during hardware validation)
- No Link: tags
Record: Maintainer SOB from Luiz Augusto von Dentz. No syzbot, no explicit stable nomination.
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
The commit explains that TI WL183x controllers advertise support for HCI Enhanced Setup Synchronous Connection but SCO fails when the enhanced path is used. The only working configuration is to fall back to legacy HCI Setup Synchronous Connection (0x0028). This references commit 05abad857277 which introduced the exact quirk for this scenario.
Record: Bug = SCO audio setup fails on WL183x chips. Symptom = SCO connection failure. Root cause = controller claims enhanced setup support but it's broken.
### Step 1.4: DETECT HIDDEN BUG FIXES
This is a **hardware quirk/workaround**, not a hidden fix. It's explicitly enabling an existing quirk for specific devices that are broken. This falls squarely into the "hardware quirk" exception category for stable.
Record: This is a hardware workaround (quirk), a known exception category that IS appropriate for stable.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
- **File**: drivers/bluetooth/hci_ll.c
- **Lines added**: ~10 (1 struct field + 4 lines in probe + 3 lines in setup)
- **Functions modified**: struct ll_device (field addition), ll_setup() (quirk setting), hci_ti_probe() (compatible detection)
- **Scope**: Single-file, surgical change
Record: 1 file, ~10 lines added, 3 locations modified. Small and contained.
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
1. **struct ll_device**: adds bool broken_enhanced_setup field
2. **hci_ti_probe()**: checks if device is compatible with wl1831-st/wl1835-st/wl1837-st and sets the new bool
3. **ll_setup()**: if broken_enhanced_setup is true, calls hci_set_quirk() to set HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN
Record: Probe detects WL183x compatible → stores flag → setup applies quirk during device initialization.
### Step 2.3: IDENTIFY THE BUG MECHANISM
Category: **Hardware workaround** (h). The TI WL183x chips claim support for Enhanced Setup Synchronous Connection but it doesn't work. The quirk tells the Bluetooth stack to fall back to the legacy command.
Record: Hardware quirk. Broken enhanced SCO command on WL183x. Fix = set existing quirk flag.
### Step 2.4: ASSESS THE FIX QUALITY
- Obviously correct — same pattern used by btusb.c for QCA and MTK controllers
- Minimal and surgical — only affects WL183x devices
- Zero regression risk for non-WL183x devices (guarded by compatible check)
- Low regression risk for WL183x (just falls back to legacy SCO path that works)
Record: High quality, obviously correct, follows established pattern. No regression risk.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
The areas being modified were introduced by:
- struct ll_device: Rob Herring, 2017-04-13 (commit 371805522f8709) — in tree since v4.13
- ll_setup(): David Lechner, 2017-12-12 (commit 0e58d0cdb3eb6e) — in tree since v4.16
- hci_ti_probe(): Rob Herring, 2017-04-13 — in tree since v4.13
Record: Code being modified is very old (v4.13-v4.16), present in all stable trees.
### Step 3.2: FOLLOW THE FIXES: TAG
No Fixes: tag. The commit references 05abad857277 as context (the commit that added the quirk), not as a Fixes target.
Record: N/A — no Fixes tag, but the referenced quirk commit (05abad857277) exists since v5.19.
### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES Recent changes to hci_ll.c are mostly unrelated (firmware leak fix, alloc_obj conversion, hci_set_quirk API migration). No prerequisites needed.
Record: Standalone change. No prerequisites beyond the existing quirk definition (v5.19+) and compatible strings (always existed).
### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS
Stefano Radaelli from Variscite is primarily an embedded/DTS contributor (imx8mp, imx93). This is their first Bluetooth subsystem commit. The patch was reviewed and merged by the Bluetooth maintainer (Luiz Augusto von Dentz).
Record: Author is a hardware vendor contributor; patch was accepted by subsystem maintainer.
### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS
- HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN exists since v5.19 (commit 05abad857277)
- hci_set_quirk() API exists since v6.16 (commit 6851a0c228fc04)
- For stable trees v6.1-v6.15, the quirk must use set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hu->hdev->quirks) instead of hci_set_quirk()
- v5.15 CANNOT receive this fix (quirk doesn't exist there)
Record: Backportable to v6.1+ with minor API adjustment for trees before v6.16.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
Found at patchew.org — this is v2 of a 2-version series. v1 used a DT property approach, and after review feedback from Krzysztof Kozlowski, v2 switched to detecting the compatible string. The patch went through proper review.
Record: v1→v2 evolution. Reviewer suggested compatible-based detection instead of DT property. Final version is clean.
### Step 4.2: CHECK WHO REVIEWED THE PATCH
- Krzysztof Kozlowski reviewed v1 and suggested the approach used in v2
- Luiz Augusto von Dentz (Bluetooth maintainer) merged the patch
- David Lechner and Marcel Holtmann were CC'd
Record: Proper review by DT and Bluetooth maintainers.
### Step 4.3: SEARCH FOR THE BUG REPORT
The author (Variscite) found this during platform validation. The linked bugzilla (215576) for the original quirk commit shows this is a known class of bugs across multiple BT controller vendors (QCA, MTK, and now TI WL183x).
Record: Real hardware bug affecting real products.
### Step 4.4: CHECK FOR RELATED PATCHES AND SERIES
This is a standalone patch (v2 0/1 series). No dependencies on other patches.
Record: Standalone, no series dependencies.
### Step 4.5: CHECK STABLE MAILING LIST HISTORY No prior stable discussion found for this specific commit.
Record: No prior stable discussion.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.4: IDENTIFY KEY FUNCTIONS AND TRACE CALL CHAINS
- hci_ti_probe() → called during device enumeration when DT compatible matches
- ll_setup() → called during HCI device setup (hci_uart_proto.setup)
- enhanced_sync_conn_capable() → checked in hci_conn.c and sco.c when setting up SCO connections
- The quirk prevents HCI_OP_ENHANCED_SETUP_SYNC_CONN from being used, falling back to HCI_OP_SETUP_SYNC_CONN
Record: The quirk controls a well-defined code path in SCO connection setup. Impact is limited to SCO/audio on affected devices.
### Step 5.5: SEARCH FOR SIMILAR PATTERNS
The exact same quirk is set for QCA (commit d44e1dbda36ff) and MTK (commit e11523e97f474) controllers in btusb.c. This is an established, well-tested pattern.
Record: Identical pattern used for 2 other controller families.
---
## PHASE 6: CROSS-REFERENCING AND STABLE TREE ANALYSIS
### Step 6.1: DOES THE BUGGY CODE EXIST IN STABLE TREES?
- The hci_ll driver with WL183x compatibles exists in all stable trees (v4.13+)
- The quirk mechanism exists in v5.19+ (v6.1.y, v6.6.y, v6.12.y stable trees)
- The hci_set_quirk() API only exists in v6.16+; older trees use set_bit()
Record: The bug exists in v6.1+, v6.6+, v6.12+ stable trees. Fix is applicable with minor API adjustment.
### Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
- For v6.16+ (v7.0 target): clean apply
- For v6.1-v6.15: needs set_bit() instead of hci_set_quirk() — trivial one-line change
Record: Clean apply to v7.0. Minor adjustment for older stable trees.
### Step 6.3: CHECK IF RELATED FIXES ARE ALREADY IN STABLE No other fix for WL183x SCO exists in any stable tree.
Record: No related fixes in stable.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY
- Subsystem: Bluetooth (drivers/bluetooth) — IMPORTANT
- Affects users of TI WL183x Bluetooth modules on embedded platforms (Variscite boards, etc.)
Record: Bluetooth driver, IMPORTANT subsystem, embedded hardware audience.
### Step 7.2: ASSESS SUBSYSTEM ACTIVITY
The Bluetooth subsystem is actively maintained by Luiz Augusto von Dentz. The hci_ll driver sees moderate activity.
Record: Active subsystem, moderate driver activity.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: DETERMINE WHO IS AFFECTED
Users of TI WL1831/WL1835/WL1837 Bluetooth modules. These are common on embedded ARM platforms (iMX, TI AM series, etc.) particularly for IoT and automotive applications.
Record: Driver-specific, but significant embedded user base.
### Step 8.2: DETERMINE THE TRIGGER CONDITIONS
Trigger: Any attempt to use SCO/HFP audio over Bluetooth on affected WL183x hardware. This is a common use case (phone calls, headsets).
Record: Common trigger (SCO audio setup), happens every time audio is used.
### Step 8.3: DETERMINE THE FAILURE MODE SEVERITY
Without this fix, SCO audio connections simply fail. Users cannot use Bluetooth audio functionality (HFP/HSP profiles). This is a **functional failure** — a complete feature doesn't work.
Record: Functional failure — SCO audio doesn't work at all. Severity:
HIGH (complete loss of Bluetooth audio functionality).
### Step 8.4: CALCULATE RISK-BENEFIT RATIO
- **BENEFIT**: HIGH — enables Bluetooth audio on WL183x hardware
- **RISK**: VERY LOW — 10 lines of code, only affects WL183x devices, uses a well-tested quirk mechanism already proven with QCA and MTK
- **Ratio**: Very favorable for backporting
Record: Benefit HIGH, Risk VERY LOW. Clear favorable ratio.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: COMPILE THE EVIDENCE
**Evidence FOR backporting:**
- Fixes a real hardware bug: SCO audio completely fails on WL183x
- Hardware quirk — a recognized exception category for stable
- Small, surgical change (~10 lines, single file)
- Uses an established pattern (same quirk for QCA and MTK controllers)
- Reviewed and merged by Bluetooth subsystem maintainer
- Zero regression risk for non-affected devices
- The driver and compatible strings exist in all stable trees
- The quirk definition exists in v6.1+
**Evidence AGAINST backporting:**
- No Fixes: tag or explicit stable nomination (but expected for review candidates)
- Author is not a regular BT subsystem contributor (but patch was accepted by maintainer)
- Needs trivial API adjustment for stable trees < v6.16 (set_bit vs hci_set_quirk)
**UNRESOLVED:**
- None significant
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **YES** — tested on WL183x hardware, follows existing pattern
2. Fixes a real bug? **YES** — SCO audio fails completely
3. Important issue? **YES** — complete loss of Bluetooth audio functionality
4. Small and contained? **YES** — ~10 lines, single file
5. No new features or APIs? **YES** — just enables existing quirk for additional devices
6. Can apply to stable trees? **YES** — clean apply to 7.0, minor adjustment for older trees
### Step 9.3: CHECK FOR EXCEPTION CATEGORIES
This falls into the **hardware quirk/workaround** exception category. Adding a quirk to an existing driver for broken hardware is explicitly listed as appropriate for stable.
### Step 9.4: DECISION
This is a textbook hardware quirk for stable. It's small, obviously correct, fixes a real functional failure (no Bluetooth audio on WL183x), follows an established pattern, and carries virtually no regression risk.
---
## Verification
- [Phase 1] Parsed commit message: no Fixes: tag, no Reported-by, maintainer SOB from Luiz von Dentz
- [Phase 2] Diff analysis: ~10 lines added to 1 file, 3 locations (struct, probe, setup). Adds bool flag and quirk setting
- [Phase 3] git blame: code modified dates to v4.13-v4.16 (371805522f8709, 0e58d0cdb3eb6e), present in all stable trees
- [Phase 3] git show 05abad857277d: confirmed original quirk commit exists since v5.19
- [Phase 3] git merge-base checks: quirk in v5.19+, hci_set_quirk API in v6.16+ only
- [Phase 3] Verified WL183x compatibles exist in v5.15, v6.1, v6.6, v6.12
- [Phase 4] Found original submission on patchew.org: v2 series, v1→v2 evolution per reviewer feedback
- [Phase 4] Review discussion: Krzysztof Kozlowski suggested compatible- based approach
- [Phase 5] Verified identical quirk pattern used for QCA (d44e1dbda36ff) and MTK (e11523e97f474) in btusb.c
- [Phase 6] Verified quirk does NOT exist in v5.15 (cannot backport there), EXISTS in v6.1+
- [Phase 6] Verified hci_set_quirk() NOT in v6.12/v6.15; older trees need set_bit() instead
- [Phase 8] Failure mode: complete SCO audio failure on WL183x hardware.
Severity: HIGH
**YES**
drivers/bluetooth/hci_ll.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/bluetooth/hci_ll.c +10 -0
@@ -68,6 +68,7 @@ struct ll_device {struct gpio_desc *enable_gpio;struct clk *ext_clk;bdaddr_t bdaddr; +bool broken_enhanced_setup; };struct ll_struct {
@@ -658,6 +659,10 @@ static int ll_setup(struct hci_uart *hu)hci_set_quirk (hu->hdev,HCI_QUIRK_INVALID_BDADDR ); } +if (lldev->broken_enhanced_setup) +hci_set_quirk (hu->hdev, +HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN ); +/* Operational speed if any */ if (hu->oper_speed) speed = hu->oper_speed;
@@ -712,6 +717,11 @@ static int hci_ti_probe(struct serdev_device *serdev)of_property_read_u32 (serdev->dev.of_node,"max-speed" , &max_speed);hci_uart_set_speeds (hu,115200 , max_speed); +if (of_device_is_compatible (serdev->dev.of_node,"ti,wl1831-st" ) || +of_device_is_compatible (serdev->dev.of_node,"ti,wl1835-st" ) || +of_device_is_compatible (serdev->dev.of_node,"ti,wl1837-st" )) + lldev->broken_enhanced_setup = true; +/* optional BD address from nvram */ bdaddr_cell =nvmem_cell_get (&serdev->dev,"bd-address" );if (IS_ERR (bdaddr_cell)) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: mt76: abort ROC on chanctx changes
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit de62b24224ac1533c17b3d5bae77164a82ae2e49 ]
mt76_change_chanctx() calls mt76_phy_update_channel() which switches the hardware channel. If ROC is active on the same phy, this switches away from the ROC channel and clears offchannel, but leaves ROC state intact. Mac80211 still thinks the phy is on the ROC channel.
Abort any active ROC before proceeding, matching the pattern already used in add, remove, assign, unassign, and switch chanctx functions.
---
LLM Generated explanations, may be completely bogus:
I now have all the information needed for a complete analysis. Let me compile the findings.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: wifi: mt76: (MediaTek MT76 wireless driver)
- Action: "abort" - stopping an ongoing operation to prevent state inconsistency
- Summary: Abort ROC (Remain on Channel) on channel context changes
- Record: [wifi: mt76] [abort] [Abort active ROC when channel context changes to prevent state desync]
**Step 1.2: Tags**
- Link: https://patch.msgid.link/[email protected] (patch 5 in a series)
- Signed-off-by: Felix Fietkau <[email protected]> (mt76 subsystem maintainer/author)
- No Fixes: tag (expected for autosel candidates)
- No Reported-by (no external report; author found the issue)
- Record: Author is the mt76 subsystem creator. Patch 5 of a series.
**Step 1.3: Commit Body Analysis**
The commit describes a concrete bug mechanism:
1. mt76_change_chanctx() calls mt76_phy_update_channel() which switches the hardware channel
2. If ROC is active on the same phy, the hardware switches away from ROC channel
3. offchannel is cleared (set to false), but ROC state (roc_vif, roc_link, roc_work timer) remains intact
4. Mac80211 still believes the phy is on the ROC channel
Record: [State inconsistency between driver and mac80211 when chanctx changes during active ROC] [Symptom: mac80211 and hardware out of sync on channel state] [Bug introduced with channel.c in v6.14]
**Step 1.4: Hidden Bug Fix Detection**
This is clearly a bug fix, not cleanup. The commit explicitly describes a state desynchronization between the hardware and the mac80211 layer.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- 1 file changed: drivers/net/wireless/mediatek/mt76/channel.c
- +3 lines added (including blank line), 0 removed
- Function modified: mt76_change_chanctx()
- Scope: Single-function surgical fix
- Record: [channel.c +3/-0] [mt76_change_chanctx modified] [Single-file surgical fix]
**Step 2.2: Code Flow Change**
Before: mt76_change_chanctx() directly proceeds to cancel mac_work and update channel.
After: Before canceling mac_work, checks if ROC is active (phy->roc_vif) and aborts it via mt76_abort_roc(phy).
**Step 2.3: Bug Mechanism**
Verified by reading __mt76_set_channel() at mac80211.c:1045:phy->offchannel = offchannel;. When called from mt76_phy_update_channel() with offchannel = false, it clears the offchannel flag. But the ROC state (roc_vif, roc_link, roc_work) remains set, causing a desynchronization.
Classification: **Logic/correctness fix** - missing cleanup of related state when switching channels.
**Step 2.4: Fix Quality**
- Obviously correct: follows the exact pattern established by all other chanctx functions which abort scans
- Minimal: 2 lines of actual logic
- mt76_abort_roc() handles its own locking (takes dev->mutex internally), so calling it before the existing mutex_lock is correct
- Regression risk: extremely low - if ROC is not active (roc_vif == NULL), the check is a no-op
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: Blame**
From git blame, the buggy mt76_change_chanctx() was introduced by commit 82334623af0cd ("wifi: mt76: add chanctx functions for multi- channel phy support") by Felix Fietkau on 2025-01-02. This commit is in v6.14.
**Step 3.2: Fixes Tag**
No Fixes: tag present. The implicit target is 82334623af0cd which introduced mt76_change_chanctx without ROC abort handling.
**Step 3.3: File History**
The file has 7 commits since creation: the original, scanning code, ROC functions, offchannel link, a deref fix, abort scan/roc on hw restart, and relicensing. No conflicting changes near the modified area.
**Step 3.4: Author**
Felix Fietkau ([email protected]) is the creator and maintainer of the mt76 driver. He wrote the original channel.c file and all major chanctx functions.
**Step 3.5: Dependencies**
The commit is patch 5 of a series (msgid -5-). However, the fix is **self-contained**:
- mt76_abort_roc() already exists in the tree (since a8f424c1287cc, in v6.14)
- phy->roc_vif already exists in mt76.h
- mt76_abort_roc is declared in mt76.h and accessible from channel.c
- No other patch from the series is needed for this fix to work correctly.
---
## PHASE 4: MAILING LIST RESEARCH
**Step 4.1-4.5**: Lore.kernel.org is behind Anubis anti-bot protection and could not be accessed. The b4 dig also did not find a match for the message-id (possibly a future date issue). However, the patch URL is well-formed and the commit is by the subsystem maintainer, providing strong quality assurance.
Record: [UNVERIFIED: Could not access lore/b4 due to anti-bot protection] [Author is mt76 maintainer which provides confidence in quality]
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Functions Modified**
- mt76_change_chanctx() - modified to add ROC abort call
**Step 5.2: Callers**mt76_change_chanctx is a mac80211 callback assigned via ieee80211_ops. It is called by mac80211 whenever the channel context configuration changes (width changes, radar detection changes). This is a normal operation path triggered by AP configuration, DFS, or regulatory changes.
**Step 5.3: Callees**mt76_abort_roc() calls:
1. cancel_delayed_work_sync(&phy->roc_work) - cancels the ROC timeout
2. mt76_roc_complete(phy) under mutex - restores main channel, frees offchannel link, notifies mac80211
**Step 5.4: Call Chain**
Userspace/regulatory -> mac80211 -> mt76_change_chanctx -> bug triggers if ROC active. This is reachable from normal WiFi operation (e.g., DFS, bandwidth changes during P2P).
**Step 5.5: Similar Patterns**
All 5 other chanctx functions (add, remove, assign, unassign, switch) already call mt76_abort_scan(). The fix adds the equivalent mt76_abort_roc() to the one function that was missing it.
---
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: Buggy Code in Stable Trees**
- channel.c with mt76_change_chanctx was introduced in v6.14 (commit 82334623af0cd)
- mt76_abort_roc function exists since v6.14 (commit a8f424c1287cc)
- mt76_abort_roc is declared in mt76.h even in v6.14 (confirmed at line 1586)
- Bug affects: v6.14.y and later stable trees
**Step 6.2: Backport Complications**
The code in v6.14 matches exactly: mt76_change_chanctx() is identical to the pre-patch state in v7.0. The patch would apply cleanly. No forward-declaration issues since mt76_abort_roc is declared in mt76.h.
**Step 6.3: Related Fixes**
No alternative fix for this specific bug exists in stable trees.
---
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1: Subsystem**
- Subsystem: WiFi/wireless drivers (drivers/net/wireless/mediatek/mt76)
- Criticality: IMPORTANT - mt76 is one of the most widely used WiFi chipset drivers (MT7921, MT7922, MT7925, MT7996, etc.), found in many laptops and routers
**Step 7.2: Activity**
Actively maintained by Felix Fietkau with recent commits in the channel management area. The multi-radio/chanctx support is relatively new (v6.14).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Affected Users**
All users of MediaTek mt76 WiFi chipsets who use P2P, scanning, or any ROC functionality while channel context changes occur.
**Step 8.2: Trigger Conditions**
- Trigger: Channel context change (width change or radar detection) while ROC is active
- Likelihood: Moderate - occurs during DFS, bandwidth negotiation, or regulatory changes that happen to coincide with P2P discovery or off- channel management frames
- Not directly triggered by unprivileged users (requires wireless state machine interaction)
**Step 8.3: Failure Mode**
- Driver/mac80211 state desynchronization
- ROC operations fail silently or behave unpredictably
- P2P connection failures
- Dangling ROC state may cause subsequent operations to fail or produce unexpected behavior
- Severity: **MEDIUM-HIGH** (functional failure, not crash, but can break WiFi connectivity features)
**Step 8.4: Risk-Benefit**
- Benefit: Fixes real state inconsistency in a widely-used WiFi driver
- Risk: Extremely low - 2 lines, guarded by if (phy->roc_vif) check, calls well-tested existing function
- Ratio: Very favorable
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: Evidence Compilation**
FOR backporting:
- Fixes a real state desynchronization bug between driver and mac80211
- 2-line fix, obviously correct, minimal risk
- Written by the mt76 subsystem maintainer/author (Felix Fietkau)
- Follows the established pattern used by all other chanctx functions
- Self-contained, no dependencies on other patches
- Applies cleanly to v6.14+ stable trees
- mt76 is a widely-used WiFi driver
AGAINST backporting:
- No crash/panic, no data corruption - the bug causes functional issues (ROC state desync)
- No user reports (no Reported-by tag)
- Part of a larger series (other patches in series not evaluated)
UNRESOLVED:
- Could not access mailing list discussion due to anti-bot protection
- Could not verify if other patches in the series are also being considered
**Step 9.2: Stable Rules Checklist**
1. Obviously correct and tested? **YES** - trivial 2-line check, follows existing pattern, by subsystem maintainer
2. Fixes a real bug? **YES** - state desync between driver and mac80211 during ROC
3. Important issue? **MEDIUM-HIGH** - WiFi functionality failure, not crash
4. Small and contained? **YES** - 2 lines in 1 file
5. No new features? **YES** - purely a bug fix
6. Can apply to stable? **YES** - clean apply to v6.14+
**Step 9.3: Exception Categories**
Not an exception category; this is a standard bug fix.
**Step 9.4: Decision**
The fix is small, surgical, obviously correct, written by the subsystem maintainer, and fixes a real state inconsistency bug in a widely-used WiFi driver. The risk is minimal and the benefit is clear.
---
## Verification
- [Phase 1] Parsed tags: Link to patch.msgid.link, SOB by Felix Fietkau (mt76 maintainer)
- [Phase 2] Diff analysis: +3 lines (2 logic + 1 blank) in mt76_change_chanctx(), adds ROC abort guard
- [Phase 2] Verified __mt76_set_channel() at mac80211.c:1045 sets phy->offchannel = offchannel, confirming the bug mechanism
- [Phase 3] git blame: mt76_change_chanctx introduced by commit 82334623af0cd (v6.14) by Felix Fietkau
- [Phase 3] mt76_abort_roc introduced by a8f424c1287cc (v6.14), declared in mt76.h line 1586
- [Phase 3] Confirmed b36d55610215a (EXPORT_SYMBOL_GPL for abort_roc) is NOT in v6.14 but not needed since abort_roc is declared in mt76.h
- [Phase 3] Confirmed patch is self-contained: all referenced functions/fields exist in v6.14
- [Phase 4] UNVERIFIED: Could not access lore.kernel.org or b4 dig results due to anti-bot protection
- [Phase 5] Verified all 5 other chanctx functions call mt76_abort_scan() - this fix adds the analogous ROC abort
- [Phase 5] Verified mt76_abort_roc cancels work, locks mutex, calls mt76_roc_complete, unlocks - proper cleanup
- [Phase 6] 82334623af0cd is in v6.14 (confirmed via git merge-base --is-ancestor)
- [Phase 6] v6.14 mt76_change_chanctx code is identical to pre-patch v7.0 - clean apply
- [Phase 8] Failure mode: state desynchronization causing ROC/P2P failures, severity MEDIUM-HIGH
**YES**
drivers/net/wireless/mediatek/mt76/channel.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/channel.c +3 -0
@@ -88,6 +88,9 @@ void mt76_change_chanctx(struct ieee80211_hw *hw, IEEE80211_CHANCTX_CHANGE_RADAR)))return ; +if (phy->roc_vif) +mt76_abort_roc (phy); +cancel_delayed_work_sync (&phy->mac_work);mutex_lock (&dev->mutex);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 perf/amd/ibs: Limit ldlat->l3missonly dependency to Zen5
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 898138efc99096c3ee836fea439ba6da3cfafa4d ]
The ldlat dependency on l3missonly is specific to Zen 5; newer generations are not affected. This quirk is documented as an erratum in the following Revision Guide.
Erratum: 1606 IBS (Instruction Based Sampling) OP Load Latency Filtering
May Capture Unwanted Samples When L3Miss Filtering is Disabled
Revision Guide for AMD Family 1Ah Models 00h-0Fh Processors, Pub. 58251 Rev. 1.30 July 2025
https://bugzilla.kernel.org/attachment.cgi?id=309193
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [perf/amd/ibs] [Limit] Constrains the ldlat->l3missonly hardware workaround to only apply on Zen5 CPUs, per AMD Erratum 1606.
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
- Signed-off-by: Ravi Bangoria (author, AMD IBS expert at AMD)
- Signed-off-by: Peter Zijlstra (Intel) (perf subsystem maintainer)
- Acked-by: Namhyung Kim (perf co-maintainer)
- Link: patch.msgid.link URL to lore thread
- No Fixes: tag (expected for candidates)
- No Cc: stable (expected for candidates)
Record: Strong reviewer credentials. The patch was authored by the AMD IBS subsystem expert, merged by the perf maintainer, and acked by the perf co-maintainer.
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
The commit describes AMD Erratum 1606: "IBS OP Load Latency Filtering May Capture Unwanted Samples When L3Miss Filtering is Disabled." This erratum is specific to AMD Family 1Ah Models 00h-0Fh (Zen5). The original ldlat code unconditionally forced IBS_OP_L3MISSONLY alongside IBS_OP_LDLAT_EN, but this workaround should only apply to Zen5.
Record: Bug = erratum workaround applied too broadly. Symptom = on non- Zen5 hardware, ldlat filtering incorrectly forces L3-miss-only sampling. Root cause = original ldlat feature lacked CPU generation check.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: This IS a bug fix. It corrects incorrect hardware configuration on non-Zen5 processors. The word "Limit" indicates constraining overly broad behavior to only the affected hardware.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: INVENTORY**
- 1 file: arch/x86/events/amd/ibs.c (+4/-1, net +3 lines)
- Function modified: perf_ibs_init()
- Scope: single-file surgical fix
**Step 2.2: CODE FLOW CHANGE**
Before: When ldlat event is configured, ALWAYS sets both IBS_OP_L3MISSONLY | IBS_OP_LDLAT_EN.
After: Always sets IBS_OP_LDLAT_EN, but only sets IBS_OP_L3MISSONLY when cpu_feature_enabled(X86_FEATURE_ZEN5) is true.
**Step 2.3: BUG MECHANISM**
Category: Hardware workaround refinement. The Zen5 erratum 1606 required forcing l3missonly alongside ldlat, but this constraint was applied to all CPUs unconditionally. On post-Zen5 hardware, this forces unwanted filtering that limits the utility of ldlat profiling.
**Step 2.4: FIX QUALITY**
- Obviously correct: constrains documented erratum workaround to the affected CPU generation
- Minimal (3 actual lines of change)
- Zero regression risk on Zen5 (behavior unchanged); corrects behavior on all other generations
- No red flags
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME**
The buggy line (config |= IBS_OP_L3MISSONLY | IBS_OP_LDLAT_EN) was introduced by commit d20610c19b4a22 ("perf/amd/ibs: Add support for OP Load Latency Filtering") by Ravi Bangoria on 2025-02-05. This was the initial ldlat feature addition, first appearing in v6.15-rc1.
**Step 3.2: FIXES TAG**
No explicit Fixes: tag. The implicit fix target is d20610c19b4a22. That commit appeared in v6.15-rc1, confirmed by git tag --contains.
**Step 3.3: FILE HISTORY**
The file has active development from Ravi Bangoria. This is patch 2/5 in a series "[PATCH v2 0/5] perf/amd/ibs: Assorted fixes" but it is completely self-contained — it modifies a single line with no dependency on the other patches.
**Step 3.4: AUTHOR**
Ravi Bangoria is the primary AMD IBS developer with 10+ commits to this file. He works at AMD and is the domain expert for this code.
**Step 3.5: DEPENDENCIES**
None. The patch only changes the conditional expression around setting IBS_OP_L3MISSONLY. The check cpu_feature_enabled(X86_FEATURE_ZEN5) already exists in the tree (used in drivers/cpufreq/amd-pstate.c and drivers/platform/x86/amd/pmc/mp1_stb.c). X86_FEATURE_ZEN5 is defined in arch/x86/include/asm/cpufeatures.h.
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: PATCH DISCUSSION**
Found the original submission at spinics.net. The patch was v2 of a series. Namhyung Kim acked the entire series. No NAKs or concerns. Peter Zijlstra merged it on Feb 27, 2026 as commit 898138efc99096c3ee836fea439ba6da3cfafa4d in tip/perf/core.
**Step 4.2: REVIEWERS**
Peter Zijlstra (perf maintainer) committed it. Namhyung Kim (perf co- maintainer) acked it. Both appropriate reviewers for this subsystem.
**Step 4.3: BUG REPORT**
The bug is based on AMD's published erratum 1606 in the Revision Guide for Family 1Ah processors. This is vendor-documented hardware behavior, not a user-reported crash.
**Step 4.4: RELATED PATCHES**
This is patch 2/5. The other patches fix unrelated issues (interrupt accounting, PhyAddrVal bit, NMI safety, race condition). None of the other patches are in the 7.0 tree. This patch is fully standalone.
**Step 4.5: STABLE DISCUSSION**
No specific stable discussion found. The series was labeled "Assorted fixes" and contains patches with "fix" characteristics.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: KEY FUNCTIONS**
Modified function: perf_ibs_init() — the event initialization function for IBS PMU events.
**Step 5.2: CALLERS**perf_ibs_init() is registered as the .event_init callback for both perf_ibs_fetch and perf_ibs_op PMU structures. It's called during perf event creation via the perf_event_open() syscall path.
**Step 5.3-5.4: CALL CHAIN**
The ldlat path is gated by perf_ibs_ldlat_event(), which checks perf_ibs == &perf_ibs_op && (ibs_caps & IBS_CAPS_OPLDLAT). This means the code only runs on CPUs that advertise the ldlat capability. The path is reachable from userspace via perf_event_open().
**Step 5.5: SIMILAR PATTERNS** cpu_feature_enabled(X86_FEATURE_ZEN5) is used in 2 other places in the kernel for Zen5-specific behavior, confirming this is an established pattern.
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: CODE EXISTS IN STABLE?**
The ldlat feature (d20610c19b4a22) was introduced in v6.15-rc1. Only stable trees >= 6.15 contain this code. The 7.0 tree does contain the buggy code at line 359. Older stable trees (6.12.y, 6.6.y, 6.1.y, etc.) do NOT have this code.
**Step 6.2: BACKPORT COMPLICATIONS**
The diff context matches the 7.0 tree exactly (verified by reading line 359). Clean application expected.
**Step 6.3: RELATED FIXES IN STABLE**
No related fixes found for this issue in any stable tree.
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: SUBSYSTEM**
Subsystem: perf/x86/amd (performance monitoring for AMD CPUs).
Criticality: PERIPHERAL — affects AMD users who use IBS profiling. However, IBS is the primary hardware profiling mechanism on AMD, so it's important for AMD users who do performance analysis.
**Step 7.2: ACTIVITY**
Actively developed, with many recent commits from the author.
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: AFFECTED USERS**
AMD CPU users on post-Zen5 hardware who use IBS ldlat profiling (perf record -e ibs_op/ldlat=N/). This is a specialized but real use case.
**Step 8.2: TRIGGER CONDITIONS**
Any use of ldlat filtering on non-Zen5 AMD hardware that supports the ldlat capability (IBS_CAPS_OPLDLAT). Easily triggered when the feature is used.
**Step 8.3: FAILURE MODE SEVERITY**
Wrong profiling results — forces L3-miss-only sampling when user didn't request it, causing ldlat to only capture L3 cache misses instead of all loads meeting the latency threshold. Not a crash, security issue, or data corruption. Severity: LOW-MEDIUM.
**Step 8.4: RISK-BENEFIT RATIO**
- Benefit: MEDIUM — corrects hardware configuration for ldlat profiling on post-Zen5 hardware
- Risk: VERY LOW — 3-line change, zero behavior change on Zen5, obviously correct
- Ratio: Favorable
## PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
- Fixes a real bug: incorrect hardware configuration on non-Zen5 processors
- Small and surgical: 3 lines, single file
- Obviously correct: constrains documented erratum workaround to affected hardware
- Strong review: authored by subsystem expert, merged by perf maintainer, acked by co-maintainer
- Standalone: no dependencies on other patches
- Hardware erratum workaround (exception category)
- Clean application to 7.0 tree
**Evidence AGAINST backporting:**
- Failure mode is not severe (wrong perf results, not crash/corruption/security)
- Post-Zen5 hardware with ldlat capability may not be widely available yet
- Specialized debugging tool (perf IBS profiling)
- Only relevant for stable trees >= 6.15
**Stable Rules Checklist:**
1. Obviously correct? YES — constrains erratum to documented affected hardware
2. Fixes a real bug? YES — wrong hardware configuration on non-Zen5
3. Important issue? MEDIUM — wrong profiling results for hardware users
4. Small and contained? YES — 3 lines, 1 file
5. No new features or APIs? YES — only constrains existing behavior
6. Can apply to stable? YES — clean application to 7.0
**Exception category:** Hardware quirk/workaround refinement
## Verification
- [Phase 1] Parsed tags: Signed-off-by from AMD author, perf maintainer; Acked-by from perf co-maintainer
- [Phase 2] Diff analysis: 3 lines changed in perf_ibs_init(), adds cpu_feature_enabled(X86_FEATURE_ZEN5) guard around IBS_OP_L3MISSONLY
- [Phase 3] git blame: buggy code introduced in d20610c19b4a22 (v6.15-rc1), Ravi Bangoria
- [Phase 3] git tag --contains d20610c19b4a22: confirmed first in v6.15-rc1, present in 7.0
- [Phase 3] Author has 10+ commits to this file, is the AMD IBS domain expert
- [Phase 4] spinics.net: found original submission [PATCH v2 2/5], Namhyung Kim acked entire series
- [Phase 4] tip-bot2: merged as 898138efc99096c3ee836fea439ba6da3cfafa4d on Feb 27 2026
- [Phase 5] perf_ibs_init() is .event_init callback, reachable from perf_event_open() syscall
- [Phase 5] X86_FEATURE_ZEN5 defined in cpufeatures.h, cpu_feature_enabled() used elsewhere for Zen5
- [Phase 6] Verified line 359 in 7.0 tree matches pre-fix code; patch applies cleanly
- [Phase 6] ldlat code does NOT exist in stable trees < 6.15
- [Phase 8] Failure mode: wrong perf sampling results (not crash/security), severity LOW-MEDIUM
- UNVERIFIED: Could not access lore.kernel.org or bugzilla.kernel.org due to anti-bot measures; relied on spinics.net mirrors
## Decision
This is a small, obviously correct hardware erratum workaround fix from the subsystem expert. It constrains the Zen5-specific Erratum 1606 workaround to only apply on Zen5 hardware, preventing incorrect IBS configuration on newer AMD generations. While the failure mode (wrong profiling results) is not severe, the fix carries essentially zero regression risk and falls into the "hardware quirk/workaround" exception category. It is standalone, applies cleanly, and was reviewed by the appropriate maintainers.
**YES**
arch/x86/events/amd/ibs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/events/amd/ibs.c +4 -1
@@ -356,7 +356,10 @@ static int perf_ibs_init(struct perf_event *event) ldlat >>=7 ; config |= (ldlat -1 ) <<59 ; - config |=IBS_OP_L3MISSONLY |IBS_OP_LDLAT_EN ; + + config |=IBS_OP_LDLAT_EN ; +if (cpu_feature_enabled (X86_FEATURE_ZEN5 )) + config |=IBS_OP_L3MISSONLY ; }/*
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdkfd: Fix queue preemption/eviction failures by aligning control stack size to GPU page size
In reply to Sasha LevinFrom: Donet Tom <[email protected]>
[ Upstream commit 78746a474e92fc7aaed12219bec7c78ae1bd6156 ]
The control stack size is calculated based on the number of CUs and waves, and is then aligned to PAGE_SIZE. When the resulting control stack size is aligned to 64 KB, GPU hangs and queue preemption failures are observed while running RCCL unit tests on systems with more than two GPUs.
amdgpu 0048:0f:00.0: amdgpu: Queue preemption failed for queue withdoorbell_id: 80030008
amdgpu 0048:0f:00.0: amdgpu: Failed to evict process queues amdgpu 0048:0f:00.0: amdgpu: GPU reset begin!. Source: 4 amdgpu 0048:0f:00.0: amdgpu: Queue preemption failed for queue withdoorbell_id: 80030008
amdgpu 0048:0f:00.0: amdgpu: Failed to evict process queues amdgpu 0048:0f:00.0: amdgpu: Failed to restore process queues
This issue is observed on both 4 KB and 64 KB system page-size configurations.
This patch fixes the issue by aligning the control stack size to AMDGPU_GPU_PAGE_SIZE instead of PAGE_SIZE, so the control stack size will not be 64 KB on systems with a 64 KB page size and queue preemption works correctly.
Additionally, In the current code, wg_data_size is aligned to PAGE_SIZE, which can waste memory if the system page size is large. In this patch, wg_data_size is aligned to AMDGPU_GPU_PAGE_SIZE. The cwsr_size, calculated from wg_data_size and the control stack size, is aligned to PAGE_SIZE.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_queue.c +4 -3
@@ -444,10 +444,11 @@ void kfd_queue_ctx_save_restore_size(struct kfd_topology_device *dev)min (cu_num *40 , props->array_count / props->simd_arrays_per_engine *512 ) : cu_num * 32; - wg_data_size =ALIGN (cu_num *WG_CONTEXT_DATA_SIZE_PER_CU (gfxv, props),PAGE_SIZE ); + wg_data_size =ALIGN (cu_num *WG_CONTEXT_DATA_SIZE_PER_CU (gfxv, props), +AMDGPU_GPU_PAGE_SIZE ); ctl_stack_size = wave_num *CNTL_STACK_BYTES_PER_WAVE (gfxv) +8 ; ctl_stack_size =ALIGN (SIZEOF_HSA_USER_CONTEXT_SAVE_AREA_HEADER + ctl_stack_size, -PAGE_SIZE ); +AMDGPU_GPU_PAGE_SIZE );if ((gfxv /10000 *10000 ) ==100000 ) {/* HW design limits control stack size to 0x7000.
@@ -459,7 +460,7 @@ void kfd_queue_ctx_save_restore_size(struct kfd_topology_device *dev) props->ctl_stack_size = ctl_stack_size; props->debug_memory_size =ALIGN (wave_num *DEBUGGER_BYTES_PER_WAVE ,DEBUGGER_BYTES_ALIGN ); - props->cwsr_size = ctl_stack_size + wg_data_size; + props->cwsr_size =ALIGN (ctl_stack_size + wg_data_size,PAGE_SIZE );if (gfxv ==80002 )/* GFX_VERSION_TONGA */ props->eop_buffer_size =0x8000 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 clockevents: Prevent timer interrupt starvation
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit d6e152d905bdb1f32f9d99775e2f453350399a6a ]
Calvin reported an odd NMI watchdog lockup which claims that the CPU locked up in user space. He provided a reproducer, which sets up a timerfd based timer and then rearms it in a loop with an absolute expiry time of 1ns.
As the expiry time is in the past, the timer ends up as the first expiring timer in the per CPU hrtimer base and the clockevent device is programmed with the minimum delta value. If the machine is fast enough, this ends up in a endless loop of programming the delta value to the minimum value defined by the clock event device, before the timer interrupt can fire, which starves the interrupt and consequently triggers the lockup detector because the hrtimer callback of the lockup mechanism is never invoked.
As a first step to prevent this, avoid reprogramming the clock event device when:
- a forced minimum delta event is pending
- the new expiry delta is less then or equal to the minimum delta
Thanks to Calvin for providing the reproducer and to Borislav for testing and providing data from his Zen5 machine.
The problem is not limited to Zen5, but depending on the underlying clock event device (e.g. TSC deadline timer on Intel) and the CPU speed not necessarily observable.
This change serves only as the last resort and further changes will be made to prevent this scenario earlier in the call chain as far as possible.
[ tglx: Updated to restore the old behaviour vs. !force and delta <= 0 and
fixed up the tick-broadcast handlers as pointed out by Borislav ]
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
include/linux/clockchips.h | 2 ++ kernel/time/clockevents.c | 27 +++++++++++++++++++-------- kernel/time/hrtimer.c | 1 + kernel/time/tick-broadcast.c | 8 +++++++- kernel/time/tick-common.c | 1 + kernel/time/tick-sched.c | 1 + 6 files changed, 31 insertions(+), 9 deletions(-)
include/linux/clockchips.h +2 -0
@@ -80,6 +80,7 @@ enum clock_event_state {* @shift: nanoseconds to cycles divisor (power of two) * @state_use_accessors:current state of the device, assigned by the core code * @features: features +* @next_event_forced: True if the last programming was a forced event * @retries: number of forced programming retries * @set_state_periodic: switch state to periodic * @set_state_oneshot: switch state to oneshot
@@ -108,6 +109,7 @@ struct clock_event_device {u32 shift;enum clock_event_state state_use_accessors;unsigned int features; +unsigned int next_event_forced;unsigned long retries;int (*set_state_periodic)(struct clock_event_device *);
kernel/time/clockevents.c +19 -8
@@ -172,6 +172,7 @@ void clockevents_shutdown(struct clock_event_device *dev) {clockevents_switch_state (dev,CLOCK_EVT_STATE_SHUTDOWN ); dev->next_event =KTIME_MAX ; + dev->next_event_forced =0 ; }/**
@@ -305,7 +306,6 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, {unsigned long long clc;int64_t delta; -int rc;if (WARN_ON_ONCE (expires <0 ))return -ETIME ;
@@ -324,16 +324,27 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,return dev->set_next_ktime (expires, dev); delta =ktime_to_ns (ktime_sub (expires,ktime_get ())); -if (delta <=0 ) -return force ?clockevents_program_min_delta (dev) : -ETIME ; - delta =min (delta, (int64_t ) dev->max_delta_ns); - delta =max (delta, (int64_t ) dev->min_delta_ns); +/* Required for tick_periodic() during early boot */ +if (delta <=0 && !force) +return -ETIME ; + +if (delta > (int64_t )dev->min_delta_ns) { + delta =min (delta, (int64_t ) dev->max_delta_ns); + clc = ((unsigned long long ) delta * dev->mult) >> dev->shift; +if (!dev->set_next_event ((unsigned long ) clc, dev)) +return 0 ; + } - clc = ((unsigned long long ) delta * dev->mult) >> dev->shift; - rc = dev->set_next_event ((unsigned long ) clc, dev); +if (dev->next_event_forced) +return 0 ; -return (rc && force) ?clockevents_program_min_delta (dev) : rc; +if (dev->set_next_event (dev->min_delta_ticks, dev)) { +if (!force ||clockevents_program_min_delta (dev)) +return -ETIME ; + } + dev->next_event_forced =1 ; +return 0 ; }/*
kernel/time/hrtimer.c +1 -0
@@ -1880,6 +1880,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)BUG_ON (!cpu_base->hres_active); cpu_base->nr_events++; dev->next_event =KTIME_MAX ; + dev->next_event_forced =0 ;raw_spin_lock_irqsave (&cpu_base->lock, flags); entry_time = now =hrtimer_update_base (cpu_base);
kernel/time/tick-broadcast.c +7 -1
@@ -76,8 +76,10 @@ const struct clock_event_device *tick_get_wakeup_device(int cpu)*/ static void tick_broadcast_start_periodic (struct clock_event_device *bc) { -if (bc) +if (bc) { + bc->next_event_forced =0 ;tick_setup_periodic (bc,1 ); + } }/*
@@ -403,6 +405,7 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)bool bc_local;raw_spin_lock (&tick_broadcast_lock); + tick_broadcast_device.evtdev->next_event_forced =0 ;/* Handle spurious interrupts gracefully */ if (clockevent_state_shutdown (tick_broadcast_device.evtdev)) {
@@ -696,6 +699,7 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)raw_spin_lock (&tick_broadcast_lock); dev->next_event =KTIME_MAX ; + tick_broadcast_device.evtdev->next_event_forced =0 ; next_event =KTIME_MAX ;cpumask_clear (tmpmask); now =ktime_get ();
@@ -1063,6 +1067,7 @@ static void tick_broadcast_setup_oneshot(struct clock_event_device *bc, bc->event_handler = tick_handle_oneshot_broadcast; + bc->next_event_forced =0 ; bc->next_event =KTIME_MAX ;/*
@@ -1175,6 +1180,7 @@ void hotplug_cpu__broadcast_tick_pull(int deadcpu) }/* This moves the broadcast assignment to this CPU: */ + bc->next_event_forced =0 ;clockevents_program_event (bc, bc->next_event,1 ); }raw_spin_unlock_irqrestore (&tick_broadcast_lock, flags);
kernel/time/tick-common.c +1 -0
@@ -110,6 +110,7 @@ void tick_handle_periodic(struct clock_event_device *dev)int cpu =smp_processor_id ();ktime_t next = dev->next_event; + dev->next_event_forced =0 ;tick_periodic (cpu);/*
kernel/time/tick-sched.c +1 -0
@@ -1482,6 +1482,7 @@ static void tick_nohz_lowres_handler(struct clock_event_device *dev)struct tick_sched *ts =this_cpu_ptr (&tick_cpu_sched); dev->next_event =KTIME_MAX ; + dev->next_event_forced =0 ;if (likely (tick_nohz_handler (&ts->sched_timer) ==HRTIMER_RESTART ))tick_program_event (hrtimer_get_expires (&ts->sched_timer),1 );
Signature · 1 line
2.53.0
Thomas Gleixner
maintainerRe: [PATCH AUTOSEL 6.18] clockevents: Prevent timer interrupt starvation
Quoted 28 lines · Sasha Levin
From: Thomas Gleixner <[email protected]>
[ Upstream commit
d6e152d905bdb1f32f9d99775e2f453350399a6a]Calvin reported an odd NMI watchdog lockup which claims that the CPU locked up in user space. He provided a reproducer, which sets up a timerfd based timer and then rearms it in a loop with an absolute expiry time of 1ns.
As the expiry time is in the past, the timer ends up as the first expiring timer in the per CPU hrtimer base and the clockevent device is programmed with the minimum delta value. If the machine is fast enough, this ends up in a endless loop of programming the delta value to the minimum value defined by the clock event device, before the timer interrupt can fire, which starves the interrupt and consequently triggers the lockup detector because the hrtimer callback of the lockup mechanism is never invoked.
As a first step to prevent this, avoid reprogramming the clock event device when:
- a forced minimum delta event is pending
- the new expiry delta is less then or equal to the minimum deltaThanks to Calvin for providing the reproducer and to Borislav for testing and providing data from his Zen5 machine.
The problem is not limited to Zen5, but depending on the underlying clock event device (e.g. TSC deadline timer on Intel) and the CPU speed not necessarily observable.
Quoted 7 lines
This change serves only as the last resort and further changes will be made to prevent this scenario earlier in the call chain as far as possible.
[ tglx: Updated to restore the old behaviour vs. !force and delta <= 0 and
fixed up the tick-broadcast handlers as pointed out by Borislav ]Fixes d316c57ff6bf ("[PATCH] clockevents: add core functionality")
Please hold that off until
4096fd0e8eae ("clockevents: Add missing resets of the next_event_forced flag")
hits Linus tree. It fixes above commit and is marked for stable. So ideally you apply them together.
4096fd0e8eae will not apply to 7.0 and older. I'll provide you a updated version once Linus pulled it.
Thanks,
tglx
Thomas Gleixner
maintainerPATCH 1/1 clockevents: Add missing resets of the next_event_forced flag
commit 4096fd0e8eaea13ebe5206700b33f49635ae18e5 upstream.
The prevention mechanism against timer interrupt starvation missed to reset the next_event_forced flag in a couple of places:
- When the clock event state changes. That can cause the flag to be stale over a shutdown/startup sequence
- When a non-forced event is armed, which then prevents rearming before that event. If that event is far out in the future this will cause missed timer interrupts.
- In the suspend wakeup handler.
That led to stalls which have been reported by several people.
Add the missing resets, which fixes the problems for the reporters.
--- kernel/time/clockevents.c | 7 ++++++- kernel/time/tick-broadcast.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
kernel/time/clockevents.c +6 -1
@@ -94,6 +94,9 @@ static int __clockevents_switch_state(stif (dev->features &CLOCK_EVT_FEAT_DUMMY )return 0 ; +/* On state transitions clear the forced flag unconditionally */ + dev->next_event_forced =0 ; +/* Transition with new state-specific callbacks */ switch (state) {case CLOCK_EVT_STATE_DETACHED :
@@ -332,8 +335,10 @@ int clockevents_program_event(struct cloif (delta > (int64_t )dev->min_delta_ns) { delta =min (delta, (int64_t ) dev->max_delta_ns); clc = ((unsigned long long ) delta * dev->mult) >> dev->shift; -if (!dev->set_next_event ((unsigned long ) clc, dev)) +if (!dev->set_next_event ((unsigned long ) clc, dev)) { + dev->next_event_forced =0 ;return 0 ; + } }if (dev->next_event_forced)
kernel/time/tick-broadcast.c +1 -0
@@ -108,6 +108,7 @@ static struct clock_event_device *tick_gstatic void tick_oneshot_wakeup_handler (struct clock_event_device *wd) { + wd->next_event_forced =0 ;/* * If we woke up early and the tick was reprogrammed in the * meantime then this may be spurious but harmless.
Patch "clockevents: Add missing resets of the next_event_forced flag" has been added to the 7.0-stable tree
This is a note to let you know that I've just added the patch titled
clockevents: Add missing resets of the next_event_forced flag
to the 7.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
clockevents-add-missing-resets-of-the-next_event_forced-flag.patch
and it can be found in the queue-7.0 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Tue Apr 21 08:29:11 2026
From: Thomas Gleixner <[email protected]>
Date: Tue, 21 Apr 2026 08:26:19 +0200
Subject: clockevents: Add missing resets of the next_event_forced flag
To: Sasha Levin <[email protected]>, [email protected], [email protected]
Cc: Calvin Owens <[email protected]>, Borislav Petkov <[email protected]>, Sasha Levin <[email protected]>, [email protected], [email protected], [email protected], [email protected]
Message-ID: <87jyu0de2c.ffs@tglx>
From: Thomas Gleixner <[email protected]>
commit 4096fd0e8eaea13ebe5206700b33f49635ae18e5 upstream.
The prevention mechanism against timer interrupt starvation missed to reset the next_event_forced flag in a couple of places:
- When the clock event state changes. That can cause the flag to be stale over a shutdown/startup sequence
- When a non-forced event is armed, which then prevents rearming before that event. If that event is far out in the future this will cause missed timer interrupts.
- In the suspend wakeup handler.
That led to stalls which have been reported by several people.
Add the missing resets, which fixes the problems for the reporters.
--- kernel/time/clockevents.c | 7 ++++++- kernel/time/tick-broadcast.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
kernel/time/clockevents.c +6 -1
@@ -94,6 +94,9 @@ static int __clockevents_switch_state(stif (dev->features &CLOCK_EVT_FEAT_DUMMY )return 0 ; +/* On state transitions clear the forced flag unconditionally */ + dev->next_event_forced =0 ; +/* Transition with new state-specific callbacks */ switch (state) {case CLOCK_EVT_STATE_DETACHED :
@@ -332,8 +335,10 @@ int clockevents_program_event(struct cloif (delta > (int64_t )dev->min_delta_ns) { delta =min (delta, (int64_t ) dev->max_delta_ns); clc = ((unsigned long long ) delta * dev->mult) >> dev->shift; -if (!dev->set_next_event ((unsigned long ) clc, dev)) +if (!dev->set_next_event ((unsigned long ) clc, dev)) { + dev->next_event_forced =0 ;return 0 ; + } }if (dev->next_event_forced)
kernel/time/tick-broadcast.c +1 -0
@@ -108,6 +108,7 @@ static struct clock_event_device *tick_gstatic void tick_oneshot_wakeup_handler (struct clock_event_device *wd) { + wd->next_event_forced =0 ;/* * If we woke up early and the tick was reprogrammed in the * meantime then this may be spurious but harmless.
Patches currently in stable-queue which might be from [email protected] are
queue-7.0/clockevents-add-missing-resets-of-the-next_event_forced-flag.patch
Sasha Levin
maintainerPATCH 1/1 ASoC: tas2552: Allow audio enable GPIO to sleep
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 5ebc20921b7fff9feb44de465448e17a382c9965 ]
The audio enable GPIO is not toggled in any critical section where it could not sleep, allow the audio enable GPIO to sleep. This allows the driver to operate the audio enable GPIO connected to I2C GPIO expander.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: ASoC: tas2552 (sound, ASoC codec driver)
- Action verb: "Allow" - implies enabling something previously not supported
- Summary: Allow the enable GPIO to sleep, enabling use with I2C GPIO expanders
**Step 1.2: Tags**
- Signed-off-by: Marek Vasut <[email protected]> (author)
- Link:
https://patch.msgid.link/[email protected]
- Signed-off-by: Mark Brown <[email protected]> (ASoC subsystem maintainer)
- No Fixes: tag, no Reported-by, no Cc: stable (expected for autosel candidates)
**Step 1.3: Commit Body**
The commit describes that the enable GPIO is never toggled from atomic context, so it's safe to use the sleeping variant. This allows the driver to work when the enable GPIO is connected to an I2C GPIO expander (which requires sleeping for bus access).
**Step 1.4: Hidden Bug Fix Detection**
YES - this is a bug fix. Using gpiod_set_value() with a sleeping GPIO triggers WARN_ON(desc->gdev->can_sleep) in gpiolib.c:3899. This is incorrect API usage that produces kernel warnings.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- 1 file changed: sound/soc/codecs/tas2552.c
- 5 lines changed (identical substitution at each site)
- Functions modified: tas2552_runtime_suspend, tas2552_runtime_resume, tas2552_component_probe (x2), tas2552_component_remove
**Step 2.2: Code Flow Change**
Each hunk is identical: gpiod_set_value(tas2552->enable_gpio, X) -> gpiod_set_value_cansleep(tas2552->enable_gpio, X). No logic change — both APIs call the same gpiod_set_value_nocheck() internally.
**Step 2.3: Bug Mechanism**
Verified in drivers/gpio/gpiolib.c:
```3895:3901:drivers/gpio/gpiolib.c
int gpiod_set_value(struct gpio_desc *desc, int value)
{
VALIDATE_DESC(desc);
/* Should be using gpiod_set_value_cansleep() */
WARN_ON(desc->gdev->can_sleep);
return gpiod_set_value_nocheck(desc, value);
}
```vs:
```4359:4364:drivers/gpio/gpiolib.c
int gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
{
might_sleep();
VALIDATE_DESC(desc);
return gpiod_set_value_nocheck(desc, value);
}
```The bug: When the enable GPIO is on an I2C GPIO expander (can_sleep = true), gpiod_set_value() fires WARN_ON producing a kernel warning with stack trace on every suspend/resume cycle and on probe/remove.
**Step 2.4: Fix Quality**
- Obviously correct: the only change is which wrapper is used; both call the same underlying function
- Minimal: 5 identical one-line substitutions
- Zero regression risk: gpiod_set_value_cansleep() is strictly more permissive (works with both sleeping and non-sleeping GPIOs)
- All call sites are process context (PM callbacks, probe, remove) where sleeping is allowed
## PHASE 3: GIT HISTORY
**Step 3.1: Blame**
The gpiod_set_value() calls were introduced by commit 82cf77a1bd61d9 (Axel Lin, 2015) which simplified NULL checks. The original code existed since 5df7f71d5cdfbc (Dan Murphy, 2014). The buggy code has been present since v4.3-rc1.
**Step 3.2: Fixes tag**
No Fixes: tag present (expected for autosel).
**Step 3.3: File History**
Recent changes to the file are trivial: RUNTIME_PM_OPS conversion, removing redundant pm_runtime_mark_last_busy(), dropping unused GPIO includes. No conflicts.
**Step 3.4: Author**
Marek Vasut is a prolific kernel contributor with extensive work across DRM, DT bindings, and sound subsystems. Not the TAS2552 maintainer but a well-known contributor.
**Step 3.5: Prerequisites**
None. The change is standalone and independent of the RUNTIME_PM_OPS conversion. It touches only the gpiod_set_value() calls which exist in all stable trees.
## PHASE 4: MAILING LIST RESEARCH
**Step 4.1: Original Patch**
Found via b4 am. The patch was submitted as a single standalone patch on 2026-02-20. CC'd appropriate maintainers (Mark Brown, Takashi Iwai, TI engineers, linux-sound, linux-kernel). Applied directly by Mark Brown (ASoC maintainer). No v2/v3 revisions — accepted as-is.
**Step 4.2: Reviewers**
The patch was CC'd to all relevant TI and ASoC maintainers. Mark Brown (ASoC subsystem maintainer) applied it directly.
**Step 4.3: Bug Report**
No external bug report. Marek Vasut likely encountered this on a board with an I2C GPIO expander.
**Step 4.4: Related Patches**
This is a well-established pattern. Multiple identical fixes have been applied to other ASoC codecs:
- 5f83ee4b1f0c0 ASoC: tas5086: use sleeping variants of gpiod API
- 897d8e86bac76 ASoC: tlv320aic31xx: switch to gpiod_set_value_cansleep
- 5d7e0b1516dfc ASoC: dmic: Allow GPIO operations to sleep
- ea2a2ad17ca1e ASoC: dio2125: use gpiod_set_value_cansleep (had
Fixes: tag)
**Step 4.5: Stable Discussion**
No stable-specific discussion found. The dio2125 variant (ea2a2ad17ca1e) had a Fixes: tag and was likely auto-selected for stable.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Functions Modified**
- tas2552_runtime_suspend() — PM runtime callback
- tas2552_runtime_resume() — PM runtime callback
- tas2552_component_probe() — ASoC component probe (x2 sites)
- tas2552_component_remove() — ASoC component remove
**Step 5.2: Callers**
All five call sites are invoked from process context:
- Runtime PM callbacks are invoked by the PM subsystem in process context
- Component probe/remove are called from the ASoC registration path, always sleepable
**Step 5.3-5.4: No atomic context concerns**
All callers can sleep. The gpiod_set_value_cansleep() API with its might_sleep() is the correct choice.
**Step 5.5: Similar Patterns**
There are 5 remaining gpiod_set_value() calls in this file — this patch converts all of them. Other ASoC drivers have undergone identical transformations.
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: Buggy Code in Stable?**
YES. The gpiod_set_value() calls date back to commit 82cf77a1bd61d9 (v4.3-rc1, 2015). All active stable trees contain this code.
**Step 6.2: Backport Complications**
Minimal. The gpiod_set_value() lines are identical across all stable versions. The only difference is that pre-6.12 trees have #ifdef CONFIG_PM guards and SET_RUNTIME_PM_OPS instead of RUNTIME_PM_OPS, but this doesn't affect the changed lines. The patch should apply cleanly or with trivial context offset.
**Step 6.3: No Existing Fix**
No related fix for this specific issue in any stable tree.
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1:** Sound/ASoC codec driver — PERIPHERAL criticality (specific codec driver), but TAS2552 is used in embedded systems.
**Step 7.2:** The driver is mature/stable with minimal recent activity (only cleanup commits).
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Affected Users**
Users of the TAS2552 audio amplifier who have the enable GPIO connected to an I2C GPIO expander. This is a valid embedded hardware configuration.
**Step 8.2: Trigger Conditions**
The WARN_ON triggers on EVERY suspend/resume cycle and on driver probe/remove — not rare at all for affected hardware.
**Step 8.3: Failure Mode**
- WARN_ON with full stack trace in kernel log (MEDIUM severity normally)
- With panic_on_warn=1: kernel panic (CRITICAL severity for those configurations)
- Without panic_on_warn: console spam, log pollution, incorrect API usage flagged
**Step 8.4: Risk-Benefit**
- BENEFIT: Eliminates WARN_ON spam, enables I2C GPIO expander hardware correctly, fixes incorrect API usage
- RISK: Virtually zero — both APIs call the same underlying function, the only difference is the debug assertion
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: Evidence Summary**
FOR backporting:
- Fixes incorrect GPIO API usage that triggers WARN_ON
- Can cause kernel panic with panic_on_warn=1
- Trivially small (5 identical line substitutions), trivially correct
- Zero regression risk (both APIs have identical functional behavior)
- Well-established pattern applied to many other drivers
- Applied by ASoC subsystem maintainer Mark Brown
- Buggy code present since v4.3 — affects all stable trees
- No dependencies on other patches
AGAINST backporting:
- No Reported-by (no evidence of real-world user reports)
- WARN_ON is non-fatal in default configurations
- Affects specific hardware configuration (I2C GPIO expander)
- Could be seen as "enablement" rather than pure "fix"
**Step 9.2: Stable Rules Checklist**
1. Obviously correct and tested: YES — trivially provable
2. Fixes a real bug: YES — WARN_ON from incorrect API usage
3. Important issue: MEDIUM — WARN_ON, potential panic with panic_on_warn
4. Small and contained: YES — 5 lines in 1 file
5. No new features: YES — just API correction
6. Can apply to stable: YES — clean apply expected
**Step 9.3: Exception Categories**
This is closest to a hardware quirk/workaround — it makes the driver work correctly with I2C GPIO expanders.
## Verification
- [Phase 1] Parsed tags: Signed-off-by from author and ASoC maintainer, Link to patch.msgid
- [Phase 2] Diff analysis: 5 identical gpiod_set_value -> gpiod_set_value_cansleep substitutions
- [Phase 2] Verified gpiod_set_value() has WARN_ON(desc->gdev->can_sleep) at gpiolib.c:3899
- [Phase 2] Verified gpiod_set_value_cansleep() calls same gpiod_set_value_nocheck() at gpiolib.c:4363
- [Phase 3] git blame: gpiod_set_value calls introduced by commit 82cf77a1bd61d9 (v4.3-rc1, 2015)
- [Phase 3] git log: no conflicting changes in recent history
- [Phase 3] RUNTIME_PM_OPS conversion (1570c33f2f38b) does not affect the changed lines
- [Phase 4] b4 am: found original patch, single standalone submission
- [Phase 4] Multiple identical fixes applied to other ASoC codecs (tas5086, tlv320aic31xx, dmic, dio2125)
- [Phase 5] All call sites (runtime_suspend/resume, component_probe/remove) are process context — can sleep
- [Phase 6] Buggy code present since v4.3, exists in all active stable trees
- [Phase 6] Patch applies cleanly — no conflicting changes to the affected lines
- [Phase 8] WARN_ON triggers on every suspend/resume for affected hardware, not a rare event
The fix is trivially correct, carries zero regression risk, and fixes incorrect GPIO API usage that produces kernel warnings (and potential panics) for valid hardware configurations. While it's not fixing a crash in the default configuration, the WARN_ON is a genuine bug indicator, and this well-established pattern has been applied to many other drivers.
**YES**
sound/soc/codecs/tas2552.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/tas2552.c +5 -5
@@ -487,7 +487,7 @@ static int tas2552_runtime_suspend(struct device *dev)regcache_cache_only (tas2552->regmap, true);regcache_mark_dirty (tas2552->regmap); -gpiod_set_value (tas2552->enable_gpio,0 ); +gpiod_set_value_cansleep (tas2552->enable_gpio,0 );return 0 ; }
@@ -496,7 +496,7 @@ static int tas2552_runtime_resume(struct device *dev) {struct tas2552_data *tas2552 =dev_get_drvdata (dev); -gpiod_set_value (tas2552->enable_gpio,1 ); +gpiod_set_value_cansleep (tas2552->enable_gpio,1 );tas2552_sw_shutdown (tas2552,0 );
@@ -583,7 +583,7 @@ static int tas2552_component_probe(struct snd_soc_component *component)return ret; } -gpiod_set_value (tas2552->enable_gpio,1 ); +gpiod_set_value_cansleep (tas2552->enable_gpio,1 ); ret =pm_runtime_resume_and_get (component->dev);if (ret <0 ) {
@@ -608,7 +608,7 @@ static int tas2552_component_probe(struct snd_soc_component *component) probe_fail:pm_runtime_put_noidle (component->dev); -gpiod_set_value (tas2552->enable_gpio,0 ); +gpiod_set_value_cansleep (tas2552->enable_gpio,0 );regulator_bulk_disable (ARRAY_SIZE (tas2552->supplies), tas2552->supplies);
@@ -621,7 +621,7 @@ static void tas2552_component_remove(struct snd_soc_component *component)pm_runtime_put (component->dev); -gpiod_set_value (tas2552->enable_gpio,0 ); +gpiod_set_value_cansleep (tas2552->enable_gpio,0 ); };#ifdef CONFIG_PM
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: ath12k: Fix the assignment of logical link index
In reply to Sasha LevinFrom: Manish Dharanenthiran <[email protected]>
[ Upstream commit aecb569d7fb689e3e5b0005ca7bd0a2ef28915e8 ]
Per-link logical index is assigned from the global counter, ahsta->num_peer. This logical index is sent to firmware during peer association. If there is a failure in creating a link station, ath12k_mac_free_unassign_link_sta() clears the link, but does not decrement the logical link index. This will result in a higher logical link index for the next link station created. Also, if there is a leak in logical link index as we assign the incremented num_peer, then the index can exceed the maximum valid value of 15.
As an example, let's say we have a 2 GHz + 5 GHz + 6 GHz MLO setup. So the logical link indices that they have are 0, 1 and 2, respectively. If the 5 GHz link is removed, logical link index 1 becomes available, and num_peer is not reduced to 2 and still remains at 3. If a new 5 GHz link is added later, it gets the index 3, instead of reusing link index 1. Also, num_peer is increased to 4, though only 3 links are present.
To resolve these, create a bitmap, free_logical_link_idx, that tracks the available logical link indices. When a link station is created, select the first free logical index and when a link station is removed, mark its logical link index as available by setting the bit.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01181-QCAHKSWPL_SILICONZ-1
---
LLM Generated explanations, may be completely bogus:
Now I have all the information I need. Let me compile the final analysis.
---
## Complete Analysis
### PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1:**
- Subsystem: wifi: ath12k
- Action verb: "Fix"
- Summary: Fixes the assignment of logical link index for MLO (Multi- Link Operation) link stations.
**Step 1.2: Tags:**
- Tested-on: QCN9274 hw2.0 PCI — hardware tested
- Signed-off-by: Manish Dharanenthiran — original author
- Signed-off-by: Roopni Devanathan — submitter
- Reviewed-by: Rameshkumar Sundaram, Baochen Qiang, Vasanthakumar Thiagarajan — 3 Qualcomm reviewers
- Link: to patch.msgid.link — original submission
- Signed-off-by: Jeff Johnson — ath12k maintainer applied it
- No Fixes: tag, no Reported-by, no syzbot, no Cc: stable — expected for autoselection candidates.
**Step 1.3:** The commit message describes a clear bug: num_peer is a monotonically incrementing counter used to assign logical link indices. When links are removed, the counter is never decremented, causing "leakage" of index values. Over time with link add/remove cycles, the index exceeds the firmware's maximum valid value of 15.
**Step 1.4:** This is NOT a hidden bug fix — the subject explicitly says "Fix".
### PHASE 2: DIFF ANALYSIS
**Step 2.1:**
- core.h: 1 line changed (u8 num_peer -> u16 free_logical_link_idx_map)
- mac.c: ~20 lines changed across 3 functions
- Functions modified: ath12k_mac_free_unassign_link_sta, ath12k_mac_assign_link_sta, ath12k_mac_op_sta_state
- Scope: well-contained, single-subsystem fix
**Step 2.2:**
- In ath12k_mac_free_unassign_link_sta: adds ahsta->free_logical_link_idx_map |= BIT(arsta->link_idx) — returns the freed index to the pool
- In ath12k_mac_assign_link_sta: replaces arsta->link_idx = ahsta->num_peer++ with bitmap-based allocation using __ffs() + adds -ENOSPC check
- In ath12k_mac_op_sta_state: initializes ahsta->free_logical_link_idx_map = U16_MAX when a new station is created (all bits set = all indices free)
**Step 2.3:** Bug category: Logic/correctness bug — resource index leak. The old approach only increments, never reuses indices. The new bitmap approach properly tracks available indices.
**Step 2.4:** Fix quality:
- The fix is correct — bitmap tracks available indices, __ffs gets the lowest free bit, removal sets the bit back
- It adds a proper -ENOSPC check for when all indices are exhausted
- Minimal regression risk — the logic is straightforward and only touches the specific allocation/deallocation paths
- The U16_MAX initialization means 16 indices (0-15), which matches the firmware's maximum
### PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1:** git blame confirms both the buggy code (num_peer++ at line 7124) and the incomplete cleanup function were introduced by the same commit: 8e6f8bc286031 ("Add MLO station state change handling") by Sriram R, dated 2024-11-21, first in v6.14-rc1.
**Step 3.2:** No Fixes: tag present. The bug was introduced by 8e6f8bc286031.
**Step 3.3:** No intermediate fixes for the same issue. No prerequisites found — the patch modifies code that exists in the tree as-is.
**Step 3.4:** The author (Manish Dharanenthiran) is a regular ath12k contributor with 9+ commits in the subsystem. Jeff Johnson (ath12k maintainer) applied it.
**Step 3.5:** This is a standalone single-patch fix. No dependencies on other commits.
### PHASE 4: MAILING LIST RESEARCH
Lore was not accessible due to anti-bot protection. b4 dig could not find the exact commit (it hasn't landed in the main tree yet from the perspective of this 7.0 tree). The patch was sent to [email protected] and [email protected]. It was reviewed by 3 Qualcomm engineers and applied by the ath12k maintainer Jeff Johnson.
### PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1:** Modified functions: ath12k_mac_free_unassign_link_sta, ath12k_mac_assign_link_sta, ath12k_mac_op_sta_state
**Step 5.2:** arsta->link_idx is used in ath12k_peer_assoc_h_mlo() (line 3531) to populate ml->logical_link_idx which is sent to firmware via wmi.c line 2348 as ml_params->logical_link_idx. This is a WMI command parameter — an invalid value directly impacts firmware behavior.
**Step 5.4:** The path: ath12k_mac_op_sta_state -> ath12k_mac_assign_link_sta -> sets link_idx -> later used in ath12k_peer_assoc_h_mlo -> sent via WMI to firmware. This is a standard MLO station association path triggered during Wi-Fi connection setup.
### PHASE 6: STABLE TREE ANALYSIS
**Step 6.1:** The buggy code (num_peer field) was introduced in commit 8e6f8bc286031, first in v6.14-rc1. It is:
- **NOT in v6.13, v6.12, or any earlier LTS tree**
- Present in v6.14, v6.15, v6.16, v6.17, v6.18, v6.19, v7.0
For the 7.0.y stable tree specifically, the buggy code IS present.
**Step 6.2:** The code in v7.0 matches exactly what the patch expects (verified by reading lines 7096-7137 and 6771-6798 of mac.c). The patch should apply cleanly.
### PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1:** Subsystem: wireless driver (ath12k) — IMPORTANT for WiFi 7 users with Qualcomm QCN9274 and similar chipsets. MLO is a key WiFi 7 feature.
**Step 7.2:** ath12k is very actively developed (183 commits to mac.c between v6.14 and v7.0).
### PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1:** Affected users: Users of Qualcomm ath12k WiFi 7 hardware with MLO enabled (QCN9274, etc.).
**Step 8.2:** Trigger: Happens when MLO links are removed and re-added — occurs during roaming, channel switching, or temporary link degradation. In a typical MLO setup with frequent link changes, this can be triggered relatively easily.
**Step 8.3:** Failure mode: Sending an invalid logical link index (>15) to firmware can cause firmware malfunction, potential firmware crash, or incorrect MLO behavior. Severity: **HIGH** — firmware receives invalid commands.
**Step 8.4:**
- Benefit: Prevents firmware from receiving invalid index values during MLO operations, which could cause connection instability or firmware crashes
- Risk: LOW — the change is ~20 lines, well-contained, uses standard bitmap operations, reviewed by 3 engineers plus maintainer
- Ratio: Favorable
### PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
- Fixes a real, clearly described bug (index leak leading to invalid firmware commands)
- Small, well-contained fix (~20 lines across 2 files)
- Obviously correct bitmap-based approach
- 3 Reviewed-by tags from Qualcomm engineers + maintainer sign-off
- Tested on hardware (QCN9274 hw2.0)
- The buggy code exists in v7.0 (target tree)
- Should apply cleanly
**Evidence AGAINST backporting:**
- No Fixes: tag, no syzbot/crash report, no user-reported symptom
- Replaces a data structure member (counter -> bitmap), slightly more than a trivial patch
- MLO is relatively new; impact limited to WiFi 7 MLO users
- No explicit Cc: stable nomination
- The bug requires specific MLO link add/remove cycles to manifest
**Stable rules checklist:**
1. Obviously correct and tested? **Yes** — bitmap approach is straightforward, hardware tested
2. Fixes a real bug? **Yes** — index leak causing invalid firmware commands
3. Important issue? **Medium-High** — can cause firmware malfunction in MLO
4. Small and contained? **Yes** — ~20 lines in 2 files, single subsystem
5. No new features? **Correct** — pure bug fix
6. Can apply to stable? **Yes** — code matches cleanly
**Verification:**
- [Phase 1] Parsed tags: 3 Reviewed-by, tested-on, Link, maintainer SOB
- [Phase 2] Diff analysis: replaces num_peer counter with free_logical_link_idx_map bitmap across 3 functions
- [Phase 3] git blame: buggy code introduced in 8e6f8bc286031 (v6.14-rc1), confirmed by git merge-base --is-ancestor checks
- [Phase 3] git merge-base --is-ancestor 8e6f8bc286031 v6.13 → Not in v6.13; v6.14 → Yes
- [Phase 3] Author has 9+ ath12k commits, is a regular contributor
- [Phase 4] b4 dig could not find the commit (not merged in this tree); lore blocked by anti-bot
- [Phase 5] Traced link_idx usage: set in ath12k_mac_assign_link_sta → used in ath12k_peer_assoc_h_mlo (line 3531) → sent to firmware via WMI (wmi.c line 2348)
- [Phase 6] Buggy code confirmed present in v7.0 tree; code at lines 7096-7137 matches patch context exactly
- [Phase 6] NOT in v6.13 or earlier LTS trees (v6.12.y, v6.6.y, etc.)
- [Phase 8] Invalid logical_link_idx sent to firmware can cause firmware malfunction
- UNVERIFIED: Could not access lore discussion to check for reviewer stable nominations or concerns
This is a real bug fix for a resource index leak in WiFi 7 MLO handling that can lead to invalid firmware commands. The fix is small, self- contained, well-reviewed, and hardware-tested. The buggy code exists in the target 7.0.y tree.
**YES**
drivers/net/wireless/ath/ath12k/core.h | 2 +- drivers/net/wireless/ath/ath12k/mac.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +1 -1
@@ -522,7 +522,7 @@ struct ath12k_sta {u16 links_map;u8 assoc_link_id;u16 ml_peer_id; -u8 num_peer; +u16 free_logical_link_idx_map;enum ieee80211_sta_state state; };
drivers/net/wireless/ath/ath12k/mac.c +14 -2
@@ -6784,6 +6784,8 @@ static void ath12k_mac_free_unassign_link_sta(struct ath12k_hw *ah,return ; ahsta->links_map &= ~BIT (link_id); + ahsta->free_logical_link_idx_map |=BIT (arsta->link_idx); +rcu_assign_pointer (ahsta->link[link_id],NULL );synchronize_rcu ();
@@ -7102,6 +7104,7 @@ static int ath12k_mac_assign_link_sta(struct ath12k_hw *ah,struct ieee80211_sta *sta =ath12k_ahsta_to_sta (ahsta);struct ieee80211_link_sta *link_sta;struct ath12k_link_vif *arvif; +int link_idx;lockdep_assert_wiphy (ah->hw->wiphy);
@@ -7120,8 +7123,16 @@ static int ath12k_mac_assign_link_sta(struct ath12k_hw *ah,ether_addr_copy (arsta->addr, link_sta->addr); -/* logical index of the link sta in order of creation */ - arsta->link_idx = ahsta->num_peer++; +if (!ahsta->free_logical_link_idx_map) +return -ENOSPC ; + +/* +* Allocate a logical link index by selecting the first available bit +* from the free logical index map +*/ + link_idx =__ffs (ahsta->free_logical_link_idx_map); + ahsta->free_logical_link_idx_map &= ~BIT (link_idx); + arsta->link_idx = link_idx; arsta->link_id = link_id; ahsta->links_map |=BIT (arsta->link_id);
@@ -7630,6 +7641,7 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,if (old_state ==IEEE80211_STA_NOTEXIST && new_state ==IEEE80211_STA_NONE ) {memset (ahsta,0 ,sizeof (*ahsta)); + ahsta->free_logical_link_idx_map =U16_MAX ; arsta = &ahsta->deflink;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: fix DF NULL pointer issue for soc24
In reply to Sasha LevinFrom: Likun Gao <[email protected]>
[ Upstream commit 50808826a64b4957b7088c789e539dd0a75a1560 ]
If DF function not initialized, NULL pointer issue will happen on soc24.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information I need. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
- **Subsystem:** drm/amdgpu (AMD GPU driver)
- **Action verb:** "fix" - explicitly a bug fix
- **Summary:** Fix NULL pointer dereference when DF functions are not initialized on soc24
Record: [drm/amdgpu] [fix] [NULL pointer dereference when df.funcs is NULL in soc24_common_hw_init]
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
- **Signed-off-by:** Likun Gao (author)
- **Reviewed-by:** Hawking Zhang (AMD architect/maintainer for amdgpu)
- **Signed-off-by:** Alex Deucher (amdgpu subsystem maintainer)
- No Fixes: tag, no Cc: stable tag, no Reported-by (expected for manual review)
Record: Reviewed by Hawking Zhang (AMD subsystem architect) and merged by Alex Deucher (amdgpu maintainer). Strong trust signal.
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
The body says: "If DF function not initialized, NULL pointer issue will happen on soc24." This describes a concrete crash scenario: when adev->df.funcs is NULL and code dereferences it to check ->hw_init.
Record: [Bug: NULL pointer dereference] [Symptom: kernel oops/crash during GPU hw_init or resume] [Root cause: missing NULL check before dereferencing df.funcs pointer]
### Step 1.4: DETECT HIDDEN BUG FIXES
Not hidden - this is an explicit "fix" for a NULL pointer dereference.
Record: Not a hidden fix, explicitly labeled as a fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES
- **Files:** 1 file changed (drivers/gpu/drm/amd/amdgpu/soc24.c)
- **Lines:** 1 line modified (replacing one condition with a guarded condition)
- **Function:** soc24_common_hw_init()
- **Scope:** Single-line surgical fix
Record: [soc24.c: 1 line changed in soc24_common_hw_init()] [Scope:
single-line surgical fix]
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
Before:
```481:481:drivers/gpu/drm/amd/amdgpu/soc24.c
if (adev->df.funcs->hw_init)
```After:
```c
if (adev->df.funcs && adev->df.funcs->hw_init)
```The code was dereferencing adev->df.funcs (which can be NULL) to check hw_init. The fix adds a NULL guard.
Record: [Before: unconditional dereference of df.funcs -> After: guarded dereference with NULL check first]
### Step 2.3: IDENTIFY THE BUG MECHANISM
**Category: NULL pointer dereference (d)**
- adev->df.funcs can be NULL if the DF IP version doesn't match any known version in amdgpu_discovery.c
- The code dereferences this NULL pointer to check ->hw_init
- This causes a kernel oops
Record: [NULL pointer dereference] [df.funcs can be NULL when DF IP version is unrecognized; the fix adds a standard guard consistent with soc15.c patterns]
### Step 2.4: ASSESS THE FIX QUALITY
- Obviously correct: the pattern if (ptr && ptr->member) is idiomatic C null-guard
- Consistent: soc15.c already uses if (adev->df.funcs && adev->df.funcs->hw_init) and if (adev->df.funcs && adev->df.funcs->sw_init) - the exact same pattern
- Minimal: single condition addition, no behavior change when df.funcs is non-NULL
- Regression risk: zero - the only change is skipping the call when funcs is NULL (which would crash otherwise)
Record: [Obviously correct, minimal, zero regression risk. Matches existing patterns in soc15.c]
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
The buggy line was introduced by commit 73048bda46c308 ("drm/amdgpu:
Fix atomics on GFX12") by David Belanger on 2024-06-10. This commit added the DF hw_init call to soc24_common_hw_init but omitted the NULL check for adev->df.funcs, unlike how soc15.c handles it.
Record: [Buggy code introduced by 73048bda46c308, present in v6.11+]
### Step 3.2: FOLLOW THE FIXES TAG
No Fixes: tag present (expected for review candidates).
Record: [No Fixes: tag, but the implicit fix target is 73048bda46c308]
### Step 3.3: CHECK FILE HISTORYsoc24.c was created by 98b912c50e449 (first in v6.11). The buggy commit 73048bda46c308 was also added in v6.11. The file has had ~20 subsequent commits (refactoring handle pointers, etc.), but none touched this specific df.funcs line.
Record: [Standalone fix, no prerequisites beyond the original buggy commit]
### Step 3.4: CHECK THE AUTHOR
Likun Gao is a regular AMD GPU contributor with multiple recent commits to the amdgpu subsystem. The reviewer (Hawking Zhang) is the original soc24.c creator and AMD architect.
Record: [Author is a regular AMD contributor; reviewer is the subsystem architect]
### Step 3.5: DEPENDENCIES
This fix has no dependencies. It simply adds a NULL check guard to an existing conditional. It will apply to any tree that contains commit 73048bda46c308.
Record: [No dependencies, standalone fix]
---
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: PATCH DISCUSSION
Found the original submission at [spinics](https://www.spinics.net/lists/amd-gfx/msg138858.html). Submitted by Alex Deucher on March 6, 2026. No objections or NAKs visible. It was part of a batch of AMD GPU fixes.
Record: [Found submission on amd-gfx list, no objections, submitted in a batch of fixes by the maintainer]
### Step 4.2: REVIEWERS
Reviewed by Hawking Zhang (AMD architect), signed off by Alex Deucher (subsystem maintainer). Both are the top-level amdgpu maintainers.
Record: [Reviewed and merged by subsystem maintainers]
### Step 4.3-4.5: BUG REPORT / RELATED PATCHES / STABLE HISTORY No syzbot report, no explicit bug report URL. This appears to be an internally-discovered issue at AMD.
Record: [Internal AMD finding, no external bug report]
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.2: KEY FUNCTIONS AND CALLERS soc24_common_hw_init() is called:
1. During GPU initialization via the amd_ip_funcs table (line 588:
.hw_init = soc24_common_hw_init)
2. During resume via soc24_common_resume() (line 524-527)
Both are common execution paths for any system with soc24 hardware.
### Step 5.3-5.4: WHY df.funcs CAN BE NULL
In amdgpu_discovery.c, adev->df.funcs is set in a switch on DF_HWIP version. The default case is break (no assignment). If a soc24 device has a DF IP version not in the list, df.funcs remains NULL. This is the exact trigger.
### Step 5.5: SIMILAR PATTERNS
Verified: soc15.c consistently uses the guarded pattern:
- Line 1253: if (adev->df.funcs && adev->df.funcs->sw_init)
- Line 1264: if (adev->df.funcs && adev->df.funcs->sw_fini)
- Line 1498: if (adev->df.funcs && adev->df.funcs->get_clockgating_state)
- gmc_v9_0.c also guards with if (adev->df.funcs && ...)
soc24.c is the ONLY file missing this guard.
Record: [All other callers guard df.funcs with NULL check; soc24.c is the sole exception]
---
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: BUGGY CODE IN STABLE TREES
- soc24.c first appeared in v6.11
- The buggy commit 73048bda46c308 is in v6.11+
- Therefore the bug exists in stable trees: **6.11.y, 6.12.y, 7.0.y**
- Not present in 6.6.y or earlier (soc24.c doesn't exist there)
Record: [Bug exists in 6.11.y, 6.12.y, 7.0.y]
### Step 6.2: BACKPORT COMPLICATIONS
The fix is a single-line change. No conflicting refactoring has touched this specific line. Clean apply expected.
Record: [Expected clean apply to all affected stable trees]
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: SUBSYSTEM CRITICALITY
- **Subsystem:** GPU driver (drm/amdgpu) - IMPORTANT
- AMD GPUs are extremely common in desktop and laptop systems
- soc24 corresponds to RDNA4 generation (GC 12.0.x) - recent and actively shipping hardware
Record: [drm/amdgpu] [IMPORTANT - affects users of recent AMD GPUs]
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: WHO IS AFFECTED
All users with soc24 (RDNA4) AMD GPU hardware where the DF IP version doesn't match a listed version in discovery.
### Step 8.2: TRIGGER CONDITIONS
The crash triggers during:
- GPU hardware initialization (every boot)
- GPU resume from suspend (every suspend/resume cycle) These are unavoidable common paths.
### Step 8.3: FAILURE MODE SEVERITY
**CRITICAL** - NULL pointer dereference causes a kernel oops, crashing the system during boot or resume. The GPU driver is essential for display output.
### Step 8.4: RISK-BENEFIT RATIO
- **Benefit:** Prevents kernel oops on boot/resume for soc24 users - VERY HIGH
- **Risk:** 1-line addition of a NULL check, zero chance of regression - VERY LOW
- **Ratio:** Extremely favorable
Record: [Benefit: VERY HIGH (prevents crash), Risk: VERY LOW (1-line NULL guard)]
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: EVIDENCE COMPILATION
**FOR backporting:**
- Fixes a NULL pointer dereference (kernel oops/crash)
- Affects GPU init and resume paths (common, unavoidable paths)
- Single-line fix, obviously correct
- Matches existing defensive patterns in soc15.c, gmc_v9_0.c, amdgpu_ras.c
- Reviewed by AMD architect (Hawking Zhang), merged by subsystem maintainer (Alex Deucher)
- Zero regression risk
- Affects actively-shipping hardware (RDNA4)
**AGAINST backporting:**
- None identified
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **YES** - standard NULL guard, matches existing patterns, reviewed by maintainers
2. Fixes a real bug? **YES** - NULL pointer dereference → kernel oops
3. Important issue? **YES** - system crash during GPU init/resume (CRITICAL)
4. Small and contained? **YES** - 1 line changed in 1 file
5. No new features or APIs? **YES** - purely defensive check
6. Can apply to stable? **YES** - clean apply expected for 6.11.y+
### Step 9.3: EXCEPTION CATEGORIES
Not an exception case; this is a standard bug fix that meets all normal criteria.
### Step 9.4: DECISION
This is a textbook stable backport candidate: a one-line NULL pointer check that prevents a kernel oops during GPU initialization and resume on recent AMD hardware.
---
## Verification
- [Phase 1] Parsed tags: Reviewed-by: Hawking Zhang, SOB: Likun Gao, Alex Deucher
- [Phase 2] Diff analysis: 1 line changed in soc24_common_hw_init(), adds adev->df.funcs && guard
- [Phase 3] git blame: buggy code introduced in commit 73048bda46c308 (v6.11), "Fix atomics on GFX12"
- [Phase 3] git merge-base: confirmed 73048bda46c308 is in v6.11+, soc24.c first added in v6.11
- [Phase 4] Found original submission at spinics amd-gfx list, no NAKs or concerns
- [Phase 5] Grep for adev->df.funcs: soc15.c, gmc_v9_0.c, amdgpu_ras.c all use NULL guard; soc24.c is the only exception
- [Phase 5] amdgpu_discovery.c: df.funcs assignment has a `default:
break` that leaves funcs NULL for unrecognized DF versions
- [Phase 5] soc24_common_resume() calls soc24_common_hw_init(), confirming crash on both init and resume
- [Phase 6] Bug exists in 6.11.y, 6.12.y, 7.0.y; not in 6.6.y or earlier (soc24.c not present)
- [Phase 8] Failure mode: NULL deref -> kernel oops during GPU init/resume, severity CRITICAL
**YES**
drivers/gpu/drm/amd/amdgpu/soc24.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc24.c +1 -1
@@ -484,7 +484,7 @@ static int soc24_common_hw_init(struct amdgpu_ip_block *ip_block)if (adev->nbio.funcs->remap_hdp_registers) adev->nbio.funcs->remap_hdp_registers (adev); -if (adev->df.funcs->hw_init) +if (adev->df.funcs && adev->df.funcs->hw_init) adev->df.funcs->hw_init (adev);/* enable the doorbell aperture */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/ttm: Avoid invoking the OOM killer when reading back swapped content
In reply to Sasha LevinFrom: Thomas Hellström <[email protected]>
[ Upstream commit c6135f67aa37a4a744869f726d706bda091e6dfa ]
In situations where the system is very short on RAM, the shmem readback from swap-space may invoke the OOM killer.
However, since this might be a recoverable situation where the caller is indicating this by setting
struct ttm_operation_ctx::gfp_retry_mayfail to true, adjust the gfp value used by the allocation accordingly.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed for a thorough analysis. Let me compile everything.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: drm/ttm (DRM Translation Table Manager - GPU memory management)
- **Action verb**: "Avoid" (implies fixing an undesirable behavior)
- **Summary**: Prevent OOM killer invocation when reading back swapped GPU buffer content
Record: [drm/ttm] [Avoid] [Prevents unnecessary OOM killer invocation during shmem readback]
### Step 1.2: Tags
- **Signed-off-by**: Thomas Hellström <[email protected]> (author, TTM/Xe maintainer)
- **Reviewed-by**: Maarten Lankhorst <[email protected]> (DRM subsystem reviewer)
- **Acked-by**: Christian König <[email protected]> (TTM co- maintainer at AMD)
- **Link**: https://patch.msgid.link/20260317141856.237876-3-
[email protected]
Record: Reviewed by Maarten Lankhorst, Acked by Christian König (TTM maintainer). No Fixes: tag, no Reported-by tag. No syzbot link.
### Step 1.3: Commit Body
The commit explains that when the system is very short on RAM, the shmem readback from swap-space may invoke the OOM killer. Since the caller may be indicating a recoverable situation via gfp_retry_mayfail = true, the GFP value used by the shmem allocation should be adjusted to include __GFP_RETRY_MAYFAIL (try hard but don't OOM-kill) and __GFP_NOWARN (don't log warnings).
Record: Bug: OOM killer can be triggered during TTM swap readback even when the operation context indicates the situation is recoverable.
Symptom: Random processes killed by OOM killer unnecessarily. Root
cause: ttm_backup_copy_page() used shmem_read_folio() with default GFP flags that don't include __GFP_RETRY_MAYFAIL.
### Step 1.4: Hidden Bug Fix Detection
This is explicitly described as avoiding OOM killer invocation, which is a real behavioral bug. The gfp_retry_mayfail flag was already respected in the page allocation path (__ttm_pool_alloc) and in the restore structure allocation (ttm_pool_restore_and_alloc), but NOT in the swap readback path - an inconsistency that results in incorrect behavior.
Record: Yes, this is a genuine bug fix - the swap readback path was not honoring the gfp_retry_mayfail flag that other paths already respected.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **drivers/gpu/drm/ttm/ttm_backup.c**: +4/-2 (function signature + shmem_read_folio_gfp call)
- **drivers/gpu/drm/ttm/ttm_pool.c**: +5/-2 (building additional_gfp and passing it)
- **include/drm/ttm/ttm_backup.h**: +1/-1 (header declaration update)
- **Total**: ~10 lines changed
- **Functions modified**: ttm_backup_copy_page(), ttm_pool_restore_commit()
Record: 3 files, ~10 net lines. Single-purpose surgical fix. Scope: very small.
### Step 2.2: Code Flow Change
**Hunk 1** (ttm_backup.c): ttm_backup_copy_page() gains an additional_gfp parameter. The call changes from shmem_read_folio(mapping, idx) to shmem_read_folio_gfp(mapping, idx, mapping_gfp_mask(mapping) | additional_gfp). When additional_gfp is 0, behavior is identical to before (since shmem_read_folio() is a wrapper that calls shmem_read_folio_gfp() with mapping_gfp_mask(mapping)).
**Hunk 2** (ttm_pool.c): In ttm_pool_restore_commit(), when ctx->gfp_retry_mayfail is true, additional_gfp is set to __GFP_RETRY_MAYFAIL | __GFP_NOWARN; otherwise 0.
**Hunk 3** (ttm_backup.h): Declaration updated.
Record: Before: swap readback always used default GFP (may invoke OOM).
After: when caller opts into retry_mayfail, swap readback also respects it. Unchanged when flag is false.
### Step 2.3: Bug Mechanism
This is a **logic/correctness fix**: an existing flag (gfp_retry_mayfail) was inconsistently applied. The page allocation path already honored it, but the swap readback path did not. The consequence is unnecessary OOM killer invocation, which kills user processes.
Record: [Logic/correctness fix] The gfp_retry_mayfail flag was not propagated to the shmem readback path in ttm_backup_copy_page(). When the system was low on RAM and GPU content needed to be restored from swap, the OOM killer could fire instead of returning an error to the caller.
### Step 2.4: Fix Quality
- Obviously correct: uses the same pattern already present in other TTM paths
- Minimal and surgical: only 10 lines changed
- No regression risk: when gfp_retry_mayfail is false, additional_gfp = 0, making the behavior identical to before
- The shmem_read_folio_gfp() function already exists and is used by ttm_backup_backup_page() in the same file (line 105)
Record: Fix quality: excellent. Minimal, obviously correct, follows existing pattern, reviewed by maintainer. Regression risk: very low.
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
The buggy code in ttm_backup_copy_page() was introduced in e7b5d23e5d470 ("drm/ttm: Provide a shmem backup implementation") by Thomas Hellström on 2025-03-05. This first appeared in v6.15-rc1.
Record: Buggy code introduced in e7b5d23e5d470, first in v6.15-rc1.
### Step 3.2: Fixes Tag
No Fixes: tag present (expected for candidates needing manual review).
Record: No Fixes: tag. The implicit fix target is e7b5d23e5d470 (introduced the backup code).
### Step 3.3: File History
The ttm_backup.c file has had 8 changes since its introduction (mostly restructuring, export fixes, mm API changes). The core ttm_backup_copy_page() function has remained stable since introduction.
Record: File is relatively new (v6.15), stable code. No conflicting changes found.
### Step 3.4: Author Context
Thomas Hellström is the Intel TTM/Xe maintainer and the original author of the backup implementation. He wrote both the buggy code and the fix. This is the highest possible trust level for a patch author.
Record: Author is the subsystem maintainer and original code author.
### Step 3.5: Dependencies
This is patch 2/3 of a 3-patch series:
- Patch 1/3: Adds __GFP_NOWARN in __ttm_pool_alloc (different code path, independent)
- Patch 2/3: This commit (swap readback path)
- Patch 3/3: Kerneldoc update (independent)
Patch 2/3 is fully self-contained and applies independently.
Record: No dependencies on other patches in the series. Can apply standalone.
## PHASE 4: MAILING LIST RESEARCH
### Step 4.1: Original Discussion
Found via b4 mbox. The series was submitted as v2 on 2026-03-17. The cover letter describes it as "two small patches around the gfp_retry_mayfail behaviour." The author described the changes as "completely non-controversial."
### Step 4.2: Reviewers
- **Reviewed-by**: Maarten Lankhorst (DRM developer)
- **Acked-by**: Christian König (TTM maintainer at AMD)
- CI passed: Xe.CI.BAT success, Xe.CI.FULL success, CI.KUnit success
### Step 4.3: Bug Report
No specific bug report linked. This appears to be a code-review- identified issue where the author noticed the inconsistency between the page allocation path and the swap readback path.
### Step 4.4: Related Patches
Patch 1/3 is a related but independent fix. Patch 3/3 is documentation only.
Record: [Lore thread found] [v2 is the applied version] [Reviewed by Maarten Lankhorst, Acked by Christian König] [No specific stable nomination in discussion] [No concerns raised]
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
- ttm_backup_copy_page() - modified to accept additional GFP flags
- ttm_pool_restore_commit() - modified to compute and pass additional GFP flags
### Step 5.2: Callersttm_backup_copy_page() is called only from ttm_pool_restore_commit(). ttm_pool_restore_commit() is called from ttm_pool_restore_and_alloc() and __ttm_pool_alloc(). ttm_pool_restore_and_alloc() is called from ttm_tt_restore(), which is called from xe_tt_populate() (Intel Xe driver).
The call chain: GPU buffer access -> page fault -> xe_tt_populate -> ttm_tt_restore -> ttm_pool_restore_and_alloc -> ttm_pool_restore_commit -> ttm_backup_copy_page -> shmem_read_folio
### Step 5.3-5.4: Call Chain Reachability
This path is triggered when GPU buffer objects that were previously swapped out need to be restored - a normal operation when the system is under memory pressure. It's reachable during any GPU workload after swap has occurred.
Record: The buggy path is reachable during normal GPU operations (page fault handling for restored buffer objects). Users of Intel Xe and potentially AMD/Nouveau drivers are affected.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Code Existence in Stable
The ttm_backup.c file was introduced in v6.15-rc1. The buggy code exists in stable trees v6.15.y and later. For this 7.0 tree, the relevant stable trees are 6.15.y, 6.16.y, 6.17.y, 6.18.y, 6.19.y.
Record: Buggy code exists in 6.15.y+ stable trees.
### Step 6.2: Backport Complications
The patch should apply cleanly to 6.15.y+ trees since the code has been relatively stable. The d4ad53adfe21d ("Remove the struct ttm_backup abstraction") commit changed the function signatures in 6.15, so stable trees should have the same code structure.
Record: Expected clean apply for 6.15.y+.
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
DRM/TTM is the memory manager for GPU drivers (AMD, Intel, Nouveau). It's used by virtually all desktop/laptop Linux users with discrete or integrated GPUs.
Record: [DRM/TTM] [IMPORTANT - affects all GPU users]
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
All users with DRM/TTM GPU drivers (Intel Xe, AMD, Nouveau) who experience memory pressure during GPU workloads.
### Step 8.2: Trigger Conditions
- System must be under significant memory pressure
- GPU buffer objects must have been swapped out to shmem
- Application then needs those buffer objects restored
- This is a realistic scenario: heavy GPU workload + many applications = memory pressure
### Step 8.3: Failure Mode Severity
**OOM killer invocation** - kills user processes. This is a **HIGH** severity issue. The OOM killer is one of the most disruptive events in Linux - it selects and kills a process to free memory. Here, it fires unnecessarily because the caller indicated the situation is recoverable.
Record: Severity: HIGH (unnecessary OOM killer invocation killing user processes)
### Step 8.4: Risk-Benefit
- **Benefit**: HIGH - prevents unnecessary OOM kills during GPU memory restoration
- **Risk**: VERY LOW - 10 lines, follows existing pattern, zero behavior change when flag is false
- **Ratio**: Strongly favorable for backport
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes unnecessary OOM killer invocation (HIGH severity)
- Small, surgical fix (10 lines across 3 files)
- Follows existing pattern in the same codebase
- Written by subsystem maintainer
- Reviewed by DRM developer, Acked by TTM co-maintainer
- CI passed fully
- No dependencies on other patches
- Affects real users with GPU hardware under memory pressure
**AGAINST backporting:**
- No explicit Fixes: tag or Cc: stable (expected for manual review candidates)
- No specific user bug report (code-review identified)
- Only affects relatively new code (v6.15+)
### Step 9.2: Stable Rules Checklist
1. Obviously correct? **YES** - follows existing pattern, reviewed by maintainers
2. Fixes a real bug? **YES** - OOM killer invoked unnecessarily
3. Important issue? **YES** - OOM killer kills user processes
4. Small and contained? **YES** - 10 lines, single purpose
5. No new features? **YES** - extends existing flag handling to a missing code path
6. Applies to stable? **YES** - code exists in 6.15.y+
### Step 9.3: Exception Categories
Not an exception category - this is a straightforward bug fix.
## Verification
- [Phase 1] Parsed tags: Reviewed-by Maarten Lankhorst, Acked-by Christian König, Link to lore
- [Phase 2] Diff analysis: ~10 lines across 3 files; changes shmem_read_folio() to shmem_read_folio_gfp() with optional GFP flags
- [Phase 2] Verified shmem_read_folio() is wrapper for shmem_read_folio_gfp(mapping, idx, mapping_gfp_mask(mapping)) at include/linux/shmem_fs.h:179-182
- [Phase 3] git blame: buggy code in ttm_backup_copy_page() introduced in e7b5d23e5d470 (v6.15-rc1)
- [Phase 3] Verified existing gfp_retry_mayfail handling in __ttm_pool_alloc() at line 728-729 and ttm_pool_restore_and_alloc() at line 858-859 - confirms inconsistency
- [Phase 3] git describe: TTM backup code first appeared in v6.15-rc1
- [Phase 4] b4 mbox retrieved 12-message thread; cover letter describes "two small patches around gfp_retry_mayfail behaviour"
- [Phase 4] Christian König acked the series; Thomas Hellström called changes "completely non-controversial"
- [Phase 4] Patch 1/3 modifies different code path (independent); patch 3/3 is kerneldoc only
- [Phase 5] ttm_backup_copy_page() called from ttm_pool_restore_commit() -> ttm_pool_restore_and_alloc() -> ttm_tt_restore() -> xe_tt_populate()
- [Phase 5] Verified gfp_retry_mayfail = true is set by Intel Xe (6 call sites), AMD amdgpu (2 call sites), Nouveau (1 call site)
- [Phase 6] Code exists in 6.15.y+ stable trees
- [Phase 8] Failure mode: OOM killer invocation, severity HIGH
**YES**
drivers/gpu/drm/ttm/ttm_backup.c | 6 ++++-- drivers/gpu/drm/ttm/ttm_pool.c | 5 ++++- include/drm/ttm/ttm_backup.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_backup.c +4 -2
@@ -44,18 +44,20 @@ void ttm_backup_drop(struct file *backup, pgoff_t handle)* @dst: The struct page to copy into. * @handle: The handle returned when the page was backed up. * @intr: Try to perform waits interruptible or at least killable. +* @additional_gfp: GFP mask to add to the default GFP mask if any. * * Return: 0 on success, Negative error code on failure, notably * -EINTR if @intr was set to true and a signal is pending. */ int ttm_backup_copy_page (struct file *backup,struct page *dst, -pgoff_t handle,bool intr) +pgoff_t handle,bool intr,gfp_t additional_gfp) {struct address_space *mapping = backup->f_mapping;struct folio *from_folio;pgoff_t idx =ttm_backup_handle_to_shmem_idx (handle); - from_folio =shmem_read_folio (mapping, idx); + from_folio =shmem_read_folio_gfp (mapping, idx,mapping_gfp_mask (mapping) + | additional_gfp);if (IS_ERR (from_folio))return PTR_ERR (from_folio);
drivers/gpu/drm/ttm/ttm_pool.c +4 -1
@@ -530,6 +530,8 @@ static int ttm_pool_restore_commit(struct ttm_pool_tt_restore *restore, p = first_page[i];if (ttm_backup_page_ptr_is_handle (p)) {unsigned long handle =ttm_backup_page_ptr_to_handle (p); +gfp_t additional_gfp = ctx->gfp_retry_mayfail ? + __GFP_RETRY_MAYFAIL | __GFP_NOWARN :0 ;if (IS_ENABLED (CONFIG_FAULT_INJECTION ) && ctx->interruptible &&should_fail (&backup_fault_inject,1 )) {
@@ -543,7 +545,8 @@ static int ttm_pool_restore_commit(struct ttm_pool_tt_restore *restore, } ret =ttm_backup_copy_page (backup, restore->alloced_page + i, - handle, ctx->interruptible); + handle, ctx->interruptible, + additional_gfp);if (ret)break ;
include/drm/ttm/ttm_backup.h +1 -1
@@ -56,7 +56,7 @@ ttm_backup_page_ptr_to_handle(const struct page *page)void ttm_backup_drop (struct file *backup,pgoff_t handle);int ttm_backup_copy_page (struct file *backup,struct page *dst, -pgoff_t handle,bool intr); +pgoff_t handle,bool intr,gfp_t additional_gfp); s64 ttm_backup_backup_page(struct file *backup, struct page *page,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/vc4: Release runtime PM reference after binding V3D
In reply to Sasha LevinFrom: Maíra Canal <[email protected]>
[ Upstream commit aaefbdde9abdc43699e110679c0e10972a5e1c59 ]
The vc4_v3d_bind() function acquires a runtime PM reference via pm_runtime_resume_and_get() to access V3D registers during setup. However, this reference is never released after a successful bind. This prevents the device from ever runtime suspending, since the reference count never reaches zero.
Release the runtime PM reference by adding pm_runtime_put_autosuspend() after autosuspend is configured, allowing the device to runtime suspend after the delay.
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
drivers/gpu/drm/vc4/vc4_v3d.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_v3d.c +1 -0
@@ -479,6 +479,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,40 );/* a little over 2 frames. */ +pm_runtime_put_autosuspend (dev);return 0 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: i2c: mt9p031: Check return value of devm_gpiod_get_optional() in mt9p031_probe()
In reply to Sasha LevinFrom: Chen Ni <[email protected]>
[ Upstream commit c8e0585dce5df525308f0fba40b618df03aaf7fc ]
The devm_gpiod_get_optional() function may return an error pointer (ERR_PTR) in case of a genuine failure during GPIO acquisition, not just NULL which indicates the legitimate absence of an optional GPIO.
Add an IS_ERR() check after the function call to catch such errors and propagate them to the probe function, ensuring the driver fails to load safely rather than proceeding with an invalid pointer.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed. Here is my complete analysis:
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: Subject Line**
- Subsystem: media: i2c: mt9p031
- Action verb: "Check" — adding a missing return value check (= fixing an unchecked error)
- Summary: Add IS_ERR check for devm_gpiod_get_optional() in the driver's probe function
**Step 1.2: Tags**
- Signed-off-by: Chen Ni (author), Sakari Ailus (media sub-maintainer), Mauro Carvalho Chehab (media subsystem maintainer)
- No Fixes: tag (expected for commits under review)
- No Reported-by, Tested-by, Cc: stable
- Record: Patch was reviewed by two maintainers in the media subsystem chain. No syzbot, no bug report.
**Step 1.3: Commit Body**
- Explains that devm_gpiod_get_optional() can return ERR_PTR on genuine failure, not just NULL
- Without the check, the driver proceeds with an invalid pointer
- The symptom: driver loads with an invalid (ERR_PTR) value stored in mt9p031->reset, which will cause a crash when later dereferenced
**Step 1.4: Hidden Bug Fix Detection**
- This IS a bug fix: a missing error check for a function that can return error pointers. Without it, the driver proceeds with an invalid pointer that will eventually be dereferenced.
## PHASE 2: DIFF ANALYSIS
**Step 2.1: Inventory**
- Single file: drivers/media/i2c/mt9p031.c
- +4 lines, -0 lines
- Function modified: mt9p031_probe()
- Scope: Single-file surgical fix
**Step 2.2: Code Flow Change**
- BEFORE: devm_gpiod_get_optional() return stored directly in mt9p031->reset without error checking. If it returns ERR_PTR, the invalid pointer persists.
- AFTER: IS_ERR check added; on error, ret is set and execution jumps to done: cleanup label.
**Step 2.3: Bug Mechanism**
This is a **memory safety / invalid pointer dereference fix**. The mt9p031->reset field is used in three places:
```315:316:drivers/media/i2c/mt9p031.c
if (mt9p031->reset) {
gpiod_set_value(mt9p031->reset, 1);
``````337:338:drivers/media/i2c/mt9p031.c
if (mt9p031->reset) {
gpiod_set_value(mt9p031->reset, 0);
``````352:353:drivers/media/i2c/mt9p031.c
if (mt9p031->reset) {
gpiod_set_value(mt9p031->reset, 1);
```ERR_PTR values are non-NULL, so if (mt9p031->reset) evaluates to TRUE, and gpiod_set_value() will dereference the invalid pointer → kernel oops.
**Step 2.4: Fix Quality**
- Obviously correct: standard IS_ERR/PTR_ERR pattern used throughout the kernel
- Minimal and surgical
- Cannot introduce regression (only adds an error check before existing code)
- Goes to the existing done: cleanup label which properly frees resources
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: Blame**
The unchecked devm_gpiod_get_optional() was introduced in commit 7c3be9f812be6c ("[media] v4l: mt9p031: Convert to the gpiod API") by Laurent Pinchart, first appearing in v4.1-rc1. The bug has existed for ~11 years.
**Step 3.2: Fixes Tag**
No Fixes: tag present. The implicit fix target is 7c3be9f812be6c from v4.1-rc1.
**Step 3.3: File History**
There have been ~23 changes to this file since v5.10, but the specific devm_gpiod_get_optional call and surrounding lines have been stable since introduction. The fix is standalone — no dependencies on other patches.
**Step 3.4: Author**
Chen Ni is a prolific contributor of "check return value" patches. Two identical-pattern patches by the same author for adin1110 and max98390 have been accepted in the same timeframe, confirming this is a recognized bug pattern.
**Step 3.5: Dependencies**
None. The fix is self-contained: it adds 4 lines using only existing variables (ret) and labels (done:).
## PHASE 4: MAILING LIST RESEARCH
**Step 4.1: Original Discussion**
Found via b4 dig:
https://patch.msgid.link/[email protected]
Single submission, accepted without review comments (common for trivially correct patches).
**Step 4.2: Reviewers**
Sakari Ailus (linux-media sub-maintainer) applied the patch. Mauro Carvalho Chehab (media subsystem maintainer) signed off. Both are the correct maintainers for this code.
**Step 4.3: Bug Report**
No external bug report. This was found by code inspection.
**Step 4.4: Related Patches**
The similar adin1110 patch (78211543d2e44) has a Fixes: tag and was accepted. The mt9p031 version lacks a Fixes: tag but addresses the same class of bug.
**Step 4.5: Stable History**
No stable-specific discussion found.
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: Modified Functions**
Only mt9p031_probe() is modified.
**Step 5.2: Callers of Affected Code**mt9p031_probe() is the I2C driver probe function, called during device registration. The mt9p031->reset field is then used in:
- mt9p031_power_on() ← called from mt9p031_registered() and __mt9p031_set_power()
- mt9p031_power_off() ← called from mt9p031_registered() and __mt9p031_set_power()
These are called during normal device operation (open/close/stream).
**Step 5.3-5.4: Call Chain**
The crash path: user opens the V4L2 device → mt9p031_open() → mt9p031_set_power() → __mt9p031_set_power() → mt9p031_power_on() → gpiod_set_value(invalid_ptr) → **kernel oops**.
**Step 5.5: Similar Patterns**
The devm_gpiod_get_optional() documentation explicitly states it can return IS_ERR codes. This same missing-check pattern was found and fixed in at least two other drivers simultaneously.
## PHASE 6: STABLE TREE ANALYSIS
**Step 6.1: Code Existence in Stable**
The buggy devm_gpiod_get_optional() call has existed since v4.1-rc1 and is present in ALL current stable trees (5.4.y, 5.10.y, 5.15.y, 6.1.y, 6.6.y, 6.12.y).
**Step 6.2: Backport Complications**
The surrounding code at the devm_gpiod_get_optional() call site hasn't changed. The done: label and cleanup pattern are the same. Patch should apply cleanly or with minimal offset adjustments to older stable trees.
**Step 6.3: Related Fixes Already in Stable** No prior fix for this bug exists in any stable tree.
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1: Subsystem**
- drivers/media/i2c/mt9p031.c — Camera sensor driver (Aptina MT9P031/MT9P006)
- Criticality: PERIPHERAL — specific embedded/industrial camera sensor
- Used in embedded systems, BeagleBone, and similar platforms
**Step 7.2: Subsystem Activity**
Moderately active — mostly cleanups and API conversions recently, indicating a mature driver.
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: Affected Users**
Users of the Aptina MT9P031/MT9P006 camera sensor on ARM/DT-based platforms.
**Step 8.2: Trigger Conditions**
- devm_gpiod_get_optional() returns ERR_PTR, most commonly -EPROBE_DEFER (deferred probing)
- Deferred probing is common on DT-based ARM systems where probe order is non-deterministic
- Can also occur with pinctrl errors, GPIO controller failures, etc.
- Likelihood: LOW to MEDIUM on affected platforms
**Step 8.3: Failure Mode Severity**
Kernel oops (invalid pointer dereference in gpiod_set_value()) → **HIGH** severity when triggered. System crash, potential data loss.
**Step 8.4: Risk-Benefit**
- BENEFIT: Prevents kernel oops on GPIO acquisition failure — moderate benefit (niche hardware, realistic trigger)
- RISK: Very low — 4 lines, adds only an error check, standard pattern, cannot introduce regression
- Ratio: Favorable
## PHASE 9: FINAL SYNTHESIS
**Evidence FOR backporting:**
- Fixes a real bug: invalid pointer stored and later dereferenced → kernel oops
- Very small fix: 4 lines, single file, standard IS_ERR pattern
- Obviously correct: follows the kernel's universal error-checking convention
- Zero regression risk
- Buggy code present in ALL stable trees since v4.1
- Reviewed and accepted by both media sub-maintainer and maintainer
- Realistic trigger (deferred probing is common on DT/ARM systems)
- Clean apply expected (code unchanged at patch site since v4.1)
- Similar patches for same bug class accepted elsewhere
**Evidence AGAINST backporting:**
- Niche hardware (MT9P031 camera sensor, embedded use)
- No user bug report — found by code inspection
- No Fixes: tag in the commit
- Trigger requires GPIO acquisition failure, which may be uncommon in practice for this specific driver
**Stable Rules Checklist:**
1. Obviously correct and tested? **YES** — standard IS_ERR/PTR_ERR pattern
2. Fixes a real bug? **YES** — invalid pointer dereference → crash
3. Important issue? **YES** — kernel oops on affected hardware
4. Small and contained? **YES** — 4 lines, single file
5. No new features or APIs? **YES** — only an error check
6. Can apply to stable? **YES** — code unchanged at patch site
## Verification
- [Phase 1] Parsed tags: Signed-off-by from author + two media maintainers. No Fixes, Reported-by, or Cc: stable.
- [Phase 2] Diff analysis: 4 lines added in mt9p031_probe(), adds IS_ERR check after devm_gpiod_get_optional().
- [Phase 2] Confirmed ERR_PTR values are non-NULL, verified if (mt9p031->reset) checks at lines 315, 337, 352 would pass with ERR_PTR values.
- [Phase 3] git blame: buggy code introduced in commit 7c3be9f812be6c (v4.1-rc1), confirmed with git describe --contains.
- [Phase 3] git log: no prior fix for this issue exists.
- [Phase 4] b4 dig -c c8e0585dce5df: found original submission at
https://patch.msgid.link/[email protected]
- [Phase 4] Mbox downloaded: no review discussion beyond the submission itself.
- [Phase 4] Two similar patches by same author (78211543d2e44 adin1110, a1d14d8364eac max98390) confirmed accepted.
- [Phase 5] Traced call chain: probe → power_on → gpiod_set_value(invalid) → oops.
- [Phase 5] Confirmed devm_gpiod_get_optional() documentation at line 68 of gpiolib-devres.c states it returns IS_ERR codes on failure.
- [Phase 6] Buggy code exists in all stable trees (v4.1+). No conflicting changes at patch site.
- [Phase 6] File has had changes in stable windows, but the devm_gpiod_get_optional call site is unchanged since v4.1.
- [Phase 8] Failure mode: kernel oops (invalid pointer dereference), severity HIGH. Trigger: GPIO acquisition error (deferred probing), probability LOW-MEDIUM.
The fix is small, obviously correct, standalone, and prevents a kernel oops on a realistic error path. It meets all stable kernel criteria.
**YES**
drivers/media/i2c/mt9p031.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/i2c/mt9p031.c +4 -0
@@ -1183,6 +1183,10 @@ static int mt9p031_probe(struct i2c_client *client) mt9p031->reset =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (mt9p031->reset)) { + ret =PTR_ERR (mt9p031->reset); + goto done; + } ret =mt9p031_clk_setup (mt9p031);if (ret)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 Bluetooth: hci_sync: annotate data-races around hdev->req_status
In reply to Sasha LevinFrom: Cen Zhang <[email protected]>
[ Upstream commit b6807cfc195ef99e1ac37b2e1e60df40295daa8c ]
__hci_cmd_sync_sk() sets hdev->req_status under hdev->req_lock:
hdev->req_status = HCI_REQ_PEND;
However, several other functions read or write hdev->req_status without holding any lock:
- hci_send_cmd_sync() reads req_status in hci_cmd_work (workqueue)
- hci_cmd_sync_complete() reads/writes from HCI event completion
- hci_cmd_sync_cancel() / hci_cmd_sync_cancel_sync() read/write
- hci_abort_conn() reads in connection abort path
Since __hci_cmd_sync_sk() runs on hdev->req_workqueue while hci_send_cmd_sync() runs on hdev->workqueue, these are different workqueues that can execute concurrently on different CPUs. The plain C accesses constitute a data race.
Add READ_ONCE()/WRITE_ONCE() annotations on all concurrent accesses to hdev->req_status to prevent potential compiler optimizations that could affect correctness (e.g., load fusing in the wait_event condition or store reordering).
---
LLM Generated explanations, may be completely bogus:
Error: Failed to generate final synthesis
net/bluetooth/hci_conn.c | 2 +- net/bluetooth/hci_core.c | 2 +- net/bluetooth/hci_sync.c | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-)
net/bluetooth/hci_conn.c +1 -1
@@ -2967,7 +2967,7 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)* hci_connect_le serializes the connection attempts so only one * connection can be in BT_CONNECT at time. */ -if (conn->state ==BT_CONNECT && hdev->req_status ==HCI_REQ_PEND ) { +if (conn->state ==BT_CONNECT &&READ_ONCE (hdev->req_status) ==HCI_REQ_PEND ) {switch (hci_skb_event (hdev->sent_cmd)) {case HCI_EV_CONN_COMPLETE :case HCI_EV_LE_CONN_COMPLETE :
net/bluetooth/hci_core.c +1 -1
@@ -4125,7 +4125,7 @@ static int hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)kfree_skb (skb); } -if (hdev->req_status ==HCI_REQ_PEND && +if (READ_ONCE (hdev->req_status) ==HCI_REQ_PEND && !hci_dev_test_and_set_flag (hdev,HCI_CMD_PENDING )) {kfree_skb (hdev->req_skb); hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL );
net/bluetooth/hci_sync.c +10 -10
@@ -25,11 +25,11 @@ static void hci_cmd_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode, {bt_dev_dbg (hdev,"result 0x%2.2x" , result); -if (hdev->req_status !=HCI_REQ_PEND ) +if (READ_ONCE (hdev->req_status) !=HCI_REQ_PEND )return ; hdev->req_result = result; - hdev->req_status =HCI_REQ_DONE ; +WRITE_ONCE (hdev->req_status,HCI_REQ_DONE );/* Free the request command so it is not used as response */ kfree_skb (hdev->req_skb);
@@ -167,20 +167,20 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen,hci_cmd_sync_add (&req, opcode, plen, param, event, sk); - hdev->req_status =HCI_REQ_PEND ; +WRITE_ONCE (hdev->req_status,HCI_REQ_PEND ); err =hci_req_sync_run (&req);if (err <0 )return ERR_PTR (err); err =wait_event_interruptible_timeout (hdev->req_wait_q, - hdev->req_status !=HCI_REQ_PEND , +READ_ONCE (hdev->req_status) !=HCI_REQ_PEND , timeout);if (err == -ERESTARTSYS )return ERR_PTR (-EINTR ); -switch (hdev->req_status) { +switch (READ_ONCE (hdev->req_status)) {case HCI_REQ_DONE : err = -bt_to_errno (hdev->req_result);break ;
@@ -194,7 +194,7 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen,break ; } - hdev->req_status =0 ; +WRITE_ONCE (hdev->req_status,0 ); hdev->req_result =0 ; skb = hdev->req_rsp; hdev->req_rsp =NULL ;
@@ -665,9 +665,9 @@ void hci_cmd_sync_cancel(struct hci_dev *hdev, int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err); -if (hdev->req_status ==HCI_REQ_PEND ) { +if (READ_ONCE (hdev->req_status) ==HCI_REQ_PEND ) { hdev->req_result = err; - hdev->req_status =HCI_REQ_CANCELED ; +WRITE_ONCE (hdev->req_status,HCI_REQ_CANCELED );queue_work (hdev->workqueue, &hdev->cmd_sync_cancel_work); }
@@ -683,12 +683,12 @@ void hci_cmd_sync_cancel_sync(struct hci_dev *hdev, int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err); -if (hdev->req_status ==HCI_REQ_PEND ) { +if (READ_ONCE (hdev->req_status) ==HCI_REQ_PEND ) {/* req_result is __u32 so error must be positive to be properly * propagated. */ hdev->req_result = err <0 ? -err : err; - hdev->req_status =HCI_REQ_CANCELED ; +WRITE_ONCE (hdev->req_status,HCI_REQ_CANCELED );wake_up_interruptible (&hdev->req_wait_q); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
In reply to Sasha LevinFrom: Aravind Anilraj <[email protected]>
[ Upstream commit b022e5c142efe4c5497e6cfda1f143618b4b9254 ]
If byt_rt5651_prepare_and_enable_pll1() fails, the function returns without calling clk_disable_unprepare() on priv->mclk, which was already enabled earlier in the same code path. Add the missing cleanup call to prevent the clock from leaking.
---
LLM Generated explanations, may be completely bogus:
Now I have all the information needed. Let me compile the full analysis.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
- **Subsystem**: ASoC: Intel: bytcr_rt5651
- **Action verb**: "Fix" — explicitly a bug fix
- **Summary**: Fix clock (MCLK) resource leak on error path in platform_clock_control
### Step 1.2: Tags
- **Signed-off-by**: Aravind Anilraj (author, community contributor — no prior commits in this subsystem)
- **Reviewed-by**: Cezary Rojewski (Intel audio maintainer)
- **Link**: patch.msgid.link/20260401220507.23557-3 — patch 3 in a series
- **Signed-off-by**: Mark Brown (ASoC subsystem maintainer — applied the patch)
- No Fixes: tag, no Cc: stable, no Reported-by (all expected for autosel review)
### Step 1.3: Commit Body
The message clearly describes: if byt_rt5651_prepare_and_enable_pll1() fails, the function returns without calling clk_disable_unprepare() on priv->mclk, which was already enabled by clk_prepare_enable(). This is a straightforward clock resource leak on an error path.
### Step 1.4: Hidden Bug Fix?
No — this is explicitly labeled as a bug fix and is genuinely one. The commit message directly describes the resource leak mechanism.
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
- **Files changed**: 1 (sound/soc/intel/boards/bytcr_rt5651.c)
- **Lines added**: 2 (+if (ret < 0) and +clk_disable_unprepare(priv->mclk);)
- **Lines removed**: 0
- **Function modified**: platform_clock_control()
- **Scope**: Single-file, single-function, 2-line surgical fix
### Step 2.2: Code Flow Change
**Before**: In the SND_SOC_DAPM_EVENT_ON branch:
1. clk_prepare_enable(priv->mclk) — enables the clock
2. byt_rt5651_prepare_and_enable_pll1() — configures PLL
3. If step 2 fails, ret < 0 falls through to the error path at line 225, which logs the error and returns — **without disabling the clock**
**After**: If byt_rt5651_prepare_and_enable_pll1() fails, clk_disable_unprepare(priv->mclk) is called immediately, properly balancing the earlier clk_prepare_enable().
### Step 2.3: Bug Mechanism
**Category**: Resource leak (clock) on error path.
- clk_prepare_enable() increments the clock's reference count
- On PLL1 failure, the corresponding clk_disable_unprepare() was never called
- The clock remains permanently enabled, leaking the resource
### Step 2.4: Fix Quality
- **Obviously correct**: Yes — directly mirrors the existing cleanup in the else branch (line 221-222)
- **Minimal**: Yes — 2 lines, no unnecessary changes
- **Regression risk**: Essentially zero — only executes on an existing error path
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
- Line 206 (clk_prepare_enable): Refactored by a8627df5491e00 (Andy Shevchenko, 2021-10-07) — but the original logic dates to 02c0a3b3047f8f (Pierre-Louis Bossart, 2017-10-12)
- Line 211 (byt_rt5651_prepare_and_enable_pll1): Introduced by aeec6cc0821573 (Hans de Goede, 2018-03-04) — **this is when the bug was introduced**. The PLL1 call was added between the clock enable and the end of the branch, without error handling for the clock.
### Step 3.2: Fixes Target
No explicit Fixes: tag. The implicit fix target is aeec6cc0821573 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before using it", v4.17-rc1). This commit is present in **all active stable trees** (it dates to 2018).
### Step 3.3: Related Changes
The file has had several unrelated changes since the bug was introduced, but none touch the specific error path being fixed. The fix applies cleanly.
### Step 3.4: Author
Aravind Anilraj appears to be a community contributor (no other commits in this subsystem found). However, the patch was **Reviewed-by** Cezary Rojewski (Intel audio maintainer) and **merged by** Mark Brown (ASoC maintainer).
### Step 3.5: Dependencies
None. The fix is completely standalone — it references only priv->mclk and clk_disable_unprepare(), both of which have existed since the original code. No prerequisites needed.
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1-4.2: Patch Discussion
The Link tag indicates this is patch 3 in a series (message-id contains "23557-3"). Lore.kernel.org was blocked by anti-bot protection, preventing direct discussion retrieval. However:
- The patch was reviewed by Intel's audio maintainer (Cezary Rojewski)
- Merged by the ASoC subsystem maintainer (Mark Brown)
- Both are strong trust indicators
### Step 4.3-4.5
No explicit bug report or syzbot link — this appears to be found by code inspection. No previous stable discussion found.
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1-5.2: Function Context platform_clock_control() is registered as a DAPM supply callback:
```253:255:sound/soc/intel/boards/bytcr_rt5651.c
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
platform_clock_control, SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMD),
```This is called every time the audio path is powered up (PRE_PMU) or down (POST_PMD). It is a **common path** for any user of this audio hardware.
### Step 5.3: Callees
- clk_prepare_enable() / clk_disable_unprepare(): standard Linux clock framework
- byt_rt5651_prepare_and_enable_pll1(): configures PLL via snd_soc_dai_set_pll() and snd_soc_dai_set_sysclk() — can fail if the codec rejects the configuration
### Step 5.4: Sibling Pattern Confirmation
The sibling driver bytcr_rt5640.c has the **identical bug** at lines 285-291:
```285:291:sound/soc/intel/boards/bytcr_rt5640.c
if (SND_SOC_DAPM_EVENT_ON(event)) {
ret = clk_prepare_enable(priv->mclk);
if (ret < 0) {
dev_err(card->dev, "could not configure MCLK
state\n");
return ret;
}
ret = byt_rt5640_prepare_and_enable_pll1(codec_dai,
48000);
```No clk_disable_unprepare() on PLL1 failure there either. This confirms the bug pattern is real and systematic.
## PHASE 6: STABLE TREE ANALYSIS
### Step 6.1: Code in Stable
The buggy code was introduced in aeec6cc0821573 (v4.17-rc1, March 2018). This code exists in **all active stable trees** (5.4.y, 5.10.y, 5.15.y, 6.1.y, 6.6.y, 6.12.y).
### Step 6.2: Backport Complications
The fix is 2 lines with minimal context sensitivity. The surrounding code has been stable since the a8627df5491e00 refactoring in 2021. It should apply cleanly to all trees from 5.15+ at minimum; older trees may need trivial context adjustment for the BYT_RT5651_MCLK_EN quirk check that was removed by a8627df5491e00.
### Step 6.3: No related fixes for this bug already in stable.
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
- **Subsystem**: ASoC / Intel audio machine driver
- **Criticality**: PERIPHERAL — affects users of Bay Trail / Cherry Trail devices with RT5651 codec (budget tablets, laptops)
- **Activity**: Moderate — file sees occasional updates
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Affected Users
Users with Intel Bay Trail or Cherry Trail devices using the RT5651 audio codec. These are common budget tablets and laptops.
### Step 8.2: Trigger Conditions
Triggered when: (a) audio starts playing (DAPM PRE_PMU event), AND (b) PLL1 configuration fails. While PLL failure is itself an error condition, repeated failures with clock leaks can compound the problem and prevent power management from working correctly.
### Step 8.3: Failure Mode
- **Severity: MEDIUM** — The leaked clock prevents the MCLK from being disabled, which:
- Wastes power (clock stays enabled)
- May prevent subsequent clock operations from working correctly
- Could contribute to audio subsystem malfunction after error recovery
### Step 8.4: Risk-Benefit
- **Benefit**: Fixes a real resource leak, prevents clock reference count imbalance
- **Risk**: Essentially zero — 2-line addition only on error path, obviously correct
- **Ratio**: Very favorable for backport
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backporting:**
- Fixes a real clock resource leak on error path
- 2-line fix, minimal and surgical
- Obviously correct (mirrors existing cleanup pattern in the else branch)
- Reviewed by Intel audio maintainer, merged by ASoC subsystem maintainer
- Bug exists since v4.17, present in all active stable trees
- No dependencies, completely standalone
- Sibling driver (bytcr_rt5640) has the identical bug, confirming the pattern
**AGAINST backporting:**
- The trigger requires PLL1 configuration failure (uncommon in normal operation)
- No user reports or syzbot bugs — found by code inspection
- Author is a community contributor with no other commits in this subsystem
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **YES** — trivially correct, reviewed by maintainer
2. Fixes a real bug? **YES** — clock resource leak on error path
3. Important issue? **MEDIUM** — resource leak, not a crash
4. Small and contained? **YES** — 2 lines in 1 file
5. No new features/APIs? **YES** — no new functionality
6. Applies to stable trees? **YES** — code unchanged, clean apply expected
### Step 9.3: Exception Categories
Not applicable — this is a standard bug fix, not an exception category.
---
## Verification
- [Phase 1] Parsed tags: Reviewed-by Cezary Rojewski (Intel), Signed- off-by Mark Brown (ASoC maintainer)
- [Phase 2] Diff analysis: 2 lines added to error path in platform_clock_control(), adds missing clk_disable_unprepare()
- [Phase 3] git blame: buggy code path introduced in aeec6cc0821573 (v4.17-rc1, 2018-03-04), present in all stable trees
- [Phase 3] git describe: confirmed aeec6cc0821573 first appeared in v4.17-rc1
- [Phase 3] git log: no prior fix for this issue exists
- [Phase 4] lore.kernel.org: blocked by anti-bot protection, could not read discussion
- [Phase 4] b4 dig: confirmed PLL1 commit is patch v3 15/22 from Hans de Goede series
- [Phase 5] Verified platform_clock_control() is a DAPM supply callback (line 253-255), called on every audio path enable/disable
- [Phase 5] Verified sibling bytcr_rt5640.c has identical bug pattern at lines 285-291
- [Phase 6] Code exists in all active stable trees (bug from v4.17, 2018)
- [Phase 8] Failure mode: clock resource leak preventing proper power management, severity MEDIUM
- UNVERIFIED: Could not read mailing list discussion due to anti-bot protection; relied on tags in commit message for review assessment
The fix is small, surgical, obviously correct, and meets all stable kernel criteria. It fixes a genuine resource leak with zero regression risk.
**YES**
sound/soc/intel/boards/bytcr_rt5651.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/boards/bytcr_rt5651.c +2 -0
@@ -209,6 +209,8 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,return ret; } ret =byt_rt5651_prepare_and_enable_pll1 (codec_dai,48000 ,50 ); +if (ret <0 ) +clk_disable_unprepare (priv->mclk); }else {/* * Set codec clock source to internal clock before
Signature · 1 line
2.53.0