wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
Subsystems (80)
Sasha Levin
maintainerPATCH 1/1 mailbox: Make mbox_send_message() return error code when tx fails
In reply to Sasha LevinFrom: Joonwon Kang <[email protected]>
[ Upstream commit 96a3d2f3167f5644b30e60171898e67123c3c2c6 ]
When the mailbox controller failed transmitting message, the error code was only passed to the client's tx done handler and not to mbox_send_message() in blocking mode. For this reason, the function could return a false success. This commit resolves the issue by introducing the tx status and checking it before mbox_send_message() returns.
This commit works with the premise that the multi-threads' access to a channel in blocking mode is serialized by clients, not by the mailbox APIs, since the current mbox_send_message() in blocking mode does not support multi-threads.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject line
**Record:** [mailbox] [Make] — Make mbox_send_message() return an error code when TX fails in blocking mode.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Joonwon Kang <[email protected]> (author)
- **Reviewed-by:** Sudeep Holla <[email protected]> (mailbox/ARM maintainer)
- **Signed-off-by:** Jassi Brar <[email protected]> (mailbox subsystem maintainer)
- **No** Fixes:, Reported-by:, Tested-by:, Link:, or `Cc:
stable` in the committed message (v6 submission notes Cc was removed from the commit message but was present in the patch email)
- Notable: reviewed by subsystem maintainer; patch series explicitly CC'd [email protected] in v6 submission
### Step 1.3: Body analysis
**Record:**
- **Bug:** In blocking mode (tx_block), when the mailbox controller reports a TX failure via mbox_chan_txdone() / tx_tick(), the error is delivered only to the optional tx_done callback. mbox_send_message() still returns the positive queue index from add_to_rbuf(), i.e. false success.
- **Symptom:** Callers checking ret < 0 believe TX succeeded; they may proceed or wait for RX that never arrives, eventually timing out with the wrong error.
- **Root cause:** mbox_send_message() only converts timeout (ret == 0 from wait_for_completion_timeout) to -ETIME; it never inspects the TX result passed to tx_tick().
- **Constraint:** Author documents that blocking mode does not support multi-threaded concurrent senders; clients must serialize access.
### Step 1.4: Hidden bug fix?
**Record:** Yes — this is a straightforward API correctness bug fix, not cosmetic cleanup. The kerneldoc for mbox_send_message() states blocking mode should return after transmission completes; TX failure is not success.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- drivers/mailbox/mailbox.c: +5 / -1 lines
- include/linux/mailbox_controller.h: +2 lines (field + comment)
- **Functions modified:** tx_tick(), mbox_send_message()
- **Scope:** Single-subsystem, surgical fix (7 lines net)
### Step 2.2: Code flow changes
**Record:**
- **Hunk 1 (tx_tick):** Before: on non-timeout completion in blocking mode, only called complete(). After: also stores chan->tx_status = r before waking the waiter.
- **Hunk 2 (mbox_send_message):** Before: after successful wait, always returned positive queue index t. After: if chan->tx_status < 0, returns that error instead.
- **Affected path:** Blocking-mode TX completion and error reporting only.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic / API contract fix (incorrect return value propagation)
- **Mechanism:** TX error r flows through tx_tick(chan, r) → tx_done callback, but mbox_send_message() waiter was not told. Fix stores r in per-channel tx_status and propagates it to the return value.
### Step 2.4: Fix quality
**Record:**
- Fix is minimal and obviously correct for single-threaded blocking use (the documented/accepted model).
- **Regression risk:** Low for intended use. Reviewer Sudeep Holla noted per-channel tx_status can be stale/overwritten with concurrent blocking senders; author and maintainers accepted this as a pre- existing limitation (blocking mode is not multi-thread safe).
- No public API change; only corrects return semantics.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Current tx_tick() / mbox_send_message() blocking path in this tree comes from commit a112b91dd6349 (Jeff Layton, 2026-07-23) — a sunrpc backport that brought in the current mailbox.c content. The buggy blocking-return logic is present in that version. This tree's git history is shallow for drivers/mailbox/ (only one commit shown), so the original introduction date of tx_block cannot be determined from this checkout alone.
### Step 3.2: Fixes tag
**Record:** N/A — no Fixes: tag in the commit message.
### Step 3.3: Related file history
**Record:** git log --oneline -20 -- drivers/mailbox/mailbox.c shows only a112b91dd6349. No related fix or prerequisite series is visible in this tree. The final v6 patch is standalone (detached from earlier multi-thread completion work per submission changelog).
### Step 3.4: Author context
**Record:** Joonwon Kang (Google). Jassi Brar is the mailbox maintainer and committed/acked. Sudeep Holla reviewed. No other commits from these authors appear in this tree's mailbox history.
### Step 3.5: Dependencies
**Record:** No dependencies on other patches. Diff matches current tree structure (scoped_guard, same function layout). Applies cleanly to this tree's mailbox.c and mailbox_controller.h.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original discussion
**Record:**
- **URL:** https://lists.openwall.net/linux-kernel/2026/05/10/136
([PATCH v6] mailbox: Make mbox_send_message() return error code when tx fails)
- Series evolved v1→v6; v4 detached from multi-thread completion patch; v6 is the final standalone version matching the analyzed diff.
- Reviewer concern (Sudeep Holla, v4 thread): per-channel tx_status/tx_complete unsafe with concurrent blocking senders. Author response: blocking mode does not support multi-thread; clients serialize.
### Step 4.2: Reviewers
**Record:** To: Jassi Brar, Sudeep Holla. Cc: linux-kernel, [email protected], akpm, dianders. Subsystem maintainers were directly involved.
### Step 4.3: Bug reports
**Record:** No syzbot, Bugzilla, or user crash reports. Bug identified through API behavior analysis during a blocking-mode improvement series.
### Step 4.4: Related patches
**Record:** Earlier series [PATCH v3 0/2] included a per-thread completion patch (not in this final commit). This commit is self- contained.
### Step 4.5: Stable list
**Record:** Could not search lore.kernel.org/stable (bot protection). Patch submission explicitly CC'd [email protected].
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key functions
**Record:** tx_tick(), mbox_send_message(), indirectly mbox_chan_txdone(), mbox_client_txdone(), msg_submit().
### Step 5.2: Callers
**Record:** mbox_send_message() is used across ~40+ in-tree files (firmware, remoteproc, ACPI PCC, RPMSG, media, crypto, etc.). Blocking- mode users (tx_block = true) include at minimum:
- drivers/firmware/raspberrypi.c
- drivers/firmware/arm_scpi.c
- drivers/remoteproc/imx_dsp_rproc.c
- drivers/remoteproc/stm32_rproc.c
- drivers/soc/microchip/mpfs-sys-controller.c
- drivers/firmware/thead,th1520-aon.c
- drivers/i2c/busses/i2c-xgene-slimpro.c
- others
Many check ret < 0 after mbox_send_message().
### Step 5.3: Callees
**Record:** add_to_rbuf(), msg_submit(), wait_for_completion_timeout(), complete(), optional tx_done callback, controller send_data() / IRQ completion paths.
### Step 5.4: Reachability
**Record:** Reachable from normal driver probe/runtime on SoCs using mailbox firmware interfaces (RPi, ARM SCPI, i.MX DSP remoteproc, Microchip MPFS, etc.). Not a syscall path, but common on embedded/ARM platforms.
### Step 5.5: Similar patterns
**Record:** Timeout path already returns -ETIME correctly. Only non- timeout TX errors were mishandled. No other instances of this exact bug pattern elsewhere in the mailbox core.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **Yes.** Local tree is v6.18.43-1-gc7f0dac02d232 (Makefile: 6.18.43). drivers/mailbox/mailbox.c lines 103–104 and 269–276 show the buggy behavior (no tx_status, no error propagation). include/linux/mailbox_controller.h has no tx_status field.
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** Current tree matches the patch context (scoped_guard in tx_tick, same line structure). Only 2 files touched.
### Step 6.3: Fix already present?
**Record:** **No.** git grep tx_status in mailbox code returns nothing. Fix is not in this tree.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem criticality
**Record:** drivers/mailbox/ — **IMPORTANT** infrastructure for firmware/SoC communication (SCPI, RPi firmware, remoteproc kick/stop, system controllers).
### Step 7.2: Activity
**Record:** Limited history visible in this stable checkout; mailbox core is mature infrastructure with long-standing blocking-mode API.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who is affected
**Record:** Platforms using mailbox clients with tx_block = true — embedded ARM, RPi, i.MX, STM32 remoteproc, Microchip MPFS, ACPI PCC paths, etc. Config-dependent (CONFIG_MAILBOX and specific drivers).
### Step 8.2: Trigger conditions
**Record:** Triggered when a mailbox controller reports TX failure (via mbox_chan_txdone(chan, negative_error)) while client uses blocking mode. Requires actual controller TX failure (hardware/firmware error path). Not user-triggerable from syscalls directly, but common in firmware interaction error paths.
### Step 8.3: Failure mode severity
**Record:**
- **Failure mode:** False success return; callers miss immediate TX error; may wait for RX/timeouts with wrong error code; degraded firmware/remoteproc operation.
- **Severity:** **MEDIUM** — not a direct crash/UAF/security issue, but causes incorrect error handling and can lead to multi-second hangs (e.g. SCPI MAX_RX_TIMEOUT) instead of immediate failure.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** MEDIUM — restores documented blocking-mode semantics for widely used firmware paths; enables proper error handling in drivers that check return values.
- **Risk:** LOW — 7-line change, maintainer-reviewed, no behavior change for successful TX or for non-blocking mode.
- **Ratio:** Benefit outweighs risk for this tree.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence summary
**FOR backport:**
- Real, reproducible API bug: false success on TX failure in blocking mode
- Buggy code confirmed present in Linux 6.18.43 checkout
- Affects multiple production drivers using tx_block + ret < 0 checks
- Small, surgical, maintainer-reviewed fix
- Patch series CC'd stable; standalone, no dependencies
- Corrects behavior to match kerneldoc contract
**AGAINST backport:**
- No crash, UAF, security, or data-corruption report
- Severity is incorrect error propagation / delayed failure, not system panic
- Pre-existing multi-thread limitation in blocking mode (reviewer concern)
- No fuzzer or user bug report
**Unresolved:** Exact kernel version when tx_block was introduced (shallow history in this tree).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic is clear; Reviewed-by maintainer; no Tested-by but straightforward.
2. Fixes a real bug affecting users? **PASS** — false success on TX failure in blocking mode.
3. Important issue? **PASS (borderline)** — MEDIUM severity API bug on firmware-critical paths; wrong error handling and potential hangs.
4. Small and contained? **PASS** — 7 lines, 2 files.
5. No new features or APIs? **PASS** — internal tx_status field; corrects existing return semantics.
6. Can apply to local tree? **PASS** — buggy code present; clean apply expected.
### Step 9.3: Exception categories
**Record:** None (not a device ID, quirk, DT, build fix, or docs-only change).
### Step 9.4: Decision rationale
For **this** 6.18.y tree, the buggy blocking-mode behavior exists today and affects real firmware/remoteproc drivers that rely on mbox_send_message() return values. The fix is minimal, low-risk, and restores the documented API contract. While not a crash-level bug, incorrect error propagation on mailbox TX failures is meaningful for stable users on embedded platforms, and the patch was explicitly prepared for stable with maintainer review.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user-provided diff and lore submission
- **[Phase 2]** Read drivers/mailbox/mailbox.c lines 84–105, 245–277; confirmed buggy logic (no tx_status, returns queue index on TX error)
- **[Phase 2]** Read include/linux/mailbox_controller.h; confirmed no tx_status field
- **[Phase 3]** git describe HEAD → v6.18.43-1-gc7f0dac02d232; Makefile → 6.18.43
- **[Phase 3]** git blame -L 84,105 drivers/mailbox/mailbox.c → all from a112b91dd6349
- **[Phase 3]** git log --oneline -20 -- drivers/mailbox/mailbox.c → only one commit in this tree
- **[Phase 3]** git log --grep for commit subject → not found in tree (fix not merged)
- **[Phase 4]** Fetched https://lists.openwall.net/linux-
kernel/2026/05/10/136 — confirmed v6 patch, Reviewed-by Sudeep Holla, Cc stable in submission
- **[Phase 4]** Web search found Sudeep Holla multi-thread review concern and author response
- **[Phase 4]** b4 dig -c not run — commit not in this tree; b4 dig -q unsupported
- **[Phase 4]** lore.kernel.org/stable search blocked by bot protection
- **[Phase 5]** grep mbox_send_message( — 40+ call sites across firmware/remoteproc/ACPI/etc.
- **[Phase 5]** grep tx_block = true — 10+ blocking-mode clients identified
- **[Phase 5]** Read raspberrypi.c:49-71, arm_scpi.c:512-520, mpfs- sys-controller.c:50-74, imx_dsp_rproc.c:611 — all use blocking mode and check return values
- **[Phase 6]** Confirmed fix absent: no tx_status in mailbox code
- **[Phase 6]** Confirmed patch context matches current tree (scoped_guard present in tx_tick)
- **[Phase 7]** Mailbox is firmware/SoC communication infrastructure — IMPORTANT
- **[Phase 8]** Failure mode: false success → wrong error handling / RX wait timeouts — MEDIUM severity
- **UNVERIFIED:** Exact mainline commit SHA (not in this tree); date tx_block was originally introduced
**YES**
drivers/mailbox/mailbox.c | 6 +++++- include/linux/mailbox_controller.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/mailbox.c +5 -1
@@ -100,8 +100,10 @@ static void tx_tick(struct mbox_chan *chan, int r)if (chan->cl->tx_done) chan->cl->tx_done (chan->cl, mssg, r); -if (r != -ETIME && chan->cl->tx_block) +if (r != -ETIME && chan->cl->tx_block) { + chan->tx_status = r;complete (&chan->tx_complete); + } }static enum hrtimer_restart txdone_hrtimer (struct hrtimer *hrtimer)
@@ -270,6 +272,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)if (ret ==0 ) { t = -ETIME ;tx_tick (chan, t); + }else if (chan->tx_status <0 ) { + t = chan->tx_status; } }
include/linux/mailbox_controller.h +2 -0
@@ -114,6 +114,7 @@ struct mbox_controller {* @txdone_method: Way to detect TXDone chosen by the API * @cl: Pointer to the current owner of this channel * @tx_complete: Transmission completion +* @tx_status: Transmission status * @active_req: Currently active request hook * @msg_count: No. of mssg currently queued * @msg_free: Index of next available mssg slot
@@ -126,6 +127,7 @@ struct mbox_chan {unsigned txdone_method;struct mbox_client *cl;struct completion tx_complete; +int tx_status;void *active_req;unsigned msg_count, msg_free;void *msg_data[MBOX_TX_QUEUE_LEN ];
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
In reply to Sasha LevinFrom: Asad Kamal <[email protected]>
[ Upstream commit f193e71fa9fab2e68ef85201b106e8f580d3a25b ]
The powerplay path allocates hardcode_pp_table once with kmemdup(..., soft_pp_table_size). memcpy(..., size) used the sysfs store count (up to PAGE_SIZE) with no upper bound, causing heap overflow. Reject writes where size exceeds soft_pp_table_size.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
**Local tree:** v6.18.44 (stable/linux-6.18.y, VERSION=6, PATCHLEVEL=18, SUBLEVEL=44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [drm/amd/pm] [bound] — bounds-check memcpy in pp_dpm_set_pp_table() to prevent heap overflow when uploading a powerplay table via sysfs.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Asad Kamal <[email protected]> (author)
- **Reviewed-by:** Yang Wang <[email protected]> (AMD reviewer)
- **Signed-off-by:** Alex Deucher <[email protected]> (subsystem maintainer)
- No Fixes:, Reported-by:, Link:, Cc: [email protected], Tested-by:, or Acked-by:
Notable: maintainer sign-off and AMD internal review; no syzbot report.
### Step 1.3: Body analysis
**Record:**
- **Bug:** hardcode_pp_table is allocated once via kmemdup(..., soft_pp_table_size), but memcpy(..., size) uses the sysfs write length (count, up to PAGE_SIZE) with no upper bound.
- **Symptom:** Heap buffer overflow in kernel memory.
- **Trigger:** Writing more bytes than soft_pp_table_size to the pp_table sysfs attribute on the legacy powerplay DPM path.
- **Root cause:** Mismatch between allocation size and copy size.
- **Version info:** None in commit message.
### Step 1.4: Hidden bug fix?
**Record:** Yes — despite “bound” wording rather than “fix”, this is a clear memory-safety bug fix (heap overflow / out-of-bounds write), not cleanup or optimization.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c (+3 / -0)
- **Function:** pp_dpm_set_pp_table()
- **Scope:** Single-file, surgical fix (3 lines)
### Step 2.2: Code flow change
**Record:**
- **Before:** After basic hwmgr/pm_en validation, code allocates (if needed) hardcode_pp_table sized to soft_pp_table_size, then unconditionally memcpy(hwmgr->hardcode_pp_table, buf, size).
- **After:** Rejects writes where size > hwmgr->soft_pp_table_size with -EINVAL before allocation/copy.
- **Path affected:** Sysfs write → amdgpu_set_pp_table() → amdgpu_dpm_set_pp_table() → pp_dpm_set_pp_table().
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Buffer overflow / out-of-bounds heap write (memory safety).
- **Mechanism:** kmemdup allocates soft_pp_table_size bytes; memcpy can copy up to PAGE_SIZE (4096) bytes from sysfs count. When size > soft_pp_table_size, writes past the kmalloc buffer. On subsequent writes, the buffer is not reallocated (only allocated once when !hardcode_pp_table), so overflow persists.
### Step 2.4: Fix quality
**Record:**
- Fix is obviously correct and minimal.
- Mirrors the intent of the SMU-path fix in commit 1abb2648698bf (“avoid buffer overflow … in smu_sys_set_pp_table()”), which added size validation and reallocation logic.
- Low regression risk: only rejects invalid oversized writes; legitimate writes matching the existing table size continue to work.
- No API or structural changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- pp_dpm_set_pp_table() introduced in f3898ea12fc1f (Eric Huang, 2015-12-11).
- Unbounded memcpy introduced in 4dcf9e6f2e33fe (Eric Huang, 2016-06-01): “add uploading pptable and resetting powerplay support”.
- Bug has existed since mid-2016; present in this 6.18.y tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related file history
**Record:**
- Related stable-worthy fix already in tree: 1abb2648698bf (Feb 2025) — SMU smu_sys_set_pp_table() overflow fix, with `Cc:
[email protected]`.
- Candidate fix (bound pp_dpm_set_pp_table) is **not** in this tree; buggy code confirmed at lines 660–676 without the bounds check.
- Standalone one-patch fix, not part of a series.
### Step 3.4: Author context
**Record:** Asad Kamal is an active AMD contributor (drm/amdgpu, drm/amd/pm). Patch reviewed by Yang Wang and committed by Alex Deucher (AMD DRM maintainer).
### Step 3.5: Dependencies
**Record:** No prerequisites. Adds a simple validation before existing logic. Applies cleanly to current amd_powerplay.c in this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- b4 dig -c 6f5c27bdc1e91 failed (commit not in local object database).
- Web search found submission: [amd-gfx May 2026](https://lists.freedesktop.org/archives/amd- gfx/2026-May/145636.html) by Asad Kamal, May 29, 2026.
- Review reply from Yang Wang referenced in thread index.
- No explicit stable nomination found in available search results.
- No NAKs found in available summaries.
### Step 4.2: Reviewers
**Record:** CC list included AMD maintainers (Deucher, Lazar, etc.). Reviewed-by: Yang Wang; Signed-off-by: Alex Deucher.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link. Bug identified by code inspection / internal AMD review.
### Step 4.4: Related patches
**Record:** Direct parallel: 1abb2648698bf for smu_sys_set_pp_table() — same sysfs interface, same class of overflow, already in this tree and nominated for stable.
### Step 4.5: Stable list history
**Record:** lore.kernel.org blocked by bot protection; could not search stable@ list directly. SMU sibling fix explicitly had `Cc:
[email protected]`.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** pp_dpm_set_pp_table(), callers:amdgpu_dpm_set_pp_table(), amdgpu_set_pp_table().
### Step 5.2: Callers
**Record:**
- amdgpu_set_pp_table() — sysfs store for pp_table (AMDGPU_DEVICE_ATTR_RW(pp_table, ...))
- amdgpu_dpm_set_pp_table() — dispatches via pp_funcs->set_pp_table under adev->pm.mutex
- Powerplay path: pp_dpm_funcs.set_pp_table = pp_dpm_set_pp_table (legacy DPM GPUs)
- SMU path: smu_sys_set_pp_table (Navi+ and newer) — separate code path, already has size checks
### Step 5.3: Callees
**Record:** kmemdup(), memcpy(), amd_powerplay_reset(), optional avfs_control().
### Step 5.4: Reachability
**Record:**
- Reachable from userspace via /sys/class/drm/card*/device/pp_table write.
- Requires amdgpu_pm_get_access() (device runtime-resumed); sysfs write typically requires root/CAP_SYS_ADMIN.
- Affects systems using legacy powerplay DPM (pre-SMU path GPUs:
Polaris, Vega, older APUs, etc.) — still common in stable/LTS deployments.
### Step 5.5: Similar patterns
**Record:** SMU path (smu_sys_set_pp_table) validates header->usStructureSize != size and reallocates when needed (1abb2648698bf). Powerplay path lacked any size validation — inconsistent and vulnerable.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Buggy code exists?
**Record:** **Yes.** Current tree at v6.18.44 has unbounded memcpy in pp_dpm_set_pp_table() (lines 668–676). No size > soft_pp_table_size check. Bug introduced 2016; long-standing.
### Step 6.2: Backport complications
**Record:** Clean apply expected — 3-line insertion with no surrounding churn in the function. Recent file history is handle-pointer refactors unrelated to this hunk.
### Step 6.3: Related fixes already present?
**Record:** SMU overflow fix (1abb2648698bf) is an ancestor of HEAD. Powerplay-path equivalent is **not** present.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/gpu/drm/amd/pm — **IMPORTANT** (AMD GPU driver power management). Not universal core kernel, but widely deployed on desktop, laptop, and server GPUs.
### Step 7.2: Subsystem activity
**Record:** Actively maintained; recent commits in amd_powerplay.c and related PM code.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of AMD GPUs on the legacy powerplay DPM path who write custom powerplay tables via pp_table sysfs. Config/driver-specific, but covers many still-supported Polaris/Vega-era devices.
### Step 8.2: Trigger conditions
**Record:** Write to pp_table with count > soft_pp_table_size (and count up to PAGE_SIZE). Requires sysfs write access (typically root). Trigger is straightforward for anyone intentionally uploading a table.
### Step 8.3: Failure mode severity
**Record:** Heap buffer overflow → potential kernel crash, memory corruption, possible security impact. **Severity: HIGH** (memory safety; kernel integrity).
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH — closes a real, long-standing heap overflow on a reachable sysfs path; aligns powerplay path with already-stable- nominated SMU fix.
- **Risk:** VERY LOW — 3-line bounds check, rejects only invalid inputs.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real heap overflow bug, present since 2016
- Reachable via pp_table sysfs on legacy powerplay GPUs
- Small (3 lines), obviously correct, maintainer-reviewed
- Parallel SMU fix already in this tree with stable nomination
- Prevents crash/corruption
**AGAINST backport:**
- Only affects legacy powerplay path (not Navi+/SMU GPUs)
- Sysfs write typically requires elevated privileges
- No syzbot/CVE report (but bug mechanism is clear from code)
**Unresolved:** Full lore review thread content (bot protection); no explicit Cc: stable on this specific patch (but sibling fix had it).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — trivial bounds check; Reviewed-by AMD engineer; maintainer sign-off.
2. Fixes a real bug affecting users? **PASS** — heap overflow on sysfs upload path.
3. Important issue? **PASS** — memory safety / potential crash and corruption (**HIGH**).
4. Small and contained? **PASS** — 3 lines, one function.
5. No new features or APIs? **PASS** — validation only.
6. Can apply to local tree? **PASS** — buggy code present; patch applies cleanly.
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs). Qualifies as a standard security/stability bug fix.
### Step 9.4: Decision rationale
This commit fixes a genuine heap buffer overflow in pp_dpm_set_pp_table() that has existed in the 6.18.y tree since the powerplay table upload feature was added. The fix is minimal, correct, and consistent with the already-backported SMU-path overflow fix. For stable users running legacy AMD GPUs who use pp_table sysfs, this prevents kernel memory corruption and potential crashes.
---
## Verification
- **[Phase 1]** git describe HEAD → v6.18.44; parsed commit message tags and body from user-provided diff
- **[Phase 2]** Read amd_powerplay.c:660-688 — confirmed missing bounds check and unbounded memcpy
- **[Phase 2]** Traced call chain via grep: amdgpu_set_pp_table → amdgpu_dpm_set_pp_table → pp_dpm_set_pp_table
- **[Phase 3]** git blame -L 660,690 — function from 2015, memcpy from 4dcf9e6f2e33fe (2016-06-01)
- **[Phase 3]** git show 4dcf9e6f2e33fe — introduced upload/reset support with unbounded copy
- **[Phase 3]** git show 1abb2648698bf — SMU sibling overflow fix with Cc: stable; confirmed ancestor of HEAD
- **[Phase 3]** git log --grep="bound pp_dpm" — no match; fix not in tree
- **[Phase 4]** b4 dig -c 6f5c27bdc1e91 — failed (commit not in repo)
- **[Phase 4]** Web search — found amd-gfx submission May 29, 2026; Reviewed-by Yang Wang in thread
- **[Phase 4]** lore.kernel.org fetch — blocked (bot protection); stable@ search UNVERIFIED
- **[Phase 5]** Read amdgpu_pm.c:581-601, amdgpu_dpm.c:1717-1733 — sysfs write path confirmed
- **[Phase 5]** Read amdgpu_smu.c:633-659 — SMU path has size validation; powerplay path does not
- **[Phase 5]** Grep set_pp_table — two implementations: powerplay and SMU
- **[Phase 6]** git describe HEAD → v6.18.44 on stable/linux-6.18.y
- **[Phase 6]** Confirmed buggy code at lines 668-676 without fix
- **[Phase 8]** Failure mode: heap OOB write → crash/corruption, severity HIGH
**YES**
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +3 -0
@@ -665,6 +665,9 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; +if (size > hwmgr->soft_pp_table_size) +return -EINVAL ; +if (!hwmgr->hardcode_pp_table) { hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, hwmgr->soft_pp_table_size,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.1] drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Lockless read of pp_table in sysfs read path leads to a data race and potential Use-After-Free. --
commit cc5f41b8e67512361c9df1ffb3561029e8d4a97e
Author: Asad Kamal <[email protected]>
drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
This commit adds a bounds check to pp_dpm_set_pp_table() to prevent a heap overflow when uploading a powerplay table via sysfs. It rejects writes where the provided size exceeds soft_pp_table_size.
Quoted 13 lines
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +3
-0@@ -665,6 +665,9 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; +if (size > hwmgr->soft_pp_table_size) +return -EINVAL ; +if (!hwmgr->hardcode_pp_table) { hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, hwmgr->soft_pp_table_size,
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
Quoted 6 lines
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +0
-0GFP_KERNEL);if (!hwmgr->hardcode_pp_table)return ret; }memcpy (hwmgr->hardcode_pp_table, buf, size);
[Severity: High]
This is a pre-existing issue, but does this sysfs write path race with concurrent readers?
Looking at the sysfs read path in amdgpu_get_pp_table() in drivers/gpu/drm/amd/pm/amdgpu_pm.c, the table is read locklessly after briefly holding the mutex to fetch the pointer:
drivers/gpu/drm/amd/pm/amdgpu_pm.c:amdgpu_get_pp_table() {
...
mutex_lock(&adev->pm.mutex);
size = amdgpu_dpm_get_pp_table(adev, &table);
mutex_unlock(&adev->pm.mutex);
if (size >= PAGE_SIZE)
return -EIO;
memcpy(buf, table, size);
...
}If a privileged user concurrently writes a new table via sysfs, this write path in pp_dpm_set_pp_table() executes memcpy() and mutates the buffer while the reader is copying it, resulting in corrupted data to userspace.
Furthermore, in the SMU path, this race can result in a use-after-free. If a larger table is written concurrently, the old table is freed:
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c:smu_sys_set_pp_table() {
...
kfree(smu_table->hardcode_pptable);
smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
...
}Since the reader in amdgpu_get_pp_table() continues to execute memcpy(buf, table, size) using the now-freed pointer without holding any locks, can this lead to kernel memory corruption or an information leak?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 btrfs: balance: fix potential bg lookup failure in chunk_usage_range_filter()
In reply to Sasha LevinFrom: ZhengYuan Huang <[email protected]>
[ Upstream commit 7a308f6d29cc689ceaf313b9ebdf68099f50e452 ]
[BUG]
Running btrfs balance with a usage range filter (-dusage=min..max) can trigger a null-ptr-deref when metadata corruption causes a chunk to have no corresponding block group in the in-memory cache:
KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077]
RIP: 0010:chunk_usage_range_filter fs/btrfs/volumes.c:3845 [inline]
RIP: 0010:should_balance_chunk fs/btrfs/volumes.c:4031 [inline]
RIP: 0010:__btrfs_balance fs/btrfs/volumes.c:4182 [inline]
RIP: 0010:btrfs_balance+0x249e/0x4320 fs/btrfs/volumes.c:4618
...
Call Trace:
btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline]
btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313
vfs_ioctl fs/ioctl.c:51 [inline]
...The bug is reproducible on recent development branch.
[CAUSE]
Two separate data structures are involved:
1. The on-disk chunk tree, which records every chunk (logical address space region) and is iterated by __btrfs_balance().
2. The in-memory block group cache (fs_info->block_group_cache_tree), which is built at mount time by btrfs_read_block_groups() and holds a struct btrfs_block_group for each chunk. This cache is what the usage range filter queries.
On a well-formed filesystem, these two are kept in 1:1 correspondence. However, btrfs_read_block_groups() builds the cache from block group items in the extent tree, not directly from the chunk tree. A corrupted image can therefore contain a chunk item in the chunk tree whose corresponding block group item is absent from the extent tree; that chunk's block group is then never inserted into the in-memory cache.
When balance iterates the chunk tree and reaches such an orphaned chunk, should_balance_chunk() calls chunk_usage_range_filter(), which queries the block group cache:
cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_used = cache->used; /* cache may be NULL */
btrfs_lookup_block_group() returns NULL silently when no cached entry covers chunk_offset. chunk_usage_range_filter() does not check the return value, so the immediately following dereference of cache->used triggers the crash.
[FIX]
Add a NULL check after btrfs_lookup_block_group() in chunk_usage_range_filter(). When the lookup fails, emit a btrfs_err() message identifying the affected bytenr and return -EUCLEAN to indicate filesystem corruption.
Since chunk_usage_range_filter() now has an error path, change its return type from bool to error pointer, return 0 if the chunk matches the usage range, and 1 if it should be filtered out.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: btrfs: balance: fix potential bg lookup failure in chunk_usage_range_filter()
**Local tree:** linux-6.18.y at v6.18.44 (kernel 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [btrfs/balance] **fix** — NULL block-group lookup in chunk_usage_range_filter() during balance with usage-range filter (-dusage=min..max).
### Step 1.2: Commit Message Tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** David Sterba <[email protected]> (btrfs maintainer)
- **Acked-by:** — none
- **Link:** — none
- **Cc: stable:** — none (expected)
- **Signed-off-by:** ZhengYuan Huang <[email protected]>; David Sterba (committer)
- **Notable:** Reviewed and committed by btrfs maintainer; KASAN stack trace in body
### Step 1.3: Body Analysis
**Record:**
- **Bug:** NULL pointer dereference in chunk_usage_range_filter() when running btrfs balance with BTRFS_BALANCE_ARGS_USAGE_RANGE on a corrupted filesystem where a chunk exists in the chunk tree but has no matching block group in the in-memory cache.
- **Symptom:** KASAN null-ptr-deref at cache->used (offset ~0x70 into struct btrfs_block_group), reachable via btrfs_ioctl_balance → btrfs_balance → __btrfs_balance → should_balance_chunk.
- **Root cause:** btrfs_lookup_block_group() can return NULL; caller dereferences without checking.
- **Fix:** NULL check, btrfs_err() log, return -EUCLEAN; change return type from bool to int for error propagation.
- **Version info:** Reproducible on recent development branch; no specific kernel version cited.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not disguised — explicitly labeled [BUG] with KASAN trace. Clear NULL-dereference fix.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Change Inventory
**Record:**
- **Files:** fs/btrfs/volumes.c only (+17 / -7 lines)
- **Functions modified:** chunk_usage_range_filter(), should_balance_chunk() (usage-range branch only)
- **Scope:** Single-file surgical fix
### Step 2.2: Code Flow Changes
**Record:**
- **Hunk 1 (chunk_usage_range_filter):** Before: lookup block group, unconditionally dereference cache->used. After: check unlikely(!cache), log error, return -EUCLEAN; otherwise same logic with int return (0 = match filter, 1 = filter out).
- **Hunk 2 (should_balance_chunk):** Before: inline bool call, filter out if true. After: call filter, propagate negative errors (return ret2), filter out if positive return.
### Step 2.3: Bug Mechanism
**Record:** **Category:** NULL pointer dereference (memory safety). **Mechanism:** Missing NULL check after btrfs_lookup_block_group() on a corruption path where chunk-tree and block-group cache are inconsistent.
### Step 2.4: Fix Quality
**Record:** Fix is obviously correct and minimal. Matches the pattern already applied to chunk_usage_filter() in prerequisite commit 6dde5221f608e. Low regression risk — only affects error path on corrupted metadata. btrfs_put_block_group() still called on success path only.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Buggy NULL-deref line (chunk_used = cache->used without check) introduced in bc3094673f22d (David Sterba, Oct 2015) — "btrfs:
extend balance filter usage to take minimum and maximum". Present in this tree since 2015.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related File History
**Record:** Part of a 3-commit series by ZhengYuan Huang (Mar 25, 2026):
1. 6dde5221f608e — fix chunk_usage_filter() + change should_balance_chunk() to int + add ret < 0 handling in __btrfs_balance
2. 7a308f6d29cc6 — **this commit** — fix chunk_usage_range_filter()
3. 18d32b0013efb — fix btrfs_may_alloc_data_chunk()
None of these three are in linux-6.18.y yet.
### Step 3.4: Author Context
**Record:** ZhengYuan Huang is a btrfs contributor (other fixes in tree- checker/root-item validation). David Sterba (maintainer) reviewed and committed all three.
### Step 3.5: Dependencies
**Record:** **Prerequisite:** 6dde5221f608e is required:
- Changes should_balance_chunk() from bool to int and adds if (ret < 0) goto error in __btrfs_balance
- Without it, -EUCLEAN propagation from this commit is broken
- Verified: 6dde5221 applies cleanly to v6.18.44; 7a308f6 fails alone but applies cleanly after 6dde5221
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:** b4 dig -c 7a308f6d29cc6 — **no match found** on lore.kernel.org. Lore web search blocked by bot protection. Cannot verify mailing-list discussion or stable nominations.
### Step 4.2: Reviewers
**Record:** David Sterba (btrfs maintainer) — Reviewed-by and Signed- off-by. Sufficient subsystem review.
### Step 4.3: Bug Report
**Record:** KASAN trace in commit message only. No syzbot, bugzilla, or user reports. Author states reproducible on development branch.
### Step 4.4: Related Patches
**Record:** Sibling commits 6dde5221 and 18d32b0013efb fix the same class of bug in adjacent balance code paths. Ideally backported as a series; this commit is not standalone for clean apply.
### Step 4.5: Stable List History
**Record:** Not searched successfully (lore inaccessible). No evidence found of prior stable discussion.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** chunk_usage_range_filter(), should_balance_chunk(),
callers: __btrfs_balance(), btrfs_balance(), btrfs_ioctl_balance().
### Step 5.2: Callers
**Record:** should_balance_chunk() called from __btrfs_balance() chunk-tree iteration loop (every balance operation per chunk). btrfs_ioctl_balance() requires CAP_SYS_ADMIN.
### Step 5.3: Callees
**Record:** btrfs_lookup_block_group() → block_group_cache_tree_search() — returns NULL when no cached block group covers the bytenr. btrfs_put_block_group(), mult_perc(), btrfs_err().
### Step 5.4: Reachability
**Record:** Trigger: admin runs btrfs balance with usage-range filter (BTRFS_BALANCE_ARGS_USAGE_RANGE) on filesystem with chunk/block-group metadata inconsistency. Reachable from ioctl() syscall path. Requires corruption + specific filter flag; not everyday path but real and reproducible.
### Step 5.5: Similar Patterns
**Record:** Same missing-NULL-check pattern exists in:
- chunk_usage_filter() (fixed by 6dde5221)
- btrfs_may_alloc_data_chunk() with ASSERT(cache) only (fixed by 18d32b0013efb)
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.44)
### Step 6.1: Buggy Code Present?
**Record:** **YES.** At lines 3968–3969 in fs/btrfs/volumes.c:
```3968:3969:fs/btrfs/volumes.c
cache = btrfs_lookup_block_group(fs_info, chunk_offset);
chunk_used = cache->used;
```No NULL check. BTRFS_BALANCE_ARGS_USAGE_RANGE support present since 2015 (bc3094673f22d is ancestor).
### Step 6.2: Backport Complications
**Record:** Does not apply cleanly alone (git apply --check fails at line 4158). Applies cleanly after prerequisite 6dde5221. Minor adaptation needed only if backported without prerequisite (not recommended).
### Step 6.3: Related Fixes Already Present?
**Record:** **NO.** String "has no corresponding block group" not in tree. 6dde5221 and 18d32b0013efb also absent.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem Criticality
**Record:** **fs/btrfs** — IMPORTANT. Btrfs is widely deployed; balance is an admin maintenance operation on live filesystems.
### Step 7.2: Subsystem Activity
**Record:** Actively maintained. Recent balance-related work includes f963e0128b180 (bool conversion, Apr 2025) and c19830db30a09 (BUG() → error handling in __btrfs_balance).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who Is Affected
**Record:** Btrfs users running balance with usage-range filter on corrupted or inconsistently-metadata filesystems. Admin-only trigger (CAP_SYS_ADMIN).
### Step 8.2: Trigger Conditions
**Record:** Corrupted chunk tree / extent tree inconsistency + balance with -dusage=min..max range syntax. Uncommon but plausible during recovery operations on damaged filesystems — exactly when robust error handling matters most.
### Step 8.3: Failure Mode Severity
**Record:** **CRITICAL** — kernel NULL pointer dereference / oops. System crash during admin maintenance on a filesystem that may already be in distress.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH — prevents kernel crash; returns -EUCLEAN for corruption (correct btrfs behavior)
- **Risk:** LOW — ~17 lines, well-reviewed, mirrors already-accepted pattern from sibling commit
- **Ratio:** Strongly favorable, provided prerequisite 6dde5221 is included
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, reproducible NULL pointer dereference with KASAN trace
- Bug present in 6.18.44 since 2015
- Small, surgical, maintainer-reviewed fix
- Prevents kernel oops during balance on corrupted filesystems
- Matches established btrfs corruption-handling pattern (-EUCLEAN)
**AGAINST backport:**
- Requires prerequisite commit 6dde5221 for clean apply and correct error propagation
- Trigger needs metadata corruption + usage-range filter (less common than simple -dusage=N)
- No syzbot or user bug reports
- Admin-only path (not unprivileged attack surface)
**Unresolved:**
- No lore discussion found via b4
- Third sibling commit 18d32b0013efb addresses another balance NULL- deref path; ideally included in same backport series
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — NULL check after documented- NULL-returning function; maintainer reviewed; KASAN-reproduced
2. Fixes real bug affecting users? **PASS** — kernel crash on balance ioctl
3. Important issue? **PASS** — CRITICAL (kernel oops)
4. Small and contained? **PASS** — 17 lines, one file
5. No new features/APIs? **PASS** — bug fix only
6. Can apply to local tree? **PASS** (with prerequisite 6dde5221; verified via git apply)
### Step 9.3: Exception Categories
**Record:** N/A — standard bug fix, not device ID/quirk/docs/build fix.
### Step 9.4: Decision Rationale
This commit fixes a long-standing NULL pointer dereference in btrfs balance code that exists in the 6.18.44 tree. The fix is minimal, obviously correct, and reviewed by the btrfs maintainer. While the trigger requires filesystem corruption and the usage-range filter, crashing the kernel during recovery/maintenance on a damaged btrfs filesystem is exactly the kind of issue stable trees should fix.
The prerequisite commit 6dde5221f608e must accompany this backport (it applies cleanly to 6.18.44 and is required for proper -EUCLEAN propagation). Commit 18d32b0013efb fixes the same bug class in btrfs_may_alloc_data_chunk() and should also be considered for a complete fix.
---
## Verification
- **[Phase 1]** Parsed commit message: BUG/CAUSE/FIX sections, Reviewed- by David Sterba, no Fixes:/Reported-by:/Link: tags
- **[Phase 2]** Diff analysis: 17 lines in fs/btrfs/volumes.c; NULL check + int return type + error propagation in should_balance_chunk
- **[Phase 3]** git blame: buggy code from bc3094673f22d (Oct 2015)
- **[Phase 3]** git log -S: found series 6dde5221, 7a308f6, 18d32b0013efb on master; none in 6.18.44
- **[Phase 3]** git merge-base --is-ancestor: bc3094673f22d present; 6dde5221 NOT present
- **[Phase 3]** git apply --check 6dde5221: applies cleanly to v6.18.44
- **[Phase 3]** git apply --check 7a308f6 alone: **FAILS** at line 4158
- **[Phase 3]** git apply 6dde5221 then git apply --check 7a308f6:
**SUCCEEDS**
- **[Phase 4]** b4 dig -c 7a308f6d29cc6: no lore match found
- **[Phase 4]** lore.kernel.org fetch: blocked by bot protection
- **[Phase 5]** Call chain verified: btrfs_ioctl_balance (CAP_SYS_ADMIN) → btrfs_balance → __btrfs_balance → should_balance_chunk → chunk_usage_range_filter
- **[Phase 5]** btrfs_lookup_block_group() in block-group.c:279-283 returns NULL via block_group_cache_tree_search
- **[Phase 6]** git describe HEAD: v6.18.44 on stable/linux-6.18.y
- **[Phase 6]** Grep confirmed buggy code at lines 3968-3969; no "has no corresponding block group" string in tree
- **[Phase 6]** BTRFS_BALANCE_ARGS_USAGE_RANGE present in include/uapi/linux/btrfs.h
- **[Phase 8]** Failure mode: KASAN null-ptr-deref → kernel oops, severity CRITICAL
---
**YES**The background checks finished and match what the analysis already used:
- **b4 dig** on HEAD found no lore.kernel.org thread for this commit.
- **git log --grep="fix potential bg lookup failure"** returned nothing — the fix isn’t in the local linux-6.18.y tree yet.
That supports the earlier **YES** verdict: the bug is still present in 6.18.44, and this commit should be backported together with prerequisite 6dde5221f608e (chunk_usage_filter() fix).The git log -S "has no corresponding block group" search finished with no matches in the current linux-6.18.y tree — that error string only appears in the unfixed commits on master (6dde5221, 7a308f6, 18d32b0013efb), which confirms the fix series hasn’t landed in 6.18.44 yet.
fs/btrfs/volumes.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
fs/btrfs/volumes.c +17 -7
@@ -3960,16 +3960,21 @@ static bool chunk_profiles_filter(u64 chunk_type, struct btrfs_balance_args *barreturn true; } -static bool chunk_usage_range_filter (struct btrfs_fs_info *fs_info,u64 chunk_offset, -struct btrfs_balance_args *bargs) +static int chunk_usage_range_filter (struct btrfs_fs_info *fs_info,u64 chunk_offset, +struct btrfs_balance_args *bargs) {struct btrfs_block_group *cache;u64 chunk_used;u64 user_thresh_min;u64 user_thresh_max; -bool ret = true; +int ret =1 ; cache =btrfs_lookup_block_group (fs_info, chunk_offset); +if (unlikely (!cache)) { +btrfs_err (fs_info,"balance: chunk at bytenr %llu has no corresponding block group" , + chunk_offset); +return -EUCLEAN ; + } chunk_used = cache->used;if (bargs->usage_min ==0 )
@@ -3985,7 +3990,7 @@ static bool chunk_usage_range_filter(struct btrfs_fs_info *fs_info, u64 chunk_of user_thresh_max =mult_perc (cache->length, bargs->usage_max);if (user_thresh_min <= chunk_used && chunk_used < user_thresh_max) - ret = false; + ret =0 ;btrfs_put_block_group (cache);return ret;
@@ -4155,9 +4160,14 @@ static int should_balance_chunk(struct extent_buffer *leaf, struct btrfs_chunk *return ret2;if (ret2)return false; - }else if ((bargs->flags &BTRFS_BALANCE_ARGS_USAGE_RANGE ) && -chunk_usage_range_filter (fs_info, chunk_offset, bargs)) { -return false; + }else if (bargs->flags &BTRFS_BALANCE_ARGS_USAGE_RANGE ) { +int ret2; + + ret2 =chunk_usage_range_filter (fs_info, chunk_offset, bargs); +if (ret2 <0 ) +return ret2; +if (ret2) +return false; }/* devid filter */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
In reply to Sasha LevinFrom: Xiaogang Chen <[email protected]>
[ Upstream commit 516bf737a5602875f6c28d1028967837c8edf2c0 ]
If inx from find_first_zero_bit is beyond range not need set doorbell_bitmap.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
**Local tree:** v6.18.44 (Linux 6.18.44)
**Fix commit:** 2664ce9143d174651a793d96a6a2326050c4f45a — **not** in this tree; buggy code is still present.
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [drm/amdkfd] [check] — validate find_first_zero_bit result before calling __set_bit on kfd->doorbell_bitmap.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Xiaogang Chen <[email protected]> (author)
- **Reviewed-by:** Alex Deucher <[email protected]> (AMD DRM maintainer)
- **Signed-off-by:** Alex Deucher <[email protected]>
- No Fixes:, Reported-by:, Link:, Cc: stable, Tested-by:, or Acked-by: tags
- (cherry picked from commit 2664ce9143d1...) — pipeline marker; ignored per instructions
### Step 1.3: Body analysis
**Record:**
- **Bug:** When find_first_zero_bit finds no free bit, it returns nb (the search size). The old code called __set_bit(inx, ...) before checking whether inx is in range.
- **Symptom:** Out-of-bounds bitmap write when the bitmap is exhausted; on large-page systems, also leaks bitmap slots on the error path (set bit, then return NULL).
- **Root cause:** Range check was placed after __set_bit instead of before it.
### Step 1.4: Hidden bug fix?
**Record:** Yes. Despite the terse message, this is a memory-safety / resource-management fix, not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c (+5 / -3 lines)
- **Function:** kfd_get_kernel_doorbell()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow change
**Record:**
- **Before:** lock → find_first_zero_bit → __set_bit → unlock → if inx >= 1024 return NULL
- **After:** lock → find_first_zero_bit → if inx >= 1024 unlock and return NULL → __set_bit → unlock
- **Affected path:** Error path when no kernel doorbell slot is available
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Out-of-bounds access / bitmap resource leak
- **Mechanism:** doorbell_bitmap is allocated with bitmap_zalloc(PAGE_SIZE / sizeof(u32)) (1024 bits on 4 KiB pages). find_first_zero_bit(..., PAGE_SIZE / sizeof(u32)) returns 1024 when full. __set_bit(1024, ...) writes past the end of a 1024-bit bitmap. On larger pages, indices 1024..(PAGE_SIZE/4-1) could be set and then discarded via return NULL, leaking slots.
### Step 2.4: Fix quality
**Record:**
- Obviously correct; mirrors the process-doorbell pattern in kfd_device_queue_manager.c (check before set_bit)
- Minimal change, no API changes
- **Regression risk:** Very low — only affects the exhaustion error path
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- Function dates to 2014 (19f6d2a660340d, Oded Gabbay)
- find_first_zero_bit with PAGE_SIZE / sizeof(u32) added in c31866651086fc (Jul 2023, Shashank Sharma)
- The check-after-set pattern predates 2023; the 2023 change did not introduce the ordering bug, but kept it
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag present.
### Step 3.3: Related file history
**Record:**
- Recent kfd_doorbell.c changes are doorbell-manager refactors (2023)
- No related fix for this issue already in the tree
- Part of a 3-patch series per b4; patch 1 is unrelated (AMDKFD_IOC_GET_DMABUF_INFO)
### Step 3.4: Author context
**Record:** Xiaogang Chen is an AMD contributor; Alex Deucher (maintainer) reviewed and committed.
### Step 3.5: Dependencies
**Record:** Standalone — no prerequisite commits required. Applies cleanly to current kfd_doorbell.c.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- **b4 dig URL:**
https://patch.msgid.link/[email protected]
- **Series:** [PATCH 2/3] — patch 1 is unrelated ioctl work
- Lore fetch blocked by bot protection; thread content not directly readable
### Step 4.2: Reviewers
**Record:** CC'd to [email protected]; Reviewed-by Alex Deucher (maintainer).
### Step 4.3: Bug reports
**Record:** No external bug report, syzbot report, or crash trace referenced.
### Step 4.4: Related patches
**Record:** Patch 2/3 is independent of patches 1 and 3 for this fix's correctness.
### Step 4.5: Stable list history
**Record:** Not searched separately; no stable nomination found in commit metadata.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** kfd_get_kernel_doorbell(), kfd_release_kernel_doorbell()
### Step 5.2: Callers
**Record:**
- kfd_kernel_queue.c:76 — kernel_queue_init() for HIQ/DIQ queues
- Typically 1–2 kernel queues per KFD device (HIQ + optional DIQ)
- Error path at line 78–80 handles NULL return
### Step 5.3: Callees
**Record:** mutex_lock/unlock, find_first_zero_bit, __set_bit, amdgpu_doorbell_index_on_bar
### Step 5.4: Reachability
**Record:**
- Triggered during KFD device init / debug-queue setup (CONFIG_HSA_AMD / AMDGPU KFD)
- Not directly userspace-syscall reachable, but reachable during GPU compute driver init
- Exhaustion requires ~1024 allocations without release — unrealistic in normal use (~2 kernel queues), but possible with a doorbell leak
### Step 5.5: Similar patterns
**Record:** Process doorbells in kfd_device_queue_manager.c:484–490 already check found >= KFD_MAX_NUM_OF_QUEUES_PER_PROCESS **before** set_bit. This fix aligns kernel doorbells with that correct pattern.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **Yes.** Current tree at lines 155–162 still has check- after-set:
```155:162:drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c
mutex_lock(&kfd->doorbell_mutex);
inx = find_first_zero_bit(kfd->doorbell_bitmap, PAGE_SIZE /
sizeof(u32));
__set_bit(inx, kfd->doorbell_bitmap);
mutex_unlock(&kfd->doorbell_mutex);
if (inx >= KFD_MAX_NUM_OF_QUEUES_PER_PROCESS)
return NULL;
```Bitmap allocation at line 75: bitmap_zalloc(PAGE_SIZE / sizeof(u32)) — 1024 bits on 4 KiB pages. KFD_MAX_NUM_OF_QUEUES_PER_PROCESS = 1024 (kfd_priv.h:97).
### Step 6.2: Backport difficulty
**Record:** Clean apply expected — 8-line hunk, no conflicts observed.
### Step 6.3: Related fixes already present?
**Record:** None. git merge-base --is-ancestor 2664ce9143d1 HEAD → NOT_IN_TREE.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/gpu/drm/amd/amdkfd — **PERIPHERAL** (AMD GPU compute / ROCm users with CONFIG_HSA_AMD)
### Step 7.2: Activity
**Record:** Actively maintained; recent doorbell-manager refactoring in 2023.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** AMD GPU users with KFD/ROCm enabled — not universal, but real production users.
### Step 8.2: Trigger conditions
**Record:**
- All doorbell bitmap slots consumed (1024 on 4 KiB pages)
- Normal operation uses ~2 kernel doorbells per device
- **Likelihood:** Very low without a resource leak; **possible** with a leak bug
### Step 8.3: Failure mode severity
**Record:**
- **OOB __set_bit:** Memory corruption adjacent to bitmap → potential crash or unpredictable behavior — **HIGH** if triggered
- **Bitmap leak (large pages):** Gradual exhaustion — **MEDIUM**
- **Practical impact today:** Low due to unlikely trigger
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Prevents OOB write and bitmap leaks on error path; aligns with existing correct pattern
- **Risk:** Minimal — 5-line reorder/addition on error path only
- **Ratio:** Favorable — near-zero risk, real correctness fix
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real out-of-bounds bitmap write when exhausted
- Obviously correct; maintainer-reviewed
- Small, self-contained, clean apply
- Matches established pattern in same subsystem
- Buggy code confirmed present in v6.18.44
- Memory-safety class of fix
**AGAINST backport:**
- No user reports or fuzzer findings
- Trigger extremely unlikely in normal kernel-queue usage (~2 doorbells)
- Bug present since 2014 without known incidents
- Config/driver-specific (AMD KFD only)
**Unresolved:** None affecting the decision.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic verified; maintainer reviewed (no runtime test cited)
2. Fixes a real bug? **PASS** — OOB __set_bit on exhaustion
3. Important issue? **PASS** — memory corruption (severity high if triggered; trigger rare)
4. Small and contained? **PASS** — 8 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — code exists; fix not yet applied
### Step 9.3: Exception categories
**Record:** None (not a quirk, device ID, DT, build, or docs fix).
### Step 9.4: Decision rationale
This is a small, maintainer-reviewed memory-safety fix for a genuine ordering bug: __set_bit was called before validating the index returned by find_first_zero_bit. When the bitmap is full, that is an out-of-bounds write. The trigger is rare for kernel doorbells (only HIQ/DIQ, typically ~2 per device), but the fix is trivial, matches the correct pattern already used for process doorbells in the same driver, and has essentially no regression risk. For the 6.18.y stable tree where the buggy code is present and the fix is absent, this meets stable kernel criteria.
---
## Verification
- **[Phase 1]** git show 2664ce9143d1 — parsed message and tags
- **[Phase 2]** Read kfd_doorbell.c:149–176 — confirmed check-after- set bug; analyzed diff
- **[Phase 2]** kfd_priv.h:97 — KFD_MAX_NUM_OF_QUEUES_PER_PROCESS = 1024
- **[Phase 2]** kfd_doorbell.c:75 — bitmap sized PAGE_SIZE / sizeof(u32) bits
- **[Phase 3]** git blame -L 150,176 kfd_doorbell.c — function history since 2014
- **[Phase 3]** git show c31866651086fc — 2023 doorbell-mgr refactor
- **[Phase 3]** git show 19f6d2a660340d — original code had same ordering bug
- **[Phase 3]** git log --oneline -15 -- kfd_doorbell.c — no duplicate fix
- **[Phase 4]** b4 dig -c 2664ce9143d1 — lore URL found; patch 2/3 of series
- **[Phase 4]** b4 dig -w — amd-gfx list CC'd
- **[Phase 4]** b4 dig -a — v1 series identified
- **[Phase 5]** grep kfd_get_kernel_doorbell — caller in kfd_kernel_queue.c:76
- **[Phase 5]** Read kfd_kernel_queue.c:76–80, 191, 224 — NULL handled; release on cleanup
- **[Phase 5]** Read kfd_device_queue_manager.c:484–490 — correct check-before-set pattern
- **[Phase 6]** git describe HEAD — v6.18.44
- **[Phase 6]** git merge-base --is-ancestor 2664ce9143d1 HEAD — NOT_IN_TREE
- **[Phase 6]** Read current kfd_doorbell.c — buggy code confirmed present
**YES**
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +5 -3
@@ -153,14 +153,16 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd,u32 inx;mutex_lock (&kfd->doorbell_mutex); + inx =find_first_zero_bit (kfd->doorbell_bitmap,PAGE_SIZE /sizeof (u32)); +if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) { +mutex_unlock (&kfd->doorbell_mutex); +return NULL ; + }__set_bit (inx, kfd->doorbell_bitmap);mutex_unlock (&kfd->doorbell_mutex); -if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) -return NULL ; - *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-6.6] drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] kfd_get_kernel_doorbell returns an out-of-bounds memory pointer when inx >= PAGE_SIZE / 8 (e.g. inx >= 512 for 4K pages) despite the newly added limit check.
- [High] Unconditional inx *= 2 scaling causes the CPU doorbell mapping to desynchronize from the hardware offset for pre-SOC15 devices where doorbell_size is 4 bytes. --
commit 894bc38c1ebdc7976cba92108cb9d3988e5b0bcd
Author: Xiaogang Chen <[email protected]>
drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
This commit fixes an issue where the doorbell bitmap could be written out-of-bounds by moving the bounds check to occur before the __set_bit operation.
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd, · line 158
Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +2
-0@@ -153,14 +153,16 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd,u32 inx;mutex_lock (&kfd->doorbell_mutex); + inx =find_first_zero_bit (kfd->doorbell_bitmap,PAGE_SIZE /sizeof (u32)); +if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) {
[Severity: High]
This is a pre-existing issue, but does this bounds check adequately protect the final pointer calculation from overflowing the allocation?
KFD_MAX_NUM_OF_QUEUES_PER_PROCESS is 1024. If we look at how inx is used later in kfd_get_kernel_doorbell():
inx *= 2;
...
return kfd->doorbell_kernel_ptr + inx;If inx is 512 or greater (but less than 1024), multiplying it by 2 yields an index of 1024 or more. Since the doorbell allocation is PAGE_SIZE (4096 bytes, or 1024 u32 elements), returning kfd->doorbell_kernel_ptr + inx results in an out-of-bounds memory pointer and potential memory corruption upon write.
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd, · line 168
Quoted 13 lines
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +3
-3+mutex_unlock (&kfd->doorbell_mutex); +return NULL ; + }__set_bit (inx, kfd->doorbell_bitmap);mutex_unlock (&kfd->doorbell_mutex); -if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) -return NULL ; - *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx,
[Severity: High]
This isn't a bug introduced by this patch, but does the unconditional scaling of inx cause the CPU doorbell mapping to desynchronize from the hardware offset for legacy devices?
Immediately following this context in kfd_get_kernel_doorbell():
*doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev,
kfd->doorbells,
inx,
kfd->device_info.doorbell_size);
inx *= 2;The hardware offset calculation via amdgpu_doorbell_index_on_bar() uses the device-specific doorbell sizes (e.g. 4 bytes on pre-SOC15 devices).
However, the CPU virtual pointer applies a hardcoded multiplication by 2 (advancing by 8 bytes unconditionally).
Can this lead to hardware functionality loss or device hangs on legacy pre-SOC15 devices?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 spi: dw-dma: Wait for controller idle before completing Tx
In reply to Sasha LevinFrom: Wang YuWei <[email protected]>
[ Upstream commit 0bcd59706aeda8a5d48ba656bab74cb26f2b423e ]
dw_spi_dma_wait_tx_done() polls dw_spi_dma_tx_busy(), which only checks DW_SPI_SR_TF_EMPT. An empty TX FIFO merely means the last data word has been moved into the shift register; the transfer is not complete on the bus until DW_SPI_SR_BUSY is also cleared. As a result the wait can return while the controller is still shifting out the final word.
Any caller that tears down or reconfigures the controller right after the transfer can then lose the tail of the transfer.
The memory-operation path in spi-dw-core.c already waits for both DW_SPI_SR_BUSY == 0 and DW_SPI_SR_TF_EMPT == 1. Use the same completion condition in the DMA path so the transfer is guaranteed to be finished on the bus before the wait returns.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: spi: dw-dma: Wait for controller idle before completing Tx
**Local tree:** v6.18.44 (stable/linux-6.18.y, VERSION = 6, PATCHLEVEL = 18, SUBLEVEL = 44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: PARSE THE SUBJECT LINE
**Record:** [spi: dw-dma] [Wait] — Ensure the DesignWare SPI DMA TX completion wait does not return until the controller is fully idle on the bus.
### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** — none
- **Acked-by:** — none
- **Link:** https://patch.msgid.link/tencent_4EA7B5C94669ED4C38A5F6C1C9 [email protected]
- **Cc: stable:** — not present (not a negative signal)
- **Signed-off-by:** Wang YuWei <[email protected]> (author)
- **Signed-off-by:** Mark Brown <[email protected]> (SPI subsystem maintainer)
Notable: maintainer ack via Mark Brown's Signed-off-by; no syzbot/user bug report.
### Step 1.3: ANALYZE THE COMMIT BODY TEXT
**Record:**
- **Bug:** dw_spi_dma_tx_busy() only checks DW_SPI_SR_TF_EMPT. TX FIFO empty means the last word entered the shift register, but the bus transfer is not finished until DW_SPI_SR_BUSY is also clear.
- **Symptom:** dw_spi_dma_wait_tx_done() can return early; callers that tear down or reconfigure the controller immediately afterward can truncate the final word(s) of a transfer.
- **Root cause:** Incomplete hardware status polling in the DMA TX wait path.
- **Fix approach:** Match the DMA path to the intended completion
condition: idle only when TF_EMPT=1 **and** BUSY=0.
### Step 1.4: DETECT HIDDEN BUG FIXES
**Record:** Not disguised — this is an explicit correctness bug fix for premature TX completion, not cleanup or optimization.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: INVENTORY THE CHANGES **Record:**
- **Files:** drivers/spi/spi-dw-dma.c (+2 / -1)
- **Functions modified:** dw_spi_dma_tx_busy() only
- **Scope:** Single-file, surgical (3-line hunk)
### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE
**Record:**
- **Hunk (dw_spi_dma_tx_busy):**
- **Before:** busy = !(SR & TF_EMPT) — not busy as soon as TX FIFO is empty.
- **After:** busy = ((SR & (BUSY|TF_EMPT)) != TF_EMPT) — busy unless FIFO is empty **and** controller is not shifting.
- **Path affected:** dw_spi_dma_wait_tx_done() polling loop, called from dw_spi_dma_transfer() after DMA submission completes.
### Step 2.3: IDENTIFY THE BUG MECHANISM
**Record:**
- **Category:** Logic / hardware-timing correctness fix
- **Mechanism:** On DW APB SSI, TF_EMPT can be set while BUSY is still set (shift register active). Old code treated that state as "done"; new code correctly keeps waiting.
### Step 2.4: ASSESS THE FIX QUALITY
**Record:**
- **Quality:** Obviously correct from DW SPI status-register semantics.
- **Minimal:** One condition change in one inline helper.
- **Regression risk:** Very low. Worst case is slightly longer wait on the final word; that is the intended behavior and matches hardware reality.
- **Note:** Commit body says mem-op path waits for both BUSY==0 and TF_EMPT==1, but dw_spi_ctlr_busy() in spi-dw-core.c only tests DW_SPI_SR_BUSY. The DMA fix itself is still correct; the mem-op comparison is slightly imprecise wording.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: BLAME THE CHANGED LINES
**Record:**
- Blame on current tree (HEAD): lines 282–285 introduced in 5d324e5159d9e (Nov 2025 merge bringing in spi-dw-dma.c).
- Buggy TF_EMPT-only check present at v6.15, v6.16, v6.17, v6.18, and current HEAD.
### Step 3.2: FOLLOW THE FIXES: TAG
**Record:** No Fixes: tag. N/A.
### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES **Record:**
- Upstream fix: 0bcd59706aeda (spi: dw-dma: Wait for controller idle before completing Tx)
- Related nearby fix on this tree: aae4a47073b12 (NULL deref in timeout error logging — separate issue)
- Standalone one-patch series (v1 only); no series dependency.
### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS **Record:** Wang YuWei has no other commits in this tree's drivers/spi/ history. Mark Brown is SPI maintainer and applied the patch.
### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS **Record:** No prerequisites. git apply --check of upstream diff against current spi-dw-dma.c succeeds cleanly. Only touches dw_spi_dma_tx_busy(); no dependency on newer refactors.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION
**Record:**
- **b4 dig -c 0bcd59706aeda:** https://patch.msgid.link/tencent_4EA7B5C9
[email protected]
- **Revisions (b4 dig -a):** v1 only
- **Review feedback:** Mark Brown reply: "Applied to broonie/spi for-7.2. Thanks!" No NAKs, no objections, no explicit stable nomination in thread.
### Step 4.2: CHECK WHO REVIEWED THE PATCH
**Record (b4 dig -w):** To Mark Brown; Cc Jisheng Zhang, linux- [email protected], [email protected]. Appropriate maintainer coverage.
### Step 4.3: SEARCH FOR THE BUG REPORT
**Record:** No external bug report, syzbot link, or hardware-specific reproduction email. Bug rationale is hardware-spec-based code analysis.
### Step 4.4: CHECK FOR RELATED PATCHES AND SERIES **Record:** Single-patch series; no companion patches required.
### Step 4.5: CHECK STABLE MAILING LIST HISTORY **Record:** Lore stable search not performed (lore bot protection on WebFetch). No stable discussion found in downloaded mbox thread.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF **Record:** dw_spi_dma_tx_busy() (modified); caller dw_spi_dma_wait_tx_done() (unchanged).
### Step 5.2: TRACE CALLERS
**Record:**
- dw_spi_dma_wait_tx_done() ← dw_spi_dma_transfer() (line 660)
- dw_spi_dma_transfer() ← dws->dma_ops->dma_transfer in spi-dw- core.c:456
- dw_spi_transfer_one() ← standard SPI controller transfer path during DMA-mapped transfers
Called during normal SPI DMA message processing, not obscure init-only code.
### Step 5.3: TRACE CALLEES
**Record:** dw_readl(dws, DW_SPI_SR) — hardware status register read only. No locks, allocations, or API changes.
### Step 5.4: FOLLOW THE CALL CHAIN
**Record:**userspace ioctl/write → spidev or kernel SPI client → spi_sync/spi_async → dw_spi_transfer_one → dw_spi_dma_transfer → dw_spi_dma_wait_tx_done → dw_spi_dma_tx_busy
Reachable from userspace via SPI device nodes and from in-kernel SPI clients (flash, sensors, etc.) on CONFIG_SPI_DW_DMA platforms.
### Step 5.5: SEARCH FOR SIMILAR PATTERNS
**Record:** Mem-op wait in spi-dw-core.c uses dw_spi_ctlr_busy() (BUSY only). DMA path was inconsistent and too eager. No other instances of the same broken TF_EMPT-only pattern found in this file.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
### Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE? **Record:** **Yes.** Current HEAD at drivers/spi/spi-dw- dma.c:282-285:
```282:285:drivers/spi/spi-dw-dma.c
static inline bool dw_spi_dma_tx_busy(struct dw_spi *dws)
{
return !(dw_readl(dws, DW_SPI_SR) & DW_SPI_SR_TF_EMPT);
}
```Present since at least v6.15 in this repository's tags; definitely present in v6.18.y.
### Step 6.2: CHECK FOR BACKPORT COMPLICATIONS
**Record:** **Clean apply expected.** git apply --check of upstream patch against current file succeeded. No conflicts with aae4a47073b12 (different lines). ctlr vs host rename in other parts of file does not affect this hunk.
### Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE **Record:** Fix **not** present. git merge-base --is-ancestor 0bcd59706aeda HEAD → not an ancestor. Buggy code still at HEAD.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY **Record:** drivers/spi/ — DesignWare SPI DMA driver. **IMPORTANT**:
widely used on embedded SoCs; SPI often backs boot flash, storage, and sensors.
### Step 7.2: ASSESS SUBSYSTEM ACTIVITY
**Record:** Active in 6.18.y (recent aae4a47073b12 fix in same file). spi-dw-dma.c is established infrastructure, not brand-new experimental code in this tree.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: DETERMINE WHO IS AFFECTED
**Record:** Users of DesignWare SPI with DMA enabled (CONFIG_SPI_DW_DMA). Driver-specific but common on ARM/embedded platforms using DW APB SSI.
### Step 8.2: DETERMINE THE TRIGGER CONDITIONS
**Record:**
- **Trigger:** Any DMA SPI TX transfer where the wait returns after FIFO empty but before shift register completes.
- **Likelihood:** Real on real hardware — this is documented DW SPI behavior, not theoretical.
- **Userspace trigger:** Yes, via SPI userspace access or kernel drivers using DMA-mapped transfers.
### Step 8.3: DETERMINE THE FAILURE MODE SEVERITY **Record:**
- **Failure mode:** Truncated/lost tail of SPI transfer; possible data corruption on SPI flash/devices, protocol errors, silent bad data.
- **Severity:** **HIGH** (data integrity / silent corruption), not merely cosmetic.
### Step 8.4: CALCULATE RISK-BENEFIT RATIO
**Record:**
- **Benefit:** HIGH — prevents real transfer truncation on common embedded hardware.
- **Risk:** VERY LOW — 2-line status-check correction, maintainer- reviewed.
- **Ratio:** Strongly favors backport.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: COMPILE THE EVIDENCE
**FOR backport:**
- Real hardware-timing bug with plausible data-corruption impact
- Buggy code confirmed in v6.18.44
- Fix is minimal, obviously correct, applies cleanly
- SPI maintainer (Mark Brown) Signed-off-by
- Affects normal DMA SPI transfer completion path
- No prerequisite commits
**AGAINST backport:**
- No user bug report or syzbot reproduction (weak negative only)
- Commit message slightly overstates mem-op path behavior (does not affect fix correctness)
**Unresolved:** No hardware-specific reproduction logs; impact inferred from DW SPI register semantics and code path (sufficient for this class of driver fix).
### Step 9.2: STABLE RULES CHECKLIST
1. Obviously correct and tested? **PASS** — logic matches hardware; maintainer applied; no Tested-by but change is trivial and verifiable.
2. Fixes a real bug affecting users? **PASS** — premature TX completion can truncate transfers.
3. Important issue? **PASS** — data corruption / transfer integrity (HIGH).
4. Small and contained? **PASS** — 1 file, 2 lines changed.
5. No new features or APIs? **PASS** — behavior correction only.
6. Can apply to local tree? **PASS** — verified clean apply.
### Step 9.3: EXCEPTION CATEGORIES
**Record:** None (not device ID, quirk, DT, build, or docs). Standard driver correctness fix.
### Step 9.4: DECISION RATIONALE
For **linux-6.18.y**, the buggy TF_EMPT-only wait exists, the fix is absent, the patch applies cleanly, and the failure mode (truncated SPI DMA transfers) is materially important for stable users on DW SPI + DMA platforms. This is exactly the kind of small, hardware-correctness fix stable trees should carry.
---
## Verification
- [Phase 1] Parsed subject, tags, body; no Fixes/Reported-by/syzbot
- [Phase 2] Diff: 1 file, dw_spi_dma_tx_busy() only; logic change verified
- [Phase 3] git describe HEAD → v6.18.44; blame → buggy lines at 282–285
- [Phase 3] git cat-file / git grep → buggy code at v6.15, v6.16, v6.17, v6.18, HEAD
- [Phase 3] Upstream commit 0bcd59706aeda confirmed; not ancestor of HEAD
- [Phase 3] git apply --check → patch applies cleanly to current tree
- [Phase 4] b4 dig -c 0bcd59706aeda → lore URL found
- [Phase 4] b4 dig -a → v1 only
- [Phase 4] b4 dig -w → Mark Brown, Jisheng Zhang, linux-spi CC'd
- [Phase 4] mbox thread → Mark Brown applied; no NAKs
- [Phase 5] Call chain traced: dw_spi_transfer_one → dw_spi_dma_transfer → dw_spi_dma_wait_tx_done
- [Phase 5] dw_spi_dma_wait_tx_done called at spi-dw-dma.c:660 when cur_msg->status == -EINPROGRESS
- [Phase 6] Buggy code read at spi-dw-dma.c:282-285 on HEAD
- [Phase 6] Related fix aae4a47073b12 present; this fix not present
- [Phase 8] Failure mode: truncated SPI TX → data corruption risk, severity HIGH
**YES**
drivers/spi/spi-dw-dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-dma.c +2 -1
@@ -281,7 +281,8 @@ static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed)static inline bool dw_spi_dma_tx_busy (struct dw_spi *dws) { -return !(dw_readl (dws,DW_SPI_SR ) &DW_SPI_SR_TF_EMPT ); +return (dw_readl (dws,DW_SPI_SR ) & + (DW_SPI_SR_BUSY |DW_SPI_SR_TF_EMPT )) !=DW_SPI_SR_TF_EMPT ; } static int dw_spi_dma_wait_tx_done(struct dw_spi *dws,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: bound aligned TLV advance in FW parser
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit acad742714bdc70e7fd7f234323807c596828213 ]
Validate ALIGN(tlv_len, 4) against remaining parser length before consuming bytes from the firmware image.
This avoids length underflow on malformed TLVs.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: wifi: iwlwifi: bound aligned TLV advance in FW parser
**Local tree:** v6.18.44 (linux-6.18.y stable), HEAD detached from stable/linux-6.18.y
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [wifi: iwlwifi] **bound** (preventive/safety) **aligned TLV advance in FW parser** — validates aligned TLV length before advancing the firmware parser.
### Step 1.2: Tags
**Record:**
- **Link:** https://patch.msgid.link/20260717173215.393c286488f9.Ia3914 4dc3ca334325ee4eacb7420901e2446fc23@changeid
- **Assisted-by:** GitHubCopilot:GPT-5.3-Codex
- **Signed-off-by:** Emmanuel Grumbach <[email protected]>
- **Signed-off-by:** Miri Korenblit <[email protected]>
- **No** Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Cc:
[email protected]
- Notable: Intel iwlwifi maintainer authorship; no fuzzer/user bug report
### Step 1.3: Body analysis
**Record:**
- **Bug:** Parser checks tlv_len against remaining length, but advances by ALIGN(tlv_len, 4). When tlv_len is not 4-byte aligned and equals remaining bytes, len -= ALIGN(tlv_len, 4) underflows size_t.
- **Symptom:** Length underflow on malformed TLV firmware images.
- **Root cause:** Mismatch between validation quantity (tlv_len) and consumption quantity (ALIGN(tlv_len, 4)).
- **Version info:** None in message.
### Step 1.4: Hidden bug fix?
**Record:** Yes — described as validation hardening, but it fixes a real unsigned integer underflow leading to out-of-bounds parsing.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/net/wireless/intel/iwlwifi/iwl-drv.c (+11 / -2, net +9)
- **Function:** iwl_parse_tlv_firmware()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow change
**Record:**
- **Hunk (TLV loop):**
- **Before:** if (len < tlv_len) then len -= ALIGN(tlv_len, 4) and pointer advance by aligned length.
- **After:** Compute aligned_tlv_len = ALIGN(tlv_len, 4), validate len >= aligned_tlv_len, then subtract/advance by aligned length.
- **Path affected:** Firmware TLV parsing loop during ucode load (error path on malformed input).
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Buffer safety / integer underflow
- **Mechanism:** With len == tlv_len and tlv_len % 4 != 0, e.g. len=3, tlv_len=3: check 3 < 3 fails (passes), but len -= ALIGN(3,4) → len -= 4 underflows size_t to a huge value. Loop continues, data advances past buffer → OOB read, potential kernel oops.
### Step 2.4: Fix quality
**Record:**
- Obviously correct: validates the same quantity that is consumed.
- Minimal, no unrelated changes.
- **Regression risk:** Very low — only rejects previously-accepted malformed input; legitimate Intel firmware uses properly aligned TLVs.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Buggy lines blame to 5d324e5159d9e in this shallow checkout. Repo is shallow (true); full introduction history unavailable. iwl_parse_tlv_firmware() is longstanding core iwlwifi code present in 6.18.y.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:**
- Fix commit on autosel branch: 9121064ed2d94 (upstream acad742714bdc)
- Part of 5-patch Intel series (iwlwifi-fixes 07-17-2026); this is patch 1/5
- Related sibling fixes on autosel: 8ab01d2f5a78a (dbg-tlv), 4025ad3399772 (SEC_RT TLV) — separate, not prerequisites
- Similar validation fixes already in this 6.18.y tree: eae7fdf7d4469, a076b0c457c71, dd90880eb5ec5
### Step 3.4: Author context
**Record:** Emmanuel Grumbach is iwlwifi maintainer. Miri Korenblit is active iwlwifi contributor. Multiple recent iwlwifi validation fixes from same authors/backporters in this tree.
### Step 3.5: Dependencies
**Record:** Standalone — no prerequisite commits. Patch 1/5 only touches iwl-drv.c. git apply --check passes cleanly on current HEAD.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- **b4 dig -c 9121064ed2d94:** https://patch.msgid.link/20260717173215.3
93c286488f9.Ia39144dc3ca334325ee4eacb7420901e2446fc23@changeid
- **Series:** v1 only, patch 1/5 of iwlwifi-fixes 07-17-2026
- **Review feedback:** No replies, NAKs, or stable nominations in saved thread
- lore.kernel.org blocked by bot protection (Anubis)
### Step 4.2: Reviewers
**Record:** **b4 dig -w** recipients: Miri Korenblit, [email protected], [email protected], Emmanuel Grumbach. Appropriate iwlwifi mailing list coverage.
### Step 4.3: Bug report
**Record:** No external bug report, syzbot, or user Reported-by. Theoretical/corrupt-firmware trigger.
### Step 4.4: Related patches
**Record:** Series patches 2–5 fix similar patterns elsewhere (iwl-dbg- tlv.c, ACPI WGDS, UEFI PPAG, SEC_RT TLV). Independent of this patch.
### Step 4.5: Stable list
**Record:** Could not search lore stable list (bot protection). No stable discussion found in mbox thread.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** iwl_parse_tlv_firmware() modified.
### Step 5.2: Callers
**Record:**
- iwl_req_fw_callback() → iwl_parse_tlv_firmware() when ucode->ver == 0 (TLV-format firmware)
- iwl_req_fw_callback() ← iwl_request_firmware() ← iwl_drv_start() ← PCIe probe path (iwl_drv_start() in pcie/gen1_2/trans.c)
- Runs during async firmware load at iwlwifi device probe/module init
### Step 5.3: Callees
**Record:** le32_to_cpu(), ALIGN(), set_sec_data()/set_sec_size()/set_sec_offset() in TLV switch. No locks/allocation in the fixed hunk.
### Step 5.4: Reachability
**Record:** Triggered whenever iwlwifi loads TLV-format ucode from /lib/firmware/. Requires malformed/corrupted firmware (not normal Intel images). Firmware files are root-controlled; unprivileged users cannot typically substitute firmware. Reachable on probe with bad firmware → driver load failure or kernel oops.
### Step 5.5: Similar patterns
**Record:** Same len < tlv_len + ALIGN(tlv_len, 4) pattern exists unfixed in:
- iwl-dbg-tlv.c:490-491 (patch 2/5 addresses separately)
- fw/pnvm.c, fw/uefi.c (other series patches or unfixed)
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **Yes.** Current HEAD (v6.18.44) has buggy code at lines 849–855:
```849:855:drivers/net/wireless/intel/iwlwifi/iwl-drv.c
if (len < tlv_len) {
IWL_ERR(drv, "invalid TLV len: %zd/%u\n",
len, tlv_len);
return -EINVAL;
}
len -= ALIGN(tlv_len, 4);
data += sizeof(*tlv) + ALIGN(tlv_len, 4);
```Fix commit 9121064ed2d94 is **not** on current HEAD (only on autosel branch).
### Step 6.2: Backport complications
**Record:** Clean apply confirmed (git apply --check exit 0). No refactoring conflicts in this file region.
### Step 6.3: Related fixes already present?
**Record:** No equivalent aligned-TLV validation fix in iwl-drv.c. Other iwlwifi validation fixes present but not for this specific bug.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **drivers/net/wireless/intel/iwlwifi** — IMPORTANT (widely deployed Intel WiFi hardware; driver-specific).
### Step 7.2: Subsystem activity
**Record:** Active — many iwlwifi fixes backported to this 6.18.y tree recently (validation, race, OOB fixes).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users with Intel iwlwifi hardware (CONFIG_IWLWIFI) loading TLV-format firmware during probe.
### Step 8.2: Trigger conditions
**Record:** Malformed TLV ucode where tlv_len == remaining_bytes and tlv_len % 4 != 0. Unlikely with legitimate Intel firmware; possible with corruption, partial download, or disk errors. Not easily triggered by unprivileged users.
### Step 8.3: Failure mode severity
**Record:** size_t underflow → parser continues with bogus length → OOB read past firmware buffer → potential kernel oops during driver probe. **Severity: MEDIUM-HIGH** (crash on probe), not CRITICAL (no privilege escalation, requires bad firmware).
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Prevents kernel crash on malformed firmware; aligns with other iwlwifi validation backports in this tree.
- **Risk:** Very low — 9-line validation addition, no behavior change for valid firmware.
- **Ratio:** Favorable for stable.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real bug: unsigned length underflow on malformed TLVs
- Can cause OOB reads / kernel oops during firmware load
- Fix is obviously correct, minimal, standalone
- Buggy code confirmed present in 6.18.44
- Applies cleanly
- Consistent with other iwlwifi validation fixes already in this tree
- Intel maintainer authorship
**AGAINST backport:**
- No user report or syzbot reproduction
- Requires malformed firmware (root-controlled resource)
- Legitimate Intel firmware unlikely to trigger
- Same pattern exists in other iwlwifi files (not fixed by this single patch)
**Unresolved:**
- Exact commit/version that introduced the buggy check (shallow repo limits history)
- No mailing list review discussion retrieved (lore blocked)
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic is clear; no Tested-by but pattern is standard validation.
2. Fixes a real bug? **PASS** — integer underflow with OOB parsing consequence.
3. Important issue? **PASS** — kernel oops on driver probe (MEDIUM- HIGH).
4. Small and contained? **PASS** — 1 file, ~9 net lines.
5. No new features/APIs? **PASS** — validation only.
6. Can apply to local tree? **PASS** — clean apply verified.
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs). Standard bug fix.
### Step 9.4: Decision rationale
For linux-6.18.y, the buggy TLV parser code exists, the fix is surgical and self-contained, and it prevents a real firmware-parsing underflow that can crash the kernel during iwlwifi probe. While triggering requires malformed firmware, the kernel must reject such input safely — matching the pattern of other iwlwifi validation fixes already accepted into this stable tree. Risk is minimal; benefit is meaningful for robustness.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user-provided commit message
- **[Phase 2]** Read diff and current iwl-drv.c lines 788–875; confirmed underflow mechanism
- **[Phase 3]** git describe HEAD → v6.18.44; shallow repo confirmed; git blame -L 849,855 → 5d324e5159d9e; git show 9121064ed2d94 on autosel branch; git merge-base --is-ancestor → fix NOT on HEAD
- **[Phase 3]** git log --grep="iwlwifi" — multiple validation fixes already in tree
- **[Phase 4]** b4 dig -c 9121064ed2d94 — lore URL found; b4 dig -a — v1, patch 1/5; b4 dig -w — linux-wireless CC'd; mbox saved and parsed — no review replies or stable nominations
- **[Phase 4]** lore.kernel.org fetch blocked by Anubis bot protection
- **[Phase 5]** grep iwl_parse_tlv_firmware — caller chain via iwl_req_fw_callback → iwl_drv_start; grep ALIGN(tlv_len, 4) — same pattern in iwl-dbg-tlv.c, pnvm.c, uefi.c
- **[Phase 6]** Buggy code present at iwl-drv.c:849-855; git apply --check from 9121064ed2d94 → passes
- **[Phase 6]** Fix not on HEAD; only on autosel branch
- **[Phase 8]** Failure mode: size_t underflow → OOB read → probe-time oops; trigger requires malformed firmware
**YES**
drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +11 -2
@@ -803,6 +803,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,u32 build, paging_mem_size;int num_of_cpus;bool usniffer_req = false; +size_t aligned_tlv_len;if (len <sizeof (*ucode)) {IWL_ERR (drv,"uCode has invalid length: %zd\n" , len);
@@ -851,8 +852,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, len, tlv_len);return -EINVAL ; } - len -=ALIGN (tlv_len,4 ); - data +=sizeof (*tlv) +ALIGN (tlv_len,4 ); + + aligned_tlv_len =ALIGN (tlv_len,4 ); +if (len < aligned_tlv_len) { +IWL_ERR (drv,"invalid aligned TLV len: %zd/%zu\n" , + len, aligned_tlv_len); +return -EINVAL ; + } + + len -= aligned_tlv_len; + data +=sizeof (*tlv) + aligned_tlv_len;switch (tlv_type) {case IWL_UCODE_TLV_INST :
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 phy: qcom: m31-eusb2: Make USB repeater optional
In reply to Sasha LevinFrom: Wesley Cheng <[email protected]>
[ Upstream commit a62bfbcf2db4ae6eb7a544a40b1075a81784ea41 ]
A repeater is not required for the PHY to function. On systems with multiple PHY instances connected to a multi-port controller, some PHYs may be unconnected. All PHYs must still probe successfully even without attached repeaters, otherwise the controller probe fails.
So make it optional.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: phy: qcom: m31-eusb2: Make USB repeater optional
**Local tree:** Linux **6.18.43** (v6.18.43-1-gc7f0dac02d232) **Commit under review:** dd085bf278421 (upstream a62bfbcf2db4) — **not yet in this tree**
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [phy: qcom: m31-eusb2] [make] — Make the USB repeater optional in the Qualcomm M31 eUSB2 PHY driver probe path.
### Step 1.2: Tags
**Record:**
- **Fixes:** — absent
- **Reported-by:** — absent
- **Tested-by:** — absent
- **Reviewed-by:** Dmitry Baryshkov, Bjorn Andersson, Neil Armstrong, Konrad Dybcio
- **Acked-by:** — absent
- **Link:** https://patch.msgid.link/20260302-phy-qcom-m31-eusb2-make-
[email protected]
- **Cc: stable:** — absent (expected for manual review)
- **Signed-off-by:** Wesley Cheng, Abel Vesa, Vinod Koul (ignore pipeline SOBs)
Notable: multiple subsystem maintainers reviewed; no syzbot/fuzzer report.
### Step 1.3: Body analysis
**Record:**
- **Bug:** Driver requires an eUSB2 repeater at probe time via devm_of_phy_get_by_index(), but repeaters are not always present.
- **Symptom:** On multi-port controllers with multiple PHY instances, PHYs without attached repeaters fail probe; that can fail the whole USB controller probe.
- **Root cause:** Repeater treated as mandatory when hardware/DT allows it to be absent.
- **Version info:** None in message; driver targets qcom,sm8750-m31-eusb2-phy.
### Step 1.4: Hidden bug fix?
**Record:** Yes. Despite “make optional” wording, this is a real probe- failure bug fix, not a feature. The DT binding already lists phys as optional (not in required:), but the driver enforced it as mandatory.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/phy/qualcomm/phy-qcom-m31-eusb2.c (+1 / -1)
- **Function:** m31eusb2_phy_probe()
- **Scope:** Single-file, single-line surgical change
### Step 2.2: Code flow change
**Record:**
- **Before:** devm_of_phy_get_by_index(dev, dev->of_node, 0) returns -ENODEV when no phys property → probe fails.
- **After:** devm_phy_optional_get(dev, NULL) converts -ENODEV to NULL → probe succeeds.
- **Path affected:** Platform device probe during boot/module init.
### Step 2.3: Bug mechanism
**Record:** **Logic / correctness fix** — mandatory resource lookup for an optional component. Category: driver/DT mismatch causing cascading probe failure.
With repeater present, both APIs resolve index 0 via _of_phy_get() (verified in phy_get() and devm_of_phy_get_by_index()).
### Step 2.4: Fix quality
**Record:**
- Fix is minimal and matches established pattern in phy-snps-eusb2.c (devm_of_phy_optional_get).
- phy_init(), phy_exit(), and phy_set_mode_ext() all accept NULL and return 0 (verified in phy-core.c).
- No new deadlock/locking risk.
- IS_ERR() check after optional get remains correct (only real errors propagate).
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Repeater lookup introduced in 5d324e5159d9e (6.18 merge, Nov 2025). Buggy line present at drivers/phy/qualcomm/phy- qcom-m31-eusb2.c:288 in this tree.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Recent history in this tree:
- 09e1c96594afb — PLL_EN suspend power fix (backported, Cc: stable)
- 37ef11ab2cf3c — init sequence update
- Driver arrived via 5d324e5159d9e (6.18)
Standalone one-patch fix; not part of a multi-patch dependency series.
### Step 3.4: Author context
**Record:** Wesley Cheng is the driver author and DT binding maintainer. Abel Vesa committed v2. Vinod Koul (PHY maintainer) merged. Multiple Qualcomm/ARM maintainers reviewed.
### Step 3.5: Dependencies
**Record:** No prerequisites. devm_phy_optional_get() exists in this tree’s phy-core.c. Fix applies cleanly to current 68f1ba8fec4ad index state.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- **b4 dig:** https://patch.msgid.link/20260227-phy-qcom-m31-eusb2-make-
[email protected]
- **Revisions:** v1 (2026-02-27), v2 (2026-03-02, committed version)
- **Feedback:** Reviewed-by from Dmitry Baryshkov and Bjorn Andersson on v1; no NAKs found
- **Stable nomination in thread:** none found
### Step 4.2: Reviewers
**Record:** CC’d: [email protected], linux-arm- [email protected], Vinod Koul, Bjorn Andersson, Dmitry Baryshkov — appropriate maintainer coverage.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link. Bug described from hardware/DT design requirements.
### Step 4.4: Related patches
**Record:** Separate follow-up on master: 361f533a2dce2 (“Fix return value of init call”) — fixes unrelated error-path return bug; **not** a prerequisite for this change.
### Step 4.5: Stable list
**Record:** No stable-list discussion found for this specific patch.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** m31eusb2_phy_probe() modified; downstream users of phy->repeater: m31eusb2_phy_init(), m31eusb2_phy_exit(), m31eusb2_phy_set_mode().
### Step 5.2: Callers
**Record:** m31eusb2_phy_probe registered as platform_driver .probe → called during device enumeration for qcom,sm8750-m31-eusb2-phy nodes.
### Step 5.3: Callees
**Record:** devm_phy_optional_get() → devm_phy_get() → _of_phy_get(dev->of_node, 0) for DT devices.
### Step 5.4: Reachability
**Record:** Triggered at boot on Qualcomm platforms with CONFIG_PHY_QCOM_M31_EUSB=y/m. Affects kernel init / module probe, not a syscall path.
### Step 5.5: Similar patterns
**Record:** drivers/phy/phy-snps-eusb2.c:589 uses devm_of_phy_optional_get() for the same repeater pattern.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **Yes.** Current tree still has:
```288:291:drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
phy->repeater = devm_of_phy_get_by_index(dev, dev->of_node, 0);
if (IS_ERR(phy->repeater))
return dev_err_probe(dev, PTR_ERR(phy->repeater),
"failed to get repeater\n");
```Driver and Kconfig (PHY_QCOM_M31_EUSB) both exist. git merge-base --is-ancestor dd085bf278421 HEAD → **NOT_IN_TREE**.
### Step 6.2: Backport complications
**Record:** Clean one-line apply expected. No refactor conflicts in probe path.
### Step 6.3: Related fixes already present?
**Record:** PLL_EN suspend fix (09e1c96594afb) already backported — shows maintainers are already carrying m31-eusb2 fixes into 6.18.y. Init return-value fix (361f533a2dce2) is **not** in this tree (separate issue).
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem / criticality
**Record:** drivers/phy/qualcomm/ — **PERIPHERAL** (platform-specific Qualcomm USB PHY driver). Impact is limited to ARCH_QCOM + CONFIG_PHY_QCOM_M31_EUSB.
### Step 7.2: Activity
**Record:** New driver in 6.18; actively receiving fixes (PLL_EN, init sequence, this repeater fix on mainline).
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** Users of Qualcomm SM8750 (qcom,sm8750-m31-eusb2-phy) with multi-PHY USB controllers where some PHY instances lack repeaters. Config-specific, platform-specific.
### Step 8.2: Trigger conditions
**Record:** DT node for M31 eUSB2 PHY without phys property (or no connected repeater). Common on multi-port designs with unconnected ports. Triggered at every boot for affected boards.
### Step 8.3: Failure mode / severity
**Record:** PHY probe returns -ENODEV → USB controller probe may fail → **USB completely non-functional** on affected ports/boards. Not a crash/UAF/security issue, but a **HIGH functional impact** for affected hardware. Severity: **HIGH** (hardware broken), not CRITICAL (no memory corruption/panic).
### Step 8.4: Risk vs benefit
**Record:**
- **Benefit:** Enables USB on valid hardware configs; aligns driver with DT binding; prevents cascading probe failure.
- **Risk:** Very low — one line, reviewed, NULL-safe downstream via phy core.
- **Ratio:** High benefit for affected users, negligible risk.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real bug: mandatory repeater breaks probe when absent
- Driver exists in 6.18.43
- DT binding already marks phys optional
- One-line, reviewed fix
- Phy core handles NULL repeater safely
- Prior m31-eusb2 fix already backported to this tree
- Matches snps-eusb2 established pattern
**AGAINST backport:**
- Very new, platform-specific driver (SM8750 only)
- No syzbot/user bug report
- Not a security/crash/data-corruption issue
- No in-tree DTS examples yet for this PHY
- Limited 6.18 stable user base for this hardware
**Unresolved:** No production deployment data for SM8750 on 6.18.y (unverifiable).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — reviewed by PHY/ARM maintainers; semantics verified against phy core.
2. Fixes a real bug? **PASS** — probe failure on valid hardware configs.
3. Important issue? **PASS** — USB controller/PHY probe failure renders USB non-functional on affected boards.
4. Small and contained? **PASS** — 1 line, 1 file.
5. No new features/APIs? **PASS** — corrects driver to match existing optional DT property.
6. Can apply to local tree? **PASS** — driver and APIs present; clean apply.
### Step 9.3: Exception category
**Record:** Hardware workaround / driver-DT mismatch fix (similar to quirk category). Not a new device ID, but fixes hardware enablement for existing driver.
### Step 9.4: Decision rationale
For **this 6.18.43 tree**, the driver is present and the bug is present. The fix is trivial, correct, and safe. While the audience is narrow (Qualcomm SM8750), the failure mode is complete USB probe failure on valid multi-port designs — exactly the kind of contained hardware- enablement fix stable trees accept when the driver already ships in that series. The DT binding never required phys; the driver was wrong from introduction.
---
## Verification
- **[Phase 1]** Parsed commit dd085bf278421 message and all tags via git show
- **[Phase 1]** Confirmed no Reported-by/syzbot/Fixes:/Cc: stable tags
- **[Phase 2]** Verified diff: 1 line in m31eusb2_phy_probe()
- **[Phase 2]** Verified phy_init(NULL), phy_exit(NULL), phy_set_mode_ext(NULL) return 0 in drivers/phy/phy- core.c:232,272,386
- **[Phase 2]** Verified devm_phy_optional_get() converts -ENODEV to NULL in phy-core.c:841-848
- **[Phase 2]** Verified phy_get(dev, NULL) uses index 0 via _of_phy_get() in phy-core.c:767-773
- **[Phase 3]** git blame -L 288,291: buggy code from 5d324e5159d9e
- **[Phase 3]** git log --oneline -- drivers/phy/qualcomm/phy- qcom-m31-eusb2.c: driver history in 6.18.y
- **[Phase 3]** git merge-base --is-ancestor dd085bf278421 HEAD → NOT_IN_TREE
- **[Phase 4]** b4 dig -c dd085bf278421: found v1/v2 lore threads
- **[Phase 4]** b4 dig -w: confirmed maintainer CC list
- **[Phase 4]** b4 dig -m /tmp/m31-eusb2-repeater.mbox: no stable nomination, no NAKs
- **[Phase 5]** Read m31eusb2_phy_init/exit/set_mode — all pass phy->repeater to NULL-safe phy core APIs
- **[Phase 5]** Compared with phy-snps-eusb2.c:589 optional repeater pattern
- **[Phase 6]** git describe HEAD → v6.18.43; Makefile → 6.18.43
- **[Phase 6]** Read current phy-qcom-m31-eusb2.c — buggy devm_of_phy_get_by_index still present
- **[Phase 6]** Read Documentation/devicetree/bindings/phy/qcom,m31-eusb2-phy.yaml — phys not in required
- **[Phase 6]** grep for sm8750-m31-eusb2 in *.dts* → no in-tree DTS (driver/bindings only)
- **[Phase 6]** Confirmed CONFIG_PHY_QCOM_M31_EUSB exists in drivers/phy/qualcomm/Kconfig
- **[Phase 6]** Confirmed prior stable backport 09e1c96594afb (PLL_EN) already in this tree
- **[Phase 8]** Assessed failure mode as probe failure → USB non- functional (not kernel crash)
**YES**
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +1 -1
@@ -285,7 +285,7 @@ static int m31eusb2_phy_probe(struct platform_device *pdev)phy_set_drvdata (phy->phy, phy); - phy->repeater =devm_of_phy_get_by_index (dev, dev->of_node,0 ); + phy->repeater =devm_phy_optional_get (dev,NULL );if (IS_ERR (phy->repeater))return dev_err_probe (dev,PTR_ERR (phy->repeater),"failed to get repeater\n" );
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] phy: qcom: m31-eusb2: Make USB repeater optional
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The error path in m31eusb2_phy_init() incorrectly returns 0 (success) after an initialization failure, discarding the actual error code.
- [High] Return values of PHY hardware initialization sequences are ignored in m31eusb2_phy_init().
--
commit be42870353c78e4db57cfea8eea743473035b9a6
Author: Wesley Cheng <[email protected]>
Subject: phy: qcom: m31-eusb2: Make USB repeater optional
A repeater is not required for the PHY to function. On systems with multiple PHY instances connected to a multi-port controller, some PHYs may be unconnected. All PHYs must still probe successfully even without attached repeaters, otherwise the controller probe fails.
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c static int m31eusb2_phy_probe(struct platform_device *pdev) · line 289
Quoted 13 lines
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c +1
-1@@ -283,7 +283,7 @@ static int m31eusb2_phy_probe(struct platform_device *pdev)phy_set_drvdata (phy->phy, phy); - phy->repeater =devm_of_phy_get_by_index (dev, dev->of_node,0 ); + phy->repeater =devm_phy_optional_get (dev,NULL );if (IS_ERR (phy->repeater))return dev_err_probe (dev,PTR_ERR (phy->repeater),"failed to get repeater\n" );
[Severity: High]
This isn't a bug introduced by this patch, but in m31eusb2_phy_init(), the return values of PHY hardware initialization sequences are ignored:
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c:m31eusb2_phy_init() {
...
m31eusb2_phy_write_sequence(phy, data->setup_seq, data->setup_seq_nregs);
m31eusb2_phy_write_readback(phy->base,
USB_PHY_HS_PHY_CTRL_COMMON0, FSEL,
FIELD_PREP(FSEL, data->fsel));
m31eusb2_phy_write_sequence(phy, data->override_seq, data->override_seq_nregs);
m31eusb2_phy_write_sequence(phy, data->reset_seq, data->reset_seq_nregs);
return 0;
...
}Can this cause unpredictable USB bus behavior or controller lockups if a hardware write readback mismatch occurs and the PHY core proceeds with a misconfigured PHY?
[Severity: High]
This is also a pre-existing issue, but the error path in m31eusb2_phy_init() incorrectly returns 0 (success) after an initialization failure:
drivers/phy/qualcomm/phy-qcom-m31-eusb2.c:m31eusb2_phy_init() {
...
ret = clk_prepare_enable(phy->clk);
if (ret) {
dev_err(&uphy->dev, "failed to enable ref clock, %d\n", ret);
goto disable_repeater;
}
...
disable_repeater:
phy_exit(phy->repeater);
disable_vreg:
regulator_bulk_disable(M31_EUSB_NUM_VREGS, phy->vregs);
return 0;
}If the initialization sequence fails (e.g., clk_prepare_enable or phy_init fails), it jumps to these cleanup labels. Since the function unconditionally returns 0, the error code is discarded.
Could this mask initialization failures and lead to system hangs (e.g., synchronous external aborts) or broken USB functionality when the controller attempts to use an unclocked or unpowered PHY?
Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sasha Levin
maintainerPATCH 1/1 ACPICA: Add validation for node in acpi_ns_build_normalized_path()
In reply to Sasha LevinFrom: ikaros <[email protected]>
[ Upstream commit 96b2b616870e46e2bc04efec03879683a0036e66 ]
Add validation for node in acpi_ns_build_normalized_path() to prevent use-after-free vulnerabilities.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [ACPICA] [Add] validation for node in acpi_ns_build_normalized_path() to prevent use-after-free
**Step 1.2 — Tags**
Record:
- Link: https://github.com/acpica/acpica/commit/b35adf49e89a
- Link: https://patch.msgid.link/[email protected]
- Signed-off-by: ikaros \<[email protected]\>
- Signed-off-by: Rafael J. Wysocki \<[email protected]\>
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, or Cc: stable tags
- Notable: ACPICA maintainer (Rafael J. Wysocki) signed off; upstream ACPICA commit link present
**Step 1.3 — Body analysis**
Record:
- Bug: acpi_ns_build_normalized_path() can dereference an invalid/freed namespace node pointer
- Symptom: heap use-after-free when reading next_node->name
- Root cause (from upstream issue #1138): during ACPI AML parsing/cleanup, walk state is freed while a stale method_node is still passed into pathname building via acpi_ex_stop_trace_method() → acpi_ns_get_normalized_pathname() → acpi_ns_build_normalized_path()
- No kernel version range stated in commit message
**Step 1.4 — Hidden bug fix?**
Record: No — explicitly described as UAF prevention, not disguised cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- drivers/acpi/acpica/nsnames.c: +6 lines, 0 removed
- Function modified: acpi_ns_build_normalized_path()
- Scope: single-file, surgical fix
**Step 2.2 — Code flow change**
Record:
- Before: after NULL check on node, function immediately walks next_node->parent chain and reads next_node->name via ACPI_MOVE_32_TO_32
- After: if ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED, jump to build_trailing_null (return empty path with trailing NUL) instead of dereferencing
- Affected path: any caller passing a stale/invalid node into acpi_ns_build_normalized_path()
**Step 2.3 — Bug mechanism**
Record:
- Category: **memory safety / use-after-free**
- Mechanism: freed walk-state memory is still referenced as a namespace node; reading next_node->name at the line equivalent to current line 232 triggers ASAN heap-use-after-free (confirmed upstream in ACPICA issue #1138)
**Step 2.4 — Fix quality**
Record:
- Obviously correct: matches existing ACPICA validation pattern used in acpi_ns_get_pathname_length() (lines 56–63 of the same file), acpi_ns_validate_handle(), and acpi_ut_get_node_name()
- Minimal, no unrelated changes
- Regression risk: very low — invalid nodes get empty path instead of crash; valid nodes unchanged
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: vulnerable loop introduced in d1e7ffe50ba58 (2015, "ACPICA:
Namespace: Add function to directly return normalized full path"). Bug has been present since that function was added.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag in commit message.
**Step 3.3 — File history**
Record: nsnames.c is long-stable ACPI code; recent changes are formatting/copyright, not structural refactors. Fix is standalone (not dependent on other patches in the 27-patch ACPICA series).
**Step 3.4 — Author**
Record: ikaros (void0red) reported the UAF to upstream ACPICA; Rafael J. Wysocki (ACPI maintainer) committed to Linux.
**Step 3.5 — Dependencies**
Record: no prerequisites. Patch 12/27 in the same series fixes a related UAF in acpi_ds_terminate_control_method(), but this validation patch is independent and self-contained. git apply --check confirms clean apply to this tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- b4 dig found: [PATCH v1 19/27] at
https://patch.msgid.link/[email protected]
- Part of "ACPI: ACPICA 20260408" series (27 patches)
- v1 only revision found
- No NAKs or stable nominations found in thread mbox
**Step 4.2 — Reviewers**
Record: CC'd to Rafael J. Wysocki, linux-acpi, LKML, Saket Dumbre, Pawel Chmielewski (Intel ACPICA developers).
**Step 4.3 — Bug report**
Record: ACPICA GitHub issue #1138 documents:
- ASAN heap-use-after-free at AcpiNsBuildNormalizedPath reading 4 bytes (next_node->name)
- Reproducer: ./generate/unix/bin/acpiexec -m issue33.aml
- Call chain: acpi_ns_build_normalized_path ← acpi_ns_get_normalized_pathname ← acpi_ex_stop_trace_method ← acpi_ds_terminate_control_method ← AML parse/table load path
- Severity: confirmed memory safety bug with concrete reproducer
**Step 4.4 — Related patches**
Record: patch 12/27 addresses a different UAF root cause in acpi_ds_terminate_control_method(). Patch 19/27 (this commit) is a defensive guard at the common pathname builder. Both are security- relevant; this one stands alone.
**Step 4.5 — Stable list**
Record: no Cc: stable discussion found in downloaded thread.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: acpi_ns_build_normalized_path() (modified); callers include acpi_ns_get_pathname_length(), acpi_ns_handle_to_pathname(), acpi_ns_get_normalized_pathname()
**Step 5.2 — Callers**
Record: acpi_ns_get_normalized_pathname() is called from many ACPI paths including:
- acpi_ex_stop_trace_method() in extrace.c (UAF trigger path)
- acpi_ns_get_external_pathname(), nsparse.c, nsinit.c, dsmethod.c, nseval.c, nssearch.c
- Debugger-only paths (db*.c) — less relevant for production
**Step 5.3 — Callees**
Record: reads node descriptor type, walks parent chain, copies 4-byte ACPI names; no allocation in the vulnerable section.
**Step 5.4 — Reachability**
Record:
- Call chain reaches ACPI table loading and method termination during normal kernel ACPI operation (boot + runtime method execution)
- Trigger requires crafted/malformed ACPI AML that causes walk-state teardown with stale node reference — demonstrated with issue33.aml in acpiexec; same ACPICA code runs in the kernel
**Step 5.5 — Similar patterns**
Record: acpi_ns_get_pathname_length() already validates descriptor type before calling acpi_ns_build_normalized_path(), but acpi_ns_get_normalized_pathname() does not — creating the gap this patch closes at the lowest common level.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code in tree?**
Record: **YES**. Local tree is **Linux 6.18.44** (git describe HEAD → v6.18.44). Vulnerable code is present at lines 221–244 of drivers/acpi/acpica/nsnames.c without the descriptor-type check. Fix commit 96b2b616870e4 is **not** an ancestor of HEAD.
**Step 6.2 — Backport complications**
Record: clean apply confirmed (git apply --check → CLEAN APPLY). No rework needed.
**Step 6.3 — Related fixes already present?**
Record: no — git log -S "Validate the Node to avoid use-after-free" finds nothing in this tree; related patch 12/27 (acpi_ds_terminate_control_method UAF fix) also absent.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem criticality**
Record: **ACPI/ACPICA** — IMPORTANT to CORE. ACPI is on every x86/ARM server, laptop, and most embedded systems with firmware tables.
**Step 7.2 — Activity**
Record: ACPI subsystem actively maintained in this tree (recent NULL- deref and execution-abort fixes in drivers/acpi/acpica/).
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: all systems using in-kernel ACPICA for ACPI table parsing and AML method execution.
**Step 8.2 — Trigger conditions**
Record: malformed/crafted ACPI AML during table load or method termination with tracing enabled path; demonstrated with acpiexec + crafted AML. Requires specific ACPI content, but ACPI tables are firmware-supplied and occasionally attacker-influenced (e.g., custom DSDT injection in some environments).
**Step 8.3 — Failure mode severity**
Record: **heap use-after-free** → kernel oops/panic or potential information disclosure/exploitation primitive. Severity: **HIGH**.
**Step 8.4 — Risk-benefit**
Record:
- Benefit: **HIGH** — prevents real UAF on ACPI parsing path
- Risk: **VERY LOW** — 6-line defensive check, established ACPICA pattern
- Ratio: strongly favors backport
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
FOR backport:
- Confirmed heap UAF with ASAN report and reproducer (ACPICA #1138)
- Affects ACPI table/method execution — common kernel path
- Small, surgical, obviously correct fix
- Matches existing validation patterns in same subsystem
- Applies cleanly to Linux 6.18.44
- Signed off by ACPI maintainer
- Bug present since 2015 — long exposure window
AGAINST backport:
- Part of larger ACPICA import series (but this patch is standalone)
- No explicit stable nomination in mailing list
- Related root-cause fix exists separately in patch 12/27 (but this defensive fix has independent value)
UNRESOLVED: none material to the decision.
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — ASAN-verified bug, standard ACPICA validation pattern
2. Fixes a real bug? **PASS** — confirmed heap UAF
3. Important issue? **PASS** — memory safety during ACPI parsing (crash/security)
4. Small and contained? **PASS** — 6 lines, one function
5. No new features/APIs? **PASS** — defensive validation only
6. Can apply to local tree? **PASS** — clean apply verified
**Step 9.3 — Exception category**
Record: N/A (security/memory-safety bug fix, not a quirk/ID/DT exception).
**Step 9.4 — Decision rationale**
For **Linux 6.18.44**, this commit should be backported. The vulnerable acpi_ns_build_normalized_path() code exists in this tree, the fix is absent, and upstream has demonstrated a reproducible heap use-after-free on the ACPI AML parsing/teardown path that the kernel shares. The fix is minimal, follows established ACPICA conventions already used in sibling functions in the same file, and prevents dereferencing freed namespace nodes by validating the descriptor type before walking the parent chain.
---
## Verification
- [Phase 1] Parsed commit message and tags from git show 96b2b616870e4
- [Phase 1] Fetched ACPICA upstream issue #1138 — ASAN UAF confirmed with stack trace and reproducer
- [Phase 2] Diff analysis: +6 lines adding ACPI_GET_DESCRIPTOR_TYPE check before node walk
- [Phase 2] Read current nsnames.c lines 193–270 in tree — vulnerable code confirmed present
- [Phase 3] git blame -L 221,245: buggy loop from d1e7ffe50ba58 (2015)
- [Phase 3] git merge-base --is-ancestor 96b2b616870e4 HEAD → FIX NOT IN TREE
- [Phase 3] git apply --check on patch → CLEAN APPLY
- [Phase 4] b4 dig -c 96b2b616870e4 → lore URL found; patch 19/27 of ACPICA series
- [Phase 4] b4 dig -w → Rafael Wysocki, linux-acpi, LKML CC'd
- [Phase 4] Downloaded mbox; grep found no Cc: stable; found related patch 12/27
- [Phase 5] grep acpi_ns_get_normalized_pathname — multiple kernel callers including extrace.c:284
- [Phase 5] Read extrace.c acpi_ex_stop_trace_method() and dsmethod.c:850 call site
- [Phase 5] Confirmed acpi_ns_get_pathname_length() already validates at line 58; acpi_ns_get_normalized_pathname() does not
- [Phase 6] git describe HEAD → v6.18.44
- [Phase 6] Confirmed validation check absent in current nsnames.c
- [Phase 7] git log --oneline -20 -- drivers/acpi/acpica/ — active subsystem
- [Phase 8] UAF severity assessed from ASAN report in issue #1138
**YES**The analysis is complete for **ACPICA: Add validation for node in acpi_ns_build_normalized_path()** on **Linux 6.18.44**.
**Summary:** This is a small (6-line) fix for a confirmed heap use- after-free in ACPI pathname building. The vulnerable code is present in this tree; the fix is not. It applies cleanly and follows existing ACPICA validation patterns. Upstream demonstrated the bug with ASAN on the ACPI AML parse/teardown path (acpi_ex_stop_trace_method → acpi_ns_get_normalized_pathname → acpi_ns_build_normalized_path).
**Verdict for this tree: YES** — worth backporting as a memory-safety fix on a common ACPI path.
drivers/acpi/acpica/nsnames.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/acpica/nsnames.c +6 -0
@@ -222,6 +222,12 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, goto build_trailing_null; } +/* Validate the Node to avoid use-after-free vulnerabilities */ + +if (ACPI_GET_DESCRIPTOR_TYPE (node) !=ACPI_DESC_TYPE_NAMED ) { + goto build_trailing_null; + } + next_node = node;while (next_node && next_node != acpi_gbl_root_node) {if (next_node != node) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 Bluetooth: btmtk: Disable remote wakeup for MT7922/MT7925
In reply to Sasha LevinFrom: Rong Zhang <[email protected]>
[ Upstream commit e31d761628ad7e96490fc78105ed0a064ec1c1d9 ]
These NICs are often reported to lose their Bluetooth interfaces, i.e, their USB interfaces suddenly become completely unresponsive, causing the USB core to reset them, only to find that they are no longer accessible. A power cycle is required to make the Bluetooth interfaces recover.
After some investigations, I found that their USB autosuspend remote wakeup capabilities are so broken that they are precisely the culprit behind the issue:
[27452.608056] hub 3-0:1.0: state 7 ports 5 chg 0000 evt 0020
[27452.702018] usb 3-5: usb wakeup-resume
[27452.716038] usb 3-5: Waited 0ms for CONNECT
[27452.716642] usb 3-5: finish resume
/* usbmon showed that the device was completely unresponsive to any
URBs after the remote wakeup */
[27457.836030] usb 3-5: retry with reset-resume
[27457.956046] usb 3-5: reset high-speed USB device number 4 using xhci_hcd
[27463.332047] usb 3-5: device descriptor read/64, error -110
[27478.948117] usb 3-5: device descriptor read/64, error -110
[27479.172430] usb 3-5: reset high-speed USB device number 4 using xhci_hcd
[27484.332035] usb 3-5: device descriptor read/64, error -110
[27499.940039] usb 3-5: device descriptor read/64, error -110
[27500.164060] usb 3-5: reset high-speed USB device number 4 using xhci_hcd
[27505.196142] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27510.576045] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27510.784038] usb 3-5: device not accepting address 4, error -62
[27510.912215] usb 3-5: reset high-speed USB device number 4 using xhci_hcd
[27515.948307] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27521.324380] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27521.525107] usb 3-5: device not accepting address 4, error -62
[27521.525928] usb usb3-port5: logical disconnect
[27521.525996] usb 3-5: gone after usb resume? status -19
[27521.526230] usb 3-5: can't resume, status -19
[27521.526434] usb usb3-port5: logical disconnect
[27521.526469] usb usb3-port5: resume, status -19
[27521.526493] usb usb3-port5: status 0503, change 0004, 480 Mb/s
[27521.526528] usb 3-5: USB disconnect, device number 4
[27521.526736] usb 3-5: unregistering device
[27521.804029] usb 3-5: new high-speed USB device number 5 using xhci_hcd
[27527.076067] usb 3-5: device descriptor read/64, error -110
[27542.692027] usb 3-5: device descriptor read/64, error -110
[27542.916047] usb 3-5: new high-speed USB device number 6 using xhci_hcd
[27548.068043] usb 3-5: device descriptor read/64, error -110
[27563.684073] usb 3-5: device descriptor read/64, error -110
[27563.792133] usb usb3-port5: attempt power cycle
[27563.924381] hub 3-0:1.0: port_wait_reset: err = -11
[27563.925213] usb usb3-port5: not enabled, trying reset again...
[27564.184398] usb 3-5: new high-speed USB device number 7 using xhci_hcd
[27569.196322] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27574.572040] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27574.776053] usb 3-5: device not accepting address 7, error -62
[27574.900165] usb 3-5: new high-speed USB device number 8 using xhci_hcd
[27579.948039] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27585.324331] xhci_hcd 0000:67:00.0: Timeout while waiting for setup device command
[27585.528040] usb 3-5: device not accepting address 8, error -62
[27585.528389] usb usb3-port5: unable to enumerate USB device
[27585.528424] hub 3-0:1.0: state 7 ports 5 chg 0000 evt 0020To reproduce the issue, these conditions must be met:
- a noisy radio environment (cafe or office) to cause frequent remote wakeup events
- no Bluetooth device is connected, so autosuspend is not prohibited
- the Bluetooth interface is opened, so remote wakeup is enabled when the device runs into autosuspend
Then I can reproduce the issue within sereval hours each time.
Increasing TRSMRCY or setting USB_QUIRK_RESET doesn't help at all.
Since the remote wakeup capability is super broken, just disable it to get rid of the troubles. The device can still be autosuspended when the bluetooth interface is closed, which won't break the device as remote wakeup is unneeded in this case.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: **[Bluetooth: btmtk]** **[Disable]** — disable broken USB remote wakeup for MT7922/MT7925 MediaTek Bluetooth controllers.
**Step 1.2 — Tags**
Record:
- **Link:** https://bbs.archlinux.org/viewtopic.php?id=308169
- **Link:** https://bbs.bee-link.com/d/7694-gtr9-pro-ai-max-395-usb-
issues
- **Signed-off-by:** Rong Zhang \<[email protected]\> (author)
- **Signed-off-by:** Luiz Augusto von Dentz \<[email protected]\> (Bluetooth maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
[email protected]
- Notable: maintainer Signed-off-by; two public user forum links documenting widespread hardware issues
**Step 1.3 — Body analysis**
Record:
- **Bug:** MT7922/MT7925 USB Bluetooth interfaces become completely unresponsive after a broken USB remote-wakeup/autosuspend resume cycle.
- **Symptom:** USB core logs usb wakeup-resume, device stops answering URBs, repeated reset-resume failures (error -110, error -62), logical disconnect, enumeration failure; only a full power cycle recovers Bluetooth.
- **Root cause (author):** USB autosuspend remote-wakeup on these chips is fundamentally broken.
- **Trigger:** Noisy RF environment → frequent remote wakeup; no BT connection (autosuspend allowed); HCI interface open (needs_remote_wakeup enabled).
- **Reproducibility:** Author reproduces within hours under those conditions.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Despite “Disable” wording, this is a hardware quirk workaround for a real, user-visible failure — same class as existing Bluetooth USB wakeup workarounds.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **Files:** drivers/bluetooth/btmtk.c (+10 lines, 0 removed)
- **Function:** btmtk_usb_setup()
- **Scope:** Single-file, surgical change in a switch (dev_id) case block
**Step 2.2 — Code flow**
Record:
- **Before:** case 0x7922: / case 0x7925: fall through directly into shared 79xx firmware setup with default USB wakeup capability.
- **After:** For 7922/7925 only, call device_set_wakeup_capable(&btmtk_data->udev->dev, false), then fallthrough into the shared 7961/79xx path.
- **Path:** Runs during btmtk_usb_setup() → btusb_mtk_setup() → hdev->setup on each HCI open (HCI_QUIRK_NON_PERSISTENT_SETUP).
**Step 2.3 — Bug mechanism**
Record: **Hardware quirk / PM correctness fix.** USB core enables remote wakeup when intf->needs_remote_wakeup is set (in btusb_open()) and device_can_wakeup() is true. Broken remote wakeup on MT7922/7925 leaves the device dead on resume. Disabling wakeup capability prevents the broken path while preserving autosuspend when the interface is closed.
**Step 2.4 — Fix quality**
Record:
- **Quality:** High — mirrors the existing CSR/Barrot workaround in btusb.c (device_set_wakeup_capable(..., false) at line 2584).
- **Regression risk:** Low — only affects MT7922/MT7925; trade-off is losing remote wakeup from autosuspend while HCI is open, which the author documents as non-functional on this hardware anyway.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- case 0x7922: / case 0x7925: introduced in 5c5e8c52e3caf (2024-07-15) when setup moved to btmtk.c.
- case 0x7961: added in a7208610761ae (2025-01-10).
- MT7922 USB support dates to 09a19d6dd974c (2021); MT7925 to 4c92ae75ea7d4 (2023).
- Bug has been present since wakeup-capable autosuspend was possible on these chips.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related file history**
Record:
- Active btmtk.c maintenance (URB leaks, WMT validation, shutdown fixes).
- No prior fix for this remote-wakeup issue in this tree.
- Mainline commit: e31d761628ad7e96490fc78105ed0a064ec1c1d9 (2026-06-11) — **not** an ancestor of local HEAD.
**Step 3.4 — Author context**
Record: Rong Zhang is a regular kernel contributor; patch merged with Bluetooth maintainer Luiz von Dentz SOB.
**Step 3.5 — Dependencies**
Record: **Standalone.** No series dependencies. Mainline references 0x7902/0x6639 cases not present in this 6.18.44 tree; adapted version applies cleanly (verified).
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record:
- **b4 dig:** https://patch.msgid.link/20260603-btmtk-remote-
[email protected]
- **Revisions:** v1 only (no v2/v3).
- Lore direct fetch blocked by bot protection; thread metadata obtained via b4.
**Step 4.2 — Reviewers**
Record: CC'd Marcel Holtmann, Luiz von Dentz, Matthias Brugger, linux- [email protected], [email protected].
**Step 4.3 — Bug reports**
Record:
- Arch Linux forum: MT7922 Bluetooth USB failures.
- Bee-link forum: GTR9 Pro USB/BT issues.
- Severity: device permanently unusable until power cycle — high functional impact.
**Step 4.4 — Related patches**
Record: Standalone single patch; not part of a multi-patch series.
**Step 4.5 — Stable list**
Record: Not searched (lore blocked); no stable discussion found via b4.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: btmtk_usb_setup(), called from btusb_mtk_setup() in btusb.c.
**Step 5.2 — Callers**
Record:
- btusb_mtk_setup() → btmtk_usb_setup() during HCI setup on every open.
- btusb_open() sets data->intf->needs_remote_wakeup = 1 (line 1948).
- USB PM in driver.c checks device_can_wakeup() before enabling do_remote_wakeup (line 1970).
**Step 5.3 — Callees**
Record: device_set_wakeup_capable() — PM helper, already used in btusb.c for similar purpose.
**Step 5.4 — Reachability**
Record: **Userspace-reachable** — opening Bluetooth (bluetoothd, hciconfig up, etc.) triggers setup; with CONFIG_BT_HCIBTUSB_AUTOSUSPEND (or runtime PM), autosuspend + remote wakeup is a normal laptop code path.
**Step 5.5 — Similar patterns**
Record: CSR/Barrot clone workaround in btusb.c uses identical device_set_wakeup_capable(false) approach for broken remote wakeup.
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
Record: **YES.** Local tree is **v6.18.44** (git describe HEAD → v6.18.44-1-g2736c32da98b9, make kernelversion → 6.18.44). drivers/bluetooth/btmtk.c lines 1335–1337 have case 0x7922: / case 0x7925: without wakeup disable. Fix commit e31d761628ad is **not** in this tree.
**Step 6.2 — Backport complications**
Record:
- Mainline patch does **not** apply verbatim (git apply --check fails — missing div class="content" cases).
- **Adapted patch applies cleanly** (insert wakeup disable + fallthrough before case 0x7961:).
- fallthrough already used in this file (lines 417, 966).
**Step 6.3 — Related fixes already present?**
Record: **No** equivalent fix in btmtk.c. btusb.c CSR workaround is unrelated hardware.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
Record: **drivers/bluetooth** (btmtk USB) — **IMPORTANT** (common laptop/mini-PC hardware, not core kernel but widely deployed).
**Step 7.2 — Activity**
Record: btmtk.c actively maintained in 6.18.y with multiple recent bug fixes.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users with USB MT7922/MT7925 Bluetooth (CONFIG_BT_HCIBTUSB + CONFIG_BT_HCIBTUSB_MTK) — very common on AMD Ryzen laptops and recent mini PCs.
**Step 8.2 — Trigger conditions**
Record: Autosuspend + open HCI + noisy RF → remote wakeup events. Moderately common on laptops in offices/cafés with Bluetooth scanning enabled.
**Step 8.3 — Failure severity**
Record: USB device permanently dead until power cycle; Bluetooth lost entirely. **HIGH** functional severity (not a kernel oops, but effectively bricks BT until reboot).
**Step 8.4 — Risk/benefit**
Record:
- **Benefit:** High — prevents common, hard-to-recover hardware failure on widely deployed chips.
- **Risk:** Very low — 10-line quirk, chip-specific, established pattern in same driver stack.
- **Ratio:** Strongly favors backport.
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Real hardware bug with detailed dmesg and author reproduction
- Multiple public user reports (Arch Linux, Bee-link)
- Bluetooth maintainer Signed-off-by
- Small, surgical, obviously correct quirk workaround
- Precedent in same subsystem (btusb.c CSR workaround)
- Buggy code present since MT7922/7925 support in this tree
- Adapted patch applies cleanly to 6.18.44
**Evidence AGAINST:**
- Mainline patch needs minor context adjustment (no 0x7902/0x6639 in this tree) — trivial
- Loses remote wakeup from autosuspend while HCI open — acceptable since hardware wakeup is broken
- Trigger requires specific conditions (noisy RF + autosuspend) — but consequences are severe
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — maintainer SOB; author reproduced; established pattern
2. Fixes real bug? **PASS** — documented user-visible device failure
3. Important issue? **PASS** — device bricking until power cycle
4. Small and contained? **PASS** — +10 lines, one file
5. No new features/APIs? **PASS** — hardware quirk workaround
6. Can apply to local tree? **PASS** — with trivial context adjustment
**Exception category:** Hardware quirk/workaround (#2 in stable exceptions).
---
## Verification
- [Phase 1] Parsed subject, tags, body from provided commit message and kernel.org patch
- [Phase 2] Diff analysis: +10 lines in btmtk_usb_setup(), adds device_set_wakeup_capable(false) + fallthrough
- [Phase 3] git describe HEAD: v6.18.44-1-g2736c32da98b9; make kernelversion: 6.18.44
- [Phase 3] git blame -L 1335,1340 drivers/bluetooth/btmtk.c:
7922/7925 from 5c5e8c52e3caf (2024-07-15)
- [Phase 3] git merge-base --is-ancestor e31d761628ad HEAD: exit 129 — fix NOT in tree
- [Phase 3] git log --oneline -20 -- drivers/bluetooth/btmtk.c: active maintenance, no duplicate fix
- [Phase 4] b4 dig -c e31d761628ad: lore URL found; v1 only
- [Phase 4] b4 dig -w: Marcel Holtmann, Luiz von Dentz CC'd
- [Phase 5] grep btmtk_usb_setup: called from btusb_mtk_setup() in btusb.c:2882
- [Phase 5] Read btusb.c:1948: needs_remote_wakeup = 1 on open
- [Phase 5] Read driver.c:1970: device_can_wakeup() gates remote wakeup
- [Phase 5] btusb.c:2584: existing device_set_wakeup_capable(false) precedent
- [Phase 6] grep device_set_wakeup_capable drivers/bluetooth/btmtk.c:
not present — bug exists
- [Phase 6] git apply --check mainline patch: FAIL (context mismatch)
- [Phase 6] git apply --check adapted patch for 6.18.44: PASS
- [Phase 6] grep 0x7902|0x6639 drivers/bluetooth/btmtk.c: no matches in this tree
- [Phase 8] MT7922 support since 2021 (09a19d6dd974c); MT7925 since 2023 (4c92ae75ea7d4)
---
## Summary
This commit fixes a real, reproducible hardware defect on extremely common MT7922/MT7925 USB Bluetooth controllers. When autosuspend remote wakeup fires (especially in noisy RF environments with the HCI interface open), the device becomes permanently unresponsive and requires a power cycle. The fix is a 10-line chip-specific quirk that disables broken remote wakeup — the same approach already used for CSR clone chips in btusb.c. For the locally checked-out **6.18.44** tree, the buggy code is present, the fix is absent, and an adapted version applies cleanly.
**YES**Those background searches finished and match the earlier analysis:
- **Local repo search** did not find this fix in the 6.18.44 tree; it only turned up an unrelated USB-core commit about freeze/quiesce remote wakeup.
- **Kernel.org search** found the mainline commit: e31d761628ad7 — *Bluetooth: btmtk: Disable remote wakeup for MT7922/MT7925* (Rong Zhang, 2026-06-11), +10 lines in drivers/bluetooth/btmtk.c.
That confirms the fix is on mainline but not in this checkout, and the backport verdict for **6.18.44** remains **YES** (with a small context tweak for the missing 0x7902/0x6639 cases).
drivers/bluetooth/btmtk.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/bluetooth/btmtk.c +10 -0
@@ -1334,6 +1334,16 @@ int btmtk_usb_setup(struct hci_dev *hdev)break ;case 0x7922 :case 0x7925 : +/* +* A remote wakeup could cause the device completely unresponsive, and +* recovering from such a state needs a power cycle. +* +* Since the remote wakeup capability is super broken, just disable it +* to get rid of the troubles. The device can still be autosuspended +* when the bluetooth interface is closed. +*/ +device_set_wakeup_capable (&btmtk_data->udev->dev, false); + fallthrough;case 0x7961 :btmtk_fw_get_filename (fw_bin_name,sizeof (fw_bin_name), dev_id, fw_version, fw_flavor);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rtw89: disable CSI STBC for VHT 160MHz
In reply to Sasha LevinFrom: Dian-Syuan Yang <[email protected]>
[ Upstream commit d1fba55228685a7a237681be739683eaf698b9bc ]
Fix interoperability problem where CSI feedback with STBC enabled at VHT 160MHz BW cannot be properly decoded by certain APs, causing CSI reports to be rejected. This problem is specific to Wi-Fi 7 chips, as Wi-Fi 6 defaults to 20MHz CSI BW. Therefore, disable STBC encoding for CSI transmission in VHT 160MHz mode to ensure CSI feedback is accepted by these APs and maintain smooth throughput.
---
LLM Generated explanations, may be completely bogus:
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
# Stable Backport Analysis: wifi: rtw89: disable CSI STBC for VHT 160MHz
**Local tree:** Linux **6.18.43** (git describe HEAD → v6.18.43)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [wifi: rtw89] [disable] — disable STBC encoding for CSI feedback in VHT 160MHz mode on BE-generation (Wi-Fi 7) chips.
### Step 1.2: Parse all commit message tags
**Record:**
- **Signed-off-by:** Dian-Syuan Yang <[email protected]> (author)
- **Signed-off-by:** Ping-Ke Shih <[email protected]> (Realtek rtw89 maintainer)
- **Link:**
https://patch.msgid.link/[email protected]
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable tags
- Notable: no syzbot/fuzzer report; vendor-driven IOT fix
### Step 1.3: Analyze commit body
**Record:**
- **Bug:** CSI feedback with STBC enabled at VHT 160MHz cannot be decoded by certain APs; CSI reports are rejected.
- **Symptom:** Degraded throughput when beamforming CSI feedback fails on 160MHz links with incompatible APs.
- **Root cause (author):** Wi-Fi 7 chips use wider CSI bandwidth than Wi-Fi 6 (which defaults to 20MHz CSI BW); STBC in CSI at 160MHz triggers AP-side rejection.
- **Version info:** Commit message says Wi-Fi 7 chips; cover letter (series 0/3) incorrectly says "WiFi 6 chips" — code only touches mac_be.c, which is the BE/Wi-Fi 7 path.
### Step 1.4: Detect hidden bug fixes
**Record:** Not disguised — this is an explicit interoperability (IOT) workaround, not cleanup. It falls under the hardware-quirk / AP- compatibility exception category.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes
**Record:**
- **Files:** drivers/net/wireless/realtek/rtw89/mac_be.c (+4 lines)
- **Function:** rtw89_mac_set_csi_para_reg_be()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow change
**Record:**
- **Before:** stbc_en could remain set (default 1, masked by peer capabilities) and was written into B_BE_BFMEE_CSIINFO0_STBC_EN for all VHT configurations.
- **After:** If the link STA advertises IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ, stbc_en is forced to 0 before register encoding.
- **Path:** Called during association when the peer AP has beamformer capability (rtw89_mac_bf_assoc_be() → rtw89_mac_set_csi_para_reg_be()).
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic / interoperability (hardware quirk workaround)
- **Mechanism:** STBC-enabled CSI frames at VHT 160MHz are malformed or incompatible with certain AP decoders; disabling STBC makes CSI feedback acceptable, restoring beamforming throughput.
### Step 2.4: Fix quality assessment
**Record:** Obviously correct vendor IOT workaround; minimal diff; very low regression risk. Only affects CSI parameter encoding on the BE chip path when 160MHz VHT capability is present. No lock/API changes.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame changed lines
**Record:** The surrounding CSI setup code in mac_be.c dates to the file's introduction in this tree (commit 19eef1d98eeda, Linux 6.18-rc7 merge base). The buggy STBC-default behavior has been present since mac_be.c was added.
### Step 3.2: Follow Fixes: tag
**Record:** N/A — no Fixes: tag present.
### Step 3.3: File history for related changes
**Record:**
- Related CSI fix already in this tree: fa8301c29079a ("wifi: rtw89:
mac: correct page number for CSI response") — also a beamforming/CSI fix in mac_be.c.
- Part of a 3-patch interoperability series submitted Apr 2026:
1. PCI CLK ready for RTL8922DE
2. Disable HTC field in AP mode
3. **This patch** (CSI STBC)
- Series applied to rtw-next branch; this patch is **standalone** (only touches mac_be.c).
### Step 3.4: Author's other commits
**Record:** Ping-Ke Shih is the rtw89 maintainer (authored CSI page fix fa8301c29079a already backported here). Dian-Syuan Yang is a Realtek contributor.
### Step 3.5: Prerequisites
**Record:** No dependencies. Applies independently of patches 1/2 in the series. Only requires mac_be.c and rtw89_mac_set_csi_para_reg_be() — both present in 6.18.43.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:**
- **URL:** https://lore.kernel.org/linux-
wireless/[email protected]/
- **Series:** [PATCH rtw-next 0/3] wifi: rtw89: update hardware settings to fix interoperability
- **Revisions:** Single submission (rtw-next 3/3); applied to rtw-next branch Apr 29, 2026
- **Reviewer feedback:** Only maintainer self-reply confirming series applied; no NAKs, no explicit stable nomination
- Cover letter describes patch 3 as fixing beamforming CSI that "can't reply on 160MHz bandwidth"
### Step 4.2: Reviewers
**Record:** Sent to [email protected]; CC'd [email protected]. Maintainer applied directly to rtw-next.
### Step 4.3: Bug report
**Record:** No external bug report, syzbot, or Bugzilla link. Vendor- internal IOT discovery.
### Step 4.4: Related patches
**Record:** Sibling patches fix PCI L1SS stability and AP-mode HTC field — separate issues. This patch does not depend on them.
### Step 4.5: Stable mailing list
**Record:** No stable-list discussion found for this specific fix.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** rtw89_mac_set_csi_para_reg_be(), called from rtw89_mac_bf_assoc_be().
### Step 5.2: Callers
**Record:**
- rtw89_mac_bf_assoc_be() → rtw89_mac_ops.bf_assoc (BE generation only)
- Invoked from rtw89_mac_bf_assoc() in core.c during STA association (rtw89_core_sta_assoc() path, line ~4787)
- Only runs when peer AP has beamformer capability (rtw89_sta_has_beamformer_cap())
### Step 5.3: Callees
**Record:** RCU lock for link_sta, register read/write (rtw89_write16, rtw89_mac_reg_by_idx), capability bit checks. No allocation or complex locking.
### Step 5.4: Call chain / reachability
**Record:** Userspace connects to Wi-Fi → driver association → beamforming init → CSI parameter setup. Reachable on every association to a beamforming-capable AP. Unprivileged users trigger this via normal Wi-Fi connection.
### Step 5.5: Similar patterns
**Record:** Wi-Fi 6 path (rtw89_mac_set_csi_para_reg_ax() in mac.c) does **not** need this fix per commit message (20MHz default CSI BW). Only BE chips (RTW89_CHIP_BE, currently RTL8922A only) use mac_be.c.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does the buggy code exist?
**Record:** **Yes.** rtw89_mac_set_csi_para_reg_be() at lines 2109–2176 in mac_be.c sets stbc_en = 1 by default with no 160MHz guard. Fix comment/string not present (grep confirmed). RTL8922A (RTW89_CHIP_BE) and rtw8922ae.c PCI driver are present.
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** Identical context at lines 2148–2150 matches the patch hunk. No conflicting recent changes in this function.
### Step 6.3: Related fixes already present?
**Record:** fa8301c29079a (CSI page number) is present; this STBC fix is **not** yet applied or duplicated.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/net/wireless/realtek/rtw89/ — **IMPORTANT** (Wi-Fi driver, affects users of RTL8922A/8922AE hardware). Not core kernel, but real production hardware.
### Step 7.2: Subsystem activity
**Record:** Actively maintained; multiple rtw89 fixes already backported to 6.18.y (CSI, PCI validation, bounds checks, resume fixes).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of **RTL8922A/8922AE** (Wi-Fi 7) hardware on **6.18.y**, connecting to beamforming-capable APs at VHT 160MHz. Driver- specific, config-dependent (beamforming + 160MHz).
### Step 8.2: Trigger conditions
**Record:**
- Wi-Fi 7 BE chip (8922A family)
- Association to AP with SU/MU beamformer capability
- VHT 160MHz channel width capability advertised
- **Common** for intended use case of this hardware; not a rare edge case
### Step 8.3: Failure mode severity
**Record:** CSI reports rejected → beamforming feedback loop broken → **throughput degradation** (not crash, hang, oops, or data corruption).
Severity: **MEDIUM** — functional performance issue on supported hardware with common AP configurations. Per stable-kernel-rules.rst, hardware quirks and notable performance issues qualify.
### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** HIGH for affected 8922AE users — restores beamforming CSI at 160MHz with incompatible APs
- **Risk:** VERY LOW — 4 lines, BE-path only, no API/lock changes
- **Ratio:** Favorable
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compile
**FOR backport:**
- Real IOT/AP compatibility bug on supported Wi-Fi 7 hardware in this tree
- Hardware quirk / interoperability workaround (stable-rules exception)
- Small (4 lines), obviously correct, standalone
- Same driver's CSI/beamforming fixes already backported to 6.18.y
- rtw89 maintainer authorship and sign-off
- Buggy code confirmed present; clean apply expected
- Affects normal association path for primary hardware use case (160MHz
+ beamforming)
**AGAINST backport:**
- No crash, security, corruption, or deadlock
- Throughput/performance impact only (not connectivity failure)
- Narrow hardware scope (8922A BE chips only)
- No external user/syzbot reports
- Not yet in mainline at time of tree inspection (rtw-next only)
**Unresolved:** No independent Tested-by or distribution bug report; severity is vendor-reported throughput impact only.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — vendor IOT workaround, maintainer SOB, applied to rtw-next
2. Fixes a real bug affecting users? **PASS** — CSI rejection with certain APs on 8922AE at 160MHz
3. Important issue? **PASS** — hardware quirk / notable performance issue per stable-kernel-rules.rst (not CRITICAL crash class, but qualifies)
4. Small and contained? **PASS** — 4 lines, 1 file
5. No new features or APIs? **PASS** — workaround only
6. Can apply to local tree? **PASS** — code exists, clean apply
### Step 9.3: Exception category
**Record:** **Hardware quirk / interoperability workaround** — explicitly labeled "IOT issues with certain APs" in the patch.
### Step 9.4: Decision rationale
This is a vendor IOT workaround for RTL8922A Wi-Fi 7 hardware that is already supported in Linux 6.18.43. Without it, CSI beamforming feedback at VHT 160MHz is rejected by certain APs, causing measurable throughput loss on a common configuration for this chipset. The fix is minimal, touches only the BE MAC path, matches the pattern of other rtw89 CSI fixes already backported to this stable tree, and fits the stable- kernel-rules.rst hardware-quirk category. It does not fix a kernel crash or security issue, but the conservative stable bar explicitly includes hardware quirks and user-visible performance problems on supported hardware.
---
## Verification
- [Phase 1] Parsed subject, tags, body; fetched patch 3/3 from lore mbox
- [Phase 1] Cover letter vs. commit body chip-generation discrepancy noted (cover says WiFi 6, patch says Wi-Fi 7; code is mac_be.c only)
- [Phase 2] Read mac_be.c lines 2109–2176; confirmed 4-line addition point matches diff
- [Phase 2] Confirmed stbc_en encoded into B_BE_BFMEE_CSIINFO0_STBC_EN at line 2164
- [Phase 3] git describe HEAD → v6.18.43
- [Phase 3] git blame lines 2141–2148 → present since mac_be.c introduction
- [Phase 3] git log --oneline -20 -- mac_be.c → CSI page fix fa8301c29079a present
- [Phase 3] git log -S rtw89_mac_set_csi_para_reg_be → function introduced with mac_be.c
- [Phase 4] curl lore mbox: series 0/3 interoperability, patch applied to rtw-next Apr 29 2026
- [Phase 4] Thread: no NAKs, no stable nomination, maintainer applied confirmation only
- [Phase 5] grep bf_assoc → core.c:4787 calls during association
- [Phase 5] grep RTW89_CHIP_BE → only rtw8922a.c sets BE generation
- [Phase 5] mac_ax CSI function (rtw89_mac_set_csi_para_reg_ax) has no 160MHz STBC guard — unaffected by design
- [Phase 6] grep "Disable stbc_en in VHT 160MHz" → not in tree (fix absent)
- [Phase 6] rtw8922ae.c PCI IDs and rtw8922a_chip_info with RTW89_CHIP_BE confirmed present
- [Phase 6] Patch context at lines 2148–2150 matches upstream diff hunk
- [Phase 8] Failure mode: throughput degradation, severity MEDIUM; no crash/security path identified
**YES**The analysis is complete: **this commit should be backported to the local 6.18.43 tree.**
It’s a small Realtek rtw89 interoperability fix for RTL8922A/8922AE (Wi- Fi 7) hardware. When beamforming CSI feedback runs at VHT 160MHz with STBC enabled, certain APs reject the reports and throughput suffers. The patch disables STBC for that case in mac_be.c — 4 lines, low risk, and the buggy code is already present in this tree.
It fits the stable “hardware quirk / interoperability” category, similar to other rtw89 CSI fixes already in 6.18.y. It’s not a crash or security fix, but it does address a real performance issue on supported hardware.
**YES**
drivers/net/wireless/realtek/rtw89/mac_be.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/mac_be.c +4 -0
@@ -2147,6 +2147,10 @@ static int rtw89_mac_set_csi_para_reg_be(struct rtw89_dev *rtwdev, sound_dim =min (sound_dim, t); } +/* Disable stbc_en in VHT 160MHz to avoid IOT issues with certain APs */ +if (link_sta->vht_cap.cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ) + stbc_en =0 ; + nc =min (nc, sound_dim); nr =min (nr, sound_dim);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda: cs35l56: Fail if wmfw file is missing
In reply to Sasha LevinFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 07ae060d35900977a93d4a05ec995b06c85c2552 ]
Fail cs35l56_hda_fw_load() and log an error if it didn't find a wmfw file and the BIOS didn't patch the firmware already. Also remove a section of code from cs35l56_hda_request_firmware_files() that attempted to find a .bin if a .wmfw was not found.
The CS35L56 ROM can only provide default audio in SoundWire mode. A wmfw is needed to enable I2S audio. Also none of the customer-specific .bin files are compatible with the ROM firmware. So a .wmfw file is always required.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [ALSA: hda: cs35l56] [Fail] — Fail firmware load when required .wmfw file is missing for CS35L56 HDA amplifier driver.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Richard Fitzgerald <[email protected]> — Cirrus Logic driver author
- `Link: https://patch.msgid.link/20260709161211.686498-1-
[email protected]` — original submission
- Signed-off-by: Takashi Iwai <[email protected]> — ALSA maintainer merge
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, `Cc:
[email protected]`
Notable: no fuzzer or user bug reports; vendor-authored fix merged by subsystem maintainer.
**Step 1.3 — Body analysis**
Record:
- **Bug:** Driver allowed proceeding with only a .bin coefficient file when no .wmfw was found, even when BIOS had not pre-patched firmware.
- **Symptom:** I2S audio cannot work without .wmfw; customer .bin files are incompatible with ROM firmware.
- **Root cause:** Fallback in cs35l56_hda_request_firmware_files() searched for system-specific .bin without .wmfw, and cs35l56_hda_fw_load() only validated .bin presence, not .wmfw.
- **Version info:** None in message.
**Step 1.4 — Hidden bug fix?**
Record: Yes. Although phrased as validation, this fixes incorrect firmware-loading logic that could shut down the DSP and attempt to load incompatible coefficients onto ROM firmware.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** sound/hda/codecs/side-codecs/cs35l56_hda.c (+9 / −21, net −12 lines)
- **Functions:** cs35l56_hda_request_firmware_files(), cs35l56_hda_fw_load()
- **Scope:** Single-file surgical fix
**Step 2.2 — Code flow changes**
Record:
- **Hunk 1 (request_firmware_files):** Before → if system-specific .wmfw missing, try system-specific .bin alone and return early if found. After → that fallback removed; search continues to generic firmware paths.
- **Hunk 2 (fw_load):** Before → when firmware_missing, only require .bin. After → when firmware_missing, require both .wmfw and .bin, with explicit error messages for each.
**Step 2.3 — Bug mechanism**
Record:
- **Category:** Logic / correctness fix (firmware validation)
- **Mechanism:** Without .wmfw, cs_dsp_load() returns 0 for NULL firmware (verified in drivers/firmware/cirrus/cs_dsp.c:1527-1528), so cs_dsp_power_up() could proceed to setup_algs() and cs_dsp_load_coeff() with only an incompatible .bin on ROM firmware — after an unnecessary cs35l56_firmware_shutdown().
**Step 2.4 — Fix quality**
Record:
- Fix is minimal and matches vendor hardware requirements.
- No API changes; only tightens validation on the firmware_missing path.
- Regression risk: very low — systems with valid .wmfw+.bin or BIOS- patched firmware are unchanged.
- BIOS-patched path (firmware_missing == false) is unaffected.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Buggy fallback and incomplete validation introduced in 5d324e5159d9e (2025-11-28, v6.18-rc8 merge window). File did not exist before that commit in this tree (git show 5d324e5159d9e^:... → 0 lines; current tree → 1182 lines).
**Step 3.2 — Fixes: tag**
Record: Not applicable — no Fixes: tag present.
**Step 3.3 — Related file history**
Record: Recent non-merge commits on this file in 6.18.y:
- fecae8b1fb2d3 — ACPI companion ordering
- 7e6f7ac79abe2 — uninitialized value fix
- f8ad9ef771565 — ASP TX error propagation
- c18c40e081c19 — signedness fix
Standalone fix; not part of a multi-patch series.
**Step 3.4 — Author context**
Record: Richard Fitzgerald (Cirrus Logic) is the CS35L56 driver author. Recent HDA cs35l56 commits in this tree are maintenance fixes from the same vendor ecosystem.
**Step 3.5 — Dependencies**
Record: No prerequisites. Patch applies cleanly (git apply --check succeeded). All referenced symbols exist in this tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: Fetched lore mbox at https://lore.kernel.org/all/20260709161211 [email protected]/t.mbox.gz. Single v1 submission (2026-07-09). b4 dig -c did not match (commit not in tree); b4 dig -a returned no revisions. No review replies or stable nominations found.
**Step 4.2 — Reviewers**
Record: Patch sent To: [email protected], Cc: linux- [email protected], [email protected]. Merged by Takashi Iwai.
**Step 4.3 — Bug reports**
Record: None. No syzbot, bugzilla, or user reports.
**Step 4.4 — Related patches**
Record: Standalone; not part of a series.
**Step 4.5 — Stable list history**
Record: No stable-list discussion found for this fix.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: cs35l56_hda_request_firmware_files(), cs35l56_hda_fw_load(), cs35l56_hda_dsp_work(), cs35l56_hda_bind().
**Step 5.2 — Callers**
Record:
- cs35l56_hda_fw_load() ← cs35l56_hda_dsp_work() (workqueue)
- cs35l56_hda_dsp_work() queued from cs35l56_hda_bind() during HDA component binding at audio subsystem init
**Step 5.3 — Callees**
Record: cs35l56_firmware_shutdown(), cs_dsp_power_up() → cs_dsp_load() / cs_dsp_load_coeff(), cs35l56_system_reset(), cs_dsp_run().
**Step 5.4 — Reachability**
Record: Triggered during device bind on laptops with CONFIG_SND_HDA_SCODEC_CS35L56_{I2C,SPI}=y/m. Common boot path for affected Cirrus CS35L56 HDA hardware; not userspace-syscall reachable, but runs on every affected machine boot.
**Step 5.5 — Similar patterns**
Record: cs35l41_hda.c always loads .wmfw before cs_dsp_power_up(). The removed cs35l56 fallback (.bin without .wmfw) was inconsistent with CS35L56 hardware requirements described by the vendor.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is **v6.18.44** (git describe HEAD → v6.18.44-1-g2736c32da98b9). Buggy fallback at lines 520–532 and incomplete validation at lines 622–625 of cs35l56_hda.c are present. Driver introduced in 6.18; bug present since introduction.
**Step 6.2 — Backport complications**
Record: Clean apply expected — git apply --check passed with no conflicts.
**Step 6.3 — Related fixes already present?**
Record: No equivalent wmfw-validation fix in this tree. Other cs35l56 HDA fixes (uninit value, signedness, error propagation) are separate issues.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem criticality**
Record: **ALSA / HDA side-codec driver** — IMPORTANT, platform-specific (CS35L56 laptop amplifiers). Requires CONFIG_SND_HDA_SCODEC_CS35L56 and I2C or SPI variant.
**Step 7.2 — Subsystem activity**
Record: Actively maintained in 6.18.y with multiple recent cs35l56 HDA fixes.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users of laptops with CS35L56 HDA amplifiers where BIOS did not pre-patch firmware and firmware packaging is incomplete (.bin present, .wmfw missing). Config-specific, but real hardware on modern laptops.
**Step 8.2 — Trigger conditions**
Record: Boot-time firmware load when firmware_missing == true and a system-specific .bin exists without matching .wmfw. Unprivileged users cannot directly trigger it, but it affects every boot on misconfigured affected systems.
**Step 8.3 — Failure mode severity**
Record:
- **Without fix:** Unnecessary firmware shutdown/reset, then attempt to load incompatible .bin onto ROM firmware; I2S audio non-functional; possible DSP errors logged at debug level only.
- **Severity:** MEDIUM — hardware malfunction (no speakers), not kernel oops, but incorrect firmware programming on real hardware.
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** Prevents invalid firmware path; clear dev_err() for missing .wmfw; avoids pointless shutdown/reset and incompatible coefficient loading.
- **Risk:** Very low — small vendor fix, no behavior change for correctly configured systems.
- **Ratio:** Favorable for 6.18.y where this driver exists and the bug is present.
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Fixes real incorrect firmware-loading logic confirmed in local tree
- Vendor-authored, maintainer-merged, obviously correct per CS35L56 hardware requirements
- Small, single-file, applies cleanly to 6.18.44
- Prevents loading customer .bin files incompatible with ROM firmware
- Improves diagnostics for broken audio on affected laptops
- Driver and buggy code both exist in this tree since 6.18
**Evidence AGAINST:**
- No user reports, syzbot, or crash reports
- Primary user-visible outcome may still be “no audio” on misconfigured systems
- New driver with limited 6.18.y deployment so far
- No explicit stable nomination in review thread
**Unresolved:** Whether loading incompatible .bin onto ROM can cause anything beyond failed audio (vendor states incompatibility; no crash report verified).
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — vendor requirement, maintainer merged; no Tested-by
2. Fixes real bug? **PASS** — invalid firmware path on real hardware
3. Important issue? **PASS (MEDIUM)** — broken audio / incorrect DSP programming on affected laptops
4. Small and contained? **PASS** — 30 lines, one file
5. No new features/APIs? **PASS**
6. Applies to local tree? **PASS** — clean apply to 6.18.44
**Exception category:** Hardware workaround / driver correctness for existing CS35L56 HDA support.
---
## Problem Summary for Stable Users
On CS35L56 HDA laptops where the BIOS has not pre-loaded firmware, the driver incorrectly treated a .bin coefficient file as sufficient even when the required .wmfw firmware wrapper was missing. Per Cirrus Logic, ROM firmware only supports SoundWire default audio; .wmfw is mandatory for I2S, and customer .bin files are not compatible with ROM. The old code could shut down the amplifier and attempt an invalid DSP load. The fix fails early with a clear error and removes the invalid .bin-without-.wmfw fallback.
For **Linux 6.18.y** specifically, this driver exists and the bug is present from its introduction; the fix is low-risk and should be included.
---
## Verification
- [Phase 1] Parsed commit message and tags from user-provided content and lore mbox fetch
- [Phase 2] Diff analysis: 2 functions modified, logic/correctness bug in firmware validation
- [Phase 3] git describe HEAD / make kernelversion: tree is **6.18.44**
- [Phase 3] git blame -L 518,625: buggy code from 5d324e5159d9e (2025-11-28)
- [Phase 3] git show 5d324e5159d9e^:...cs35l56_hda.c: file absent before merge (driver new in 6.18)
- [Phase 3] git log --oneline -20 -- cs35l56_hda.c: related fixes listed; no duplicate wmfw fix
- [Phase 4] Lore mbox fetch: original patch at [email protected]
- [Phase 4] b4 dig: no commit match (not in tree); no series revisions found
- [Phase 4] No stable-list or review-thread stable nominations found
- [Phase 5] grep cs35l56_hda_fw_load: call chain bind → workqueue → fw_load verified
- [Phase 5] cs_dsp_load() at cs_dsp.c:1527-1528: NULL wmfw returns 0, allowing coeff load attempt
- [Phase 6] Buggy fallback at cs35l56_hda.c:520-532 and validation at :622-625 confirmed present
- [Phase 6] git apply --check: patch applies cleanly
- [Phase 7] Kconfig: SND_HDA_SCODEC_CS35L56_{I2C,SPI} in sound/hda/codecs/side-codecs/Kconfig
- [Phase 8] Failure mode: broken audio / invalid DSP load, severity MEDIUM (not verified as kernel crash)
**YES**
sound/hda/codecs/side-codecs/cs35l56_hda.c | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-)
sound/hda/codecs/side-codecs/cs35l56_hda.c +9 -21
@@ -516,20 +516,6 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56, NULL, "bin");return ; } - -/* -* Check for system-specific bin files without wmfw before -* falling back to generic firmware -*/ -if (amp_name) -cs35l56_hda_request_firmware_file (cs35l56, coeff_firmware, coeff_filename, - base_name, system_name, amp_name,"bin" ); -if (!*coeff_firmware) -cs35l56_hda_request_firmware_file (cs35l56, coeff_firmware, coeff_filename, - base_name, system_name,NULL ,"bin" ); - -if (*coeff_firmware) -return ; } ret = cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename,
@@ -615,13 +601,15 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) &wmfw_firmware, &wmfw_filename, &coeff_firmware, &coeff_filename); -/* -* If the BIOS didn't patch the firmware a bin file is mandatory to -* enable the ASP· -*/ -if (!coeff_firmware && firmware_missing) { -dev_err (cs35l56->base.dev,".bin file required but not found\n" ); - goto err_fw_release; +/* If the BIOS didn't patch the firmware a wmfw and bin file are mandatory */ +if (firmware_missing) { +if (!wmfw_firmware) { +dev_err (cs35l56->base.dev,".%s file required but not found\n" ,"wmfw" ); + goto err_fw_release; + }else if (!coeff_firmware) { +dev_err (cs35l56->base.dev,".%s file required but not found\n" ,"bin" ); + goto err_fw_release; + } }mutex_lock (&cs35l56->base.irq_lock);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 psp: validate IPv4 header fields in psp_dev_rcv()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit c2b22277ad897d21341f502f87fccd905ff4e207 ]
psp_dev_rcv() is called from the NIC driver's RX completion path before the frame reaches ip_rcv_core(), so the IP header has not been validated in SW, yet. We expect that the device has done all this validation, but let's also add the SW checks, to avoid surprises.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject line
**Record:** [psp] [validate] — Add software validation of IPv4 (and IPv6) header fields in psp_dev_rcv() before decapsulation.
### Step 1.2: Tags
**Record:**
- **Reviewed-by:** Eric Dumazet \<[email protected]\>
- **Reviewed-by:** Willem de Bruijn \<[email protected]\>
- **Link:**
https://patch.msgid.link/[email protected]
(patch 4/N of a series)
- **Signed-off-by:** Jakub Kicinski \<[email protected]\>
- No Fixes:, Reported-by:, Tested-by:, Cc: stable, or syzbot tags.
Notable: reviewed by two senior networking developers; no fuzzer or user crash report.
### Step 1.3: Body analysis
**Record:**
- **Bug:** psp_dev_rcv() runs in the NIC RX completion path before ip_rcv_core(), so normal software IP header validation has not run yet.
- **Symptom:** Malformed IP headers (invalid ihl, tot_len/payload_len too small for decapsulation) could be accepted; code uses iph->ihl for ip_fast_csum() and subtracts encap from length fields without bounds checks.
- **Root cause:** Assumption that hardware always delivers valid L3 headers; no defensive SW checks mirroring ip_rcv_core().
- **Version info:** None in the message.
### Step 1.4: Hidden bug fix?
**Record:** Yes. Despite “avoid surprises” wording, this is a real validation bug fix: invalid ihl can cause out-of-bounds access in ip_fast_csum(), and unchecked subtraction can underflow tot_len/payload_len, producing corrupt skbs passed up the stack.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- **File:** net/psp/psp_main.c (+9 lines, 0 removed)
- **Function:** psp_dev_rcv()
- **Scope:** Single-file, surgical validation additions.
### Step 2.2: Code flow per hunk
**Record:**
1. **IPv4 ihl check (after reading iph):** Before → used iph->ihl directly for l3_hlen and later ip_fast_csum(). After → reject if ihl < 5.
2. **IPv4 tot_len check (before modifying header):** Before → iph->tot_len = htons(ntohs(iph->tot_len) - encap) with no guard. After → reject if tot_len < l3_hlen + encap.
3. **IPv6 payload_len check:** Before → subtract encap unconditionally. After → reject if payload_len < encap.
### Step 2.3: Bug mechanism
**Record:** **Memory safety / logic correctness.**
- Invalid ihl (< 5): l3_hlen = iph->ihl * 4 can be too small; ip_fast_csum((u8 *)iph, iph->ihl) may read fewer than 20 bytes or use invalid length (compare ip_rcv_core() at net/ipv4/ip_input.c:500).
- Length underflow: ntohs(iph->tot_len) - encap with tot_len < encap wraps to a large value when stored back into tot_len, corrupting the skb for downstream IP processing.
### Step 2.4: Fix quality
**Record:** Obviously correct; mirrors existing IP stack validation patterns. Minimal risk; only rejects packets that would have been mishandled. No API changes. In this tree, checks must be placed after encap is computed with psp_hlen (post-ac4bf66686bbb), not the fixed PSP_ENCAP_HLEN shown in the candidate diff.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Core psp_dev_rcv() logic from 19eef1d98eeda (Nov 2025). Variable-length PSP header handling added in ac4bf66686bbb (May 2026, already in this tree). The validation gap dates to initial psp_dev_rcv() introduction.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Recent net/psp/psp_main.c commits:
- ac4bf66686bbb — variable-length PSP header strip (Cc: stable, backported)
- b640188b61e63 — psp_write_headers() hash fix
- aa1a08a4632af, d90df5ce6deb2 — permission/unregister checks
The candidate commit is **not** in this tree. It is standalone validation logic, but must be adapted for post-ac4bf66686bbb encap calculation.
### Step 3.4: Author context
**Record:** Jakub Kicinski is the networking tree maintainer who merged PSP work. Related PSP fixes in-tree were reviewed by Willem de Bruijn (same reviewer on this patch).
### Step 3.5: Dependencies
**Record:** No series dependency for the validation logic itself. Applies standalone to any tree with psp_dev_rcv(). In this tree, encap = sizeof(struct udphdr) + psp_hlen + optional ICV, so the tot_len/payload_len checks use the updated encap value.
---
## Phase 4: Mailing List and External Research
### Step 4.1–4.5
**Record:** Lore/patch.msgid.link fetch returned 403 (bot protection). b4 dig requires a commit hash; the candidate is not in this checkout, so b4 dig -c could not match it. **UNVERIFIED:** full mailing-list thread, stable nominations in review, series context for patches 1–3.
From the Link subject (1247325-4), this is patch 4 of a series; the validation changes themselves appear self-contained.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key functions
**Record:** psp_dev_rcv() — only function modified.
### Step 5.2: Callers
**Record:**
- drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c:135 — mlx5e_psp_offload_handle_rx_skb(), production RX path after HW decryption syndrome check.
- drivers/net/netdevsim/psp.c:64 — test/simulation path.
### Step 5.3: Callees
**Record:** __vlan_get_protocol(), pskb_may_pull(), skb_ext_add(), ip_fast_csum(), memmove(), skb_pull(), pskb_trim().
### Step 5.4: Reachability
**Record:** Reachable from NIC RX completion on PSP-offloaded mlx5 devices (CONFIG_INET_PSP + CONFIG_MLX5_EN_PSP). Hardware is expected to validate frames first; netdevsim allows software testing without HW. Not a general syscall path, but network-reachable on configured systems.
### Step 5.5: Similar patterns
**Record:** ip_rcv_core() validates iph->ihl < 5 and len < iph->ihl*4 (net/ipv4/ip_input.c:500–524). route.c, icmp.c, nf_reject_ipv4.c use the same ihl < 5 guard. psp_dev_rcv() is an intentional bypass of that path and lacks equivalent checks today.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.43)
### Step 6.1: Buggy code present?
**Record:** **Yes.** Current net/psp/psp_main.c (lines 294–358) lacks all three checks. Uses iph->ihl without ihl < 5 guard; subtracts encap from tot_len/payload_len without underflow protection.
### Step 6.2: Backport complications
**Record:** **Minor adaptation needed.** This tree already has ac4bf66686bbb (variable psp_hlen, dynamic encap). The candidate diff targets pre-ac4bf66686bbb code with fixed PSP_ENCAP_HLEN. Validation logic maps cleanly: ihl check at the same spot; length checks after encap is computed with sizeof(struct udphdr) + psp_hlen.
### Step 6.3: Related fixes already present?
**Record:** ac4bf66686bbb fixes variable-length PSP header stripping but explicitly does not add IP header field validation. No duplicate fix found.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem / criticality
**Record:** net/psp — INET PSP security protocol. **IMPORTANT** (networking RX path), but config-specific (CONFIG_INET_PSP).
### Step 7.2: Activity
**Record:** Actively developed subsystem in 6.18 (multiple PSP commits in 2025–2026). New enough that bugs are still being found and hardened.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who is affected
**Record:** Systems with PSP offload enabled (primarily mlx5 ConnectX with MLX5_EN_PSP). Not universal; datacenter/cloud deployments using Google PSP.
### Step 8.2: Trigger conditions
**Record:** Malformed inner IP/IPv6 header in a PSP-decapsulated frame reaching psp_dev_rcv(). Expected rare (HW validation), but possible via HW/firmware bugs or test injection (netdevsim). Network-origin on PSP-enabled hosts.
### Step 8.3: Failure mode severity
**Record:**
- ihl < 5 → invalid ip_fast_csum() / wrong offsets → **HIGH** (OOB read potential)
- Length underflow → corrupt tot_len/payload_len on skb entering normal IP receive → **HIGH** (downstream parsing errors, possible crash)
Overall: **HIGH** if triggered; trigger likelihood is **LOW-MEDIUM** (HW-gated but not impossible).
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** MEDIUM-HIGH — prevents corrupt skbs and OOB access in a network RX helper that bypasses standard IP validation.
- **Risk:** VERY LOW — 3 small rejection checks on error paths; no behavior change for valid packets.
- **Ratio:** Favorable for backport.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence compile
**FOR backport:**
- Real validation gap with concrete failure modes (OOB read, integer underflow)
- Network RX path on PSP-enabled hardware
- Small, obviously correct, matches ip_input.c patterns
- Reviewed by Eric Dumazet and Willem de Bruijn
- Buggy code confirmed present in 6.18.43
- Prior related PSP fix (ac4bf66686bbb) was nominated and backported to stable
**AGAINST backport:**
- No crash report, syzbot, or CVE cited
- Author frames as defense-in-depth (“device has done validation”)
- Narrow deployment (optional PSP on mlx5)
- Patch needs minor rework for current psp_main.c layout
- Mailing-list discussion unverified
**Unresolved:** Full review thread and whether patches 1–3 of the series are prerequisites (validation patch appears independent).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — mirrors established IP validation; reviewed by net experts (no runtime test cited).
2. Fixes a real bug? **PASS** — missing validation with demonstrable underflow/OOB mechanisms.
3. Important issue? **PASS** — potential crash/corruption in network RX path (HIGH severity if triggered).
4. Small and contained? **PASS** — ~9 lines, one function.
5. No new features/APIs? **PASS** — error-path validation only.
6. Can apply to local tree? **PASS** — with minor adjustment for psp_hlen-based encap.
### Step 9.3: Exception category
**Record:** None (not device ID, quirk, DT, build, or docs). Standard bug-fix/hardening.
### Step 9.4: Decision rationale
For **linux-6.18.y** (this checkout at 6.18.43): the PSP subsystem and the vulnerable psp_dev_rcv() code are present. The function deliberately skips ip_rcv_core() validation yet performs header arithmetic (tot_len - encap, ip_fast_csum with ihl) that assumes valid headers. That is a real bug; the fix is minimal, conservative, and aligned with how the rest of the IPv4 stack validates headers. While triggers are likely rare due to hardware offload gating, the failure modes are serious enough for stable, and the same subsystem recently received a similar stable backport (ac4bf66686bbb). The patch needs a small adjustment for the variable-length PSP header changes already in this tree, but the logic is straightforward.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from user-provided commit message.
- **[Phase 2]** Analyzed diff: 3 validation checks in psp_dev_rcv().
- **[Phase 3]** git describe HEAD → v6.18.43-1-gc7f0dac02d232; Makefile → 6.18.43.
- **[Phase 3]** git blame -L 294,360 net/psp/psp_main.c → code from 19eef1d98eeda, modified by ac4bf66686bbb.
- **[Phase 3]** git log --oneline -20 -- net/psp/psp_main.c → recent PSP history confirmed.
- **[Phase 3]** git show ac4bf66686bbb → variable-length header fix already in tree; notes HW gating, Cc: stable.
- **[Phase 3]** git log --grep="validate IPv4" → commit not in tree.
- **[Phase 4]** WebFetch patch.msgid.link → 403 blocked. **UNVERIFIED:** lore discussion, stable nominations.
- **[Phase 4]** b4 dig -c HEAD → no match (different commit). **UNVERIFIED:** original thread for this patch.
- **[Phase 5]** grep psp_dev_rcv → callers in mlx5 and netdevsim confirmed.
- **[Phase 5]** Read mlx5e_psp_offload_handle_rx_skb() → RX path with HW syndrome gate.
- **[Phase 5]** grep "ihl < 5" in net/ipv4/ → standard validation in ip_input.c:500 and elsewhere.
- **[Phase 6]** Read current net/psp/psp_main.c:272-369 → all three checks absent.
- **[Phase 6]** grep "ihl < 5|tot_len.*encap" in net/psp/ → no matches.
- **[Phase 7]** Read net/psp/Kconfig → CONFIG_INET_PSP optional, depends on INET.
- **[Phase 8]** Traced failure modes from code: underflow at lines 351/358, ip_fast_csum at line 353 without ihl guard.
**YES**
net/psp/psp_main.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/psp/psp_main.c +9 -0
@@ -294,6 +294,9 @@ int psp_dev_rcv(struct sk_buff *skb, u16 dev_id, u8 generation, bool strip_icv)if (proto ==htons (ETH_P_IP )) {struct iphdr *iph = (struct iphdr *)(skb->data + l2_hlen); +if (unlikely (iph->ihl <5 )) +return -EINVAL ; + is_udp = iph->protocol ==IPPROTO_UDP ; l3_hlen = iph->ihl *4 ; if (l3_hlen != sizeof(struct iphdr) &&
@@ -347,6 +350,9 @@ int psp_dev_rcv(struct sk_buff *skb, u16 dev_id, u8 generation, bool strip_icv)if (proto ==htons (ETH_P_IP )) {struct iphdr *iph = (struct iphdr *)(skb->data + l2_hlen); +if (unlikely (ntohs (iph->tot_len) < l3_hlen + encap)) +return -EINVAL ; + iph->protocol = psph->nexthdr; iph->tot_len =htons (ntohs (iph->tot_len) - encap); iph->check =0 ;
@@ -354,6 +360,9 @@ int psp_dev_rcv(struct sk_buff *skb, u16 dev_id, u8 generation, bool strip_icv) }else {struct ipv6hdr *ipv6h = (struct ipv6hdr *)(skb->data + l2_hlen); +if (unlikely (ntohs (ipv6h->payload_len) < encap)) +return -EINVAL ; + ipv6h->nexthdr = psph->nexthdr; ipv6h->payload_len =htons (ntohs (ipv6h->payload_len) - encap); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 regulator: core: clamp voltage constraints before applying apply_uV
In reply to Sasha LevinFrom: Kamal Wadhwa <[email protected]>
[ Upstream commit a45cc646a3aa83eb4ab4c7ed2685785ea51dc5e6 ]
machine_constraints_voltage() currently applies apply_uV against the machine-supplied [min_uV, max_uV] range, and only afterwards clamps that range down to what the regulator can actually supply (via ops->list_voltage()).
If the machine-supplied range is wider than the regulator's actual range, apply_uV's rounding can pick a selector outside the (correct) clamped range, so the regulator ends up programmed outside its clamped min/max. At bring-up this shows up as a voltage read-back outside the clamped range.
Fix this by moving the clamping block ahead of the apply_uV block, so apply_uV always targets an already-clamped range. Whether apply_uV should run is decided from the unclamped constraints beforehand and stored in a local bool, since clamping must not itself change whether apply_uV fires.
No functional change to the clamping logic itself, only its position relative to apply_uV. Its early return 0 exits become fallthroughs since the apply_uV logic now follows it.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: regulator: core: clamp voltage constraints before applying apply_uV
**Local tree:** linux-6.18.y at **6.18.44** (git describe HEAD → v6.18.44-2-g1b9e1abadee04; Makefile → VERSION 6, PATCHLEVEL 18, SUBLEVEL 44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1: PARSE THE SUBJECT LINE**
Record: [regulator: core] [clamp] — Reorder voltage constraint clamping to run before apply_uV processing in machine_constraints_voltage().
**Step 1.2: PARSE ALL COMMIT MESSAGE TAGS**
Record:
- **Assisted-by:** Claude:claude-sonnet-5
- **Signed-off-by:** Kamal Wadhwa \<[email protected]\>
- **Link:** https://patch.msgid.link/20260720-b4-regulator-core-clamp-
[email protected]
- **Signed-off-by:** Mark Brown \<[email protected]\> (regulator subsystem maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable tags
- Notable: Maintainer sign-off; no fuzzer or user bug reports cited
**Step 1.3: ANALYZE THE COMMIT BODY TEXT**
Record:
- **Bug:** machine_constraints_voltage() runs apply_uV against unclamped [min_uV, max_uV], then clamps to hardware-supported discrete voltages via ops->list_voltage().
- **Symptom:** When machine constraints are wider than the regulator's real range, apply_uV rounding can select a voltage outside the clamped range — seen at bring-up as voltage read-back outside expected bounds; can also fail regulator registration.
- **Root cause:** Ordering bug — clamping must precede apply_uV.
- **Fix approach:** Move clamping before apply_uV; capture whether apply_uV should run in a bool before clamping mutates constraints (important for fixed-voltage autoconfigure).
- No explicit kernel version range in the message.
**Step 1.4: DETECT HIDDEN BUG FIXES**
Record: **Not hidden** — this is an explicit correctness/ordering bug fix, though described as "no functional change to the clamping logic itself, only its position."
---
## PHASE 2: DIFF ANALYSIS — LINE BY LINE
**Step 2.1: INVENTORY THE CHANGES**
Record:
- **Files:** drivers/regulator/core.c only
- **Scope:** ~88 lines moved, ~8 lines added (bool apply_uV + comments); clamping block moved from after apply_uV to before it
- **Function modified:** machine_constraints_voltage()
- **Classification:** Single-file surgical reorder within one function
**Step 2.2: UNDERSTAND THE CODE FLOW CHANGE**
Record:
- **Hunk 1 (before → after):** apply_uV block ran first on raw machine constraints → clamping ran second. **After:** apply_uV decision captured upfront → clamping runs → apply_uV runs on already-clamped range.
- **Hunk 2:** Early return 0 in clamping for optional constraints / continuous range → empty fallthrough blocks so apply_uV can still run when appropriate.
- **Execution path:** Regulator registration / probe (set_machine_constraints() → machine_constraints_voltage()), boot- time initialization.
**Step 2.3: IDENTIFY THE BUG MECHANISM**
Record:
- **Category:** Logic / correctness fix (ordering)
- **Mechanism:** _regulator_do_set_voltage() uses regulator_map_voltage() which maps [min_uV, max_uV] to a hardware selector. When apply_uV uses an overly-wide machine range on a discrete (list_voltage + n_voltages, non-continuous_voltage_range) regulator, the mapped selector/voltage may lie outside the subset the clamping pass would later compute.
Result: wrong voltage programmed or -EINVAL on registration.
**Step 2.4: ASSESS THE FIX QUALITY**
Record:
- **Quality:** Obviously correct — same clamping logic, correct order; apply_uV bool preserves pre-clamp decision semantics (explicitly handles fixed-voltage autoconfigure where clamping rewrites min_uV/max_uV).
- **Regression risk:** Low. Clamping validation errors (-EINVAL) now occur before hardware programming — strictly safer than before.
- **No API changes, no new sysfs/module parameters.**
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1: BLAME THE CHANGED LINES**
Record: git blame shows machine_constraints_voltage() body attributed to 5d324e5159d9e (Nov 2025 merge importing drivers/regulator/core.c). Both apply_uV block (line 1209) and clamping block (line 1265) are present in current tree with buggy ordering. **Exact commit that introduced the ordering bug:** not determinable — tree history is shallow (file appears as wholesale import). Bug is present in 6.18.44.
**Step 3.2: FOLLOW THE FIXES: TAG**
Record: No Fixes: tag present. N/A.
**Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES**
Record: Recent drivers/regulator/core.c commits on this tree include locking fixes and supply-check reordering (bde74af8d4466, b6a83ad13d253, etc.). No commit reordering clamp vs. apply_uV. **Standalone fix, not part of a series** (subject has no "patch X/Y").
**Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS**
Record: No other commits from Kamal Wadhwa in drivers/regulator/ in this tree. Mark Brown is the subsystem maintainer (signed off).
**Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS**
Record: **No dependencies.** Fix only reorders existing code within machine_constraints_voltage(). All structures (apply_uV, list_voltage, continuous_voltage_range) exist in this tree. **Can apply standalone.**
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION**
Record: b4 dig -c HEAD failed (commit not in tree). b4 dig with message-ID argument not supported by this b4 version. WebFetch and curl to lore.kernel.org blocked by Anubis bot protection. **Could not retrieve mailing list thread.** Link tag points to v1 submission (2026-07-20).
**Step 4.2: CHECK WHO REVIEWED THE PATCH**
Record: **UNVERIFIED** — b4 dig -w could not be run without commit in tree; lore inaccessible. Mark Brown (maintainer) Signed-off-by confirms maintainer acceptance.
**Step 4.3: SEARCH FOR THE BUG REPORT**
Record: No Reported-by: or syzbot Link: tags. Bug described as bring-up observation (voltage read-back outside clamped range). **No external bug report verified.**
**Step 4.4: CHECK FOR RELATED PATCHES AND SERIES**
Record: v1 in message-ID; no evidence of multi-patch series. Standalone.
**Step 4.5: CHECK STABLE MAILING LIST HISTORY**
Record: **UNVERIFIED** — lore.kernel.org inaccessible.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1: IDENTIFY KEY FUNCTIONS IN THE DIFF**
Record: machine_constraints_voltage() (modified). Supporting context:_regulator_do_set_voltage(), regulator_map_voltage(), set_machine_constraints(), regulator_register() path.
**Step 5.2: TRACE CALLERS**
Record:
- set_machine_constraints() → machine_constraints_voltage() (line 1461)
- set_machine_constraints() called from regulator registration at lines 5954 and 5967 (__regulator_register() path)
- **Context:** Every regulator probe/registration with machine constraints; common on ARM/embedded with device tree.
**Step 5.3: TRACE CALLEES**
Record: Clamping calls ops->list_voltage() per selector. apply_uV calls regulator_get_voltage_rdev() and _regulator_do_set_voltage() → regulator_map_voltage() → driver set_voltage_sel/set_voltage.
**Step 5.4: FOLLOW THE CALL CHAIN**
Record: Device probe → regulator_register() / devm variant → set_machine_constraints() → machine_constraints_voltage(). Triggered at boot for every constrained regulator. **Not directly userspace- triggerable**, but affects all platforms using DT regulator-min- microvolt / regulator-max-microvolt (which auto-set apply_uV = true in of_regulator.c lines 109–111).
**Step 5.5: SEARCH FOR SIMILAR PATTERNS**
Record: No similar ordering bug found elsewhere in drivers/regulator/core.c. Current and suspend voltage paths use already-clamped ranges.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
**Step 6.1: DOES THE BUGGY CODE EXIST IN THIS TREE?**
Record: **YES.** Current drivers/regulator/core.c lines 1208–1263 run apply_uV before clamping (lines 1265–1334). The candidate fix is **not** present (git log --grep='clamp voltage' returns nothing).
**Step 6.2: CHECK FOR BACKPORT COMPLICATIONS**
Record: **Clean apply expected.** Function structure in 6.18.44 matches the patch context exactly. No conflicting changes to this function in recent stable commits. Minor reorder only.
**Step 6.3: CHECK IF RELATED FIXES ARE ALREADY HERE**
Record: **No.** No alternative fix for this ordering issue in the tree.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY**
Record: **Subsystem:** drivers/regulator/core.c — regulator framework core. **Criticality: CORE/IMPORTANT** — affects power management for all constrained regulators platform-wide.
**Step 7.2: ASSESS SUBSYSTEM ACTIVITY**
Record: Active — multiple regulator core fixes in 6.18.y (locking, supply resolution, refcount leaks in individual drivers).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1: DETERMINE WHO IS AFFECTED**
Record: **Platform-specific but common** — boards using device tree regulators with regulator-min-microvolt + regulator-max-microvolt (auto-enables apply_uV) on discrete-voltage PMIC/LDO drivers (list_voltage + n_voltages, not continuous_voltage_range). Embedded, mobile, ARM SoCs.
**Step 8.2: DETERMINE THE TRIGGER CONDITIONS**
Record:
- apply_uV true (automatic from DT when min and max microvolt set)
- Discrete voltage table (ops->list_voltage && n_voltages && !continuous_voltage_range)
- Machine [min_uV, max_uV] wider than regulator's actual supported discrete range
- **Likelihood:** Moderate on embedded bring-up; DT authors often specify wide permissible ranges
- **Userspace:** Not directly triggerable; boot/probe path only
**Step 8.3: DETERMINE THE FAILURE MODE SEVERITY**
Record:
- **Probe failure:** machine_constraints_voltage() returns error → regulator registration fails → dependent devices fail probe → **boot failure** on affected boards. **Severity: HIGH/CRITICAL**
- **Wrong voltage programmed:** Hardware outside intended clamped range → instability or hardware damage risk. **Severity: HIGH**
- Not a crash/oops in the classical sense, but can prevent boot or misconfigure power rails.
**Step 8.4: CALCULATE RISK-BENEFIT RATIO**
Record:
- **Benefit:** HIGH for affected embedded platforms — prevents boot failures and incorrect voltage programming during regulator init
- **Risk:** LOW — reorder of existing logic, maintainer-reviewed, no new APIs
- **Ratio:** Strong benefit, minimal risk
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1: COMPILE THE EVIDENCE**
**FOR backporting:**
- Real ordering bug verified in 6.18.44 source code
- Can cause regulator registration failure (boot broken) or wrong voltage at bring-up
- Core regulator framework — broad impact surface for affected configs
- Small, surgical, maintainer-signed fix
- No prerequisites; applies cleanly to this tree
- Fix makes error paths safer (validation before hardware programming)
**AGAINST backporting:**
- Trigger requires specific config combination (apply_uV + discrete voltages + wide machine range)
- No syzbot report or multiple user reports in commit message
- Bring-up issue primarily (though affects production DT configs)
- Mailing list review details unverified
**UNRESOLVED:**
- Full lore review thread inaccessible
- Exact age of the ordering bug (shallow git history)
**Step 9.2: STABLE RULES CHECKLIST**
1. Obviously correct and tested? **PASS** — logic reorder is clear; maintainer SOB; no Tested-by but mechanism is verifiable
2. Fixes a real bug affecting users? **PASS** — probe failure / wrong voltage on affected boards
3. Important issue? **PASS** — boot failure and incorrect power-rail programming (HIGH severity)
4. Small and contained? **PASS** — single function in one file, no logic rewrite
5. No new features or APIs? **PASS**
6. Can apply to the local tree? **PASS** — buggy code present, fix not applied, clean apply expected
**Step 9.3: EXCEPTION CATEGORIES**
Record: None (not device ID, quirk, DT, build, or docs). Standard bug fix.
**Step 9.4: DECISION RATIONALE**
For **linux-6.18.y (6.18.44)**, the buggy ordering is present in machine_constraints_voltage(). The fix reorders existing clamping logic ahead of apply_uV so voltage selection always targets hardware- valid ranges — preventing registration failures and incorrect voltage programming on discrete regulators with wide DT constraints. This is a real, important correctness bug in the regulator core, with a low-risk surgical fix and maintainer approval. The lack of syzbot reports does not diminish the verified code-level bug.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified explicit ordering bug fix; Mark Brown SOB confirmed
- [Phase 2] Read full machine_constraints_voltage() (lines 1202–1337); confirmed apply_uV-before-clamp ordering; analyzed _regulator_do_set_voltage() / regulator_map_voltage() (lines 3685–3744)
- [Phase 3] git describe HEAD → v6.18.44; git blame on changed region; shallow history noted; no Fixes: tag; no duplicate fix in tree
- [Phase 4] b4 dig -c HEAD → wrong match (commit not in tree); lore WebFetch/curl blocked by Anubis — **UNVERIFIED** for list discussion and stable nominations
- [Phase 5] Traced callers: set_machine_constraints() (1461) ← registration (5954, 5967); of_regulator.c lines 109–111 auto-set apply_uV
- [Phase 6] Confirmed buggy code at lines 1208–1334; fix absent (git log --grep='clamp voltage' empty); HEAD on stable/linux-6.18.y branch family
- [Phase 7] Regulator core subsystem; active maintenance in 6.18.y
- [Phase 8] Failure modes: probe failure + wrong voltage; trigger:
apply_uV + discrete list_voltage + wide machine range
- [Phase 9] All stable criteria PASS for this tree
**YES**
drivers/regulator/core.c | 163 +++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 73 deletions(-)
drivers/regulator/core.c +90 -73
@@ -1204,10 +1204,98 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, {const struct regulator_ops *ops = rdev->desc->ops;int ret; +bool apply_uV; + +/* +* Decide up front, from the constraints as handed to us, whether +* apply_uV needs to run below. The clamping pass right after this +* may rewrite constraints->min_uV/max_uV (e.g. the fixed-voltage +* autoconfigure case), and we don't want that to change whether +* apply_uV fires. +*/ + apply_uV = rdev->constraints->apply_uV && + rdev->constraints->min_uV && rdev->constraints->max_uV; + +/* +* Constrain machine-level voltage specs to fit the actual range +* supported by this regulator before apply_uV (below) tries to +* force hardware to a value from that range: otherwise apply_uV +* can target a constraint value that doesn't correspond to any +* real voltage selector and fail registration outright, even +* though the clamping pass would have narrowed it to a value +* the regulator can actually hit. +*/ +if (ops->list_voltage && rdev->desc->n_voltages) { +int count = rdev->desc->n_voltages; +int i; +int min_uV =INT_MAX ; +int max_uV =INT_MIN ; +int cmin = constraints->min_uV; +int cmax = constraints->max_uV; + +/* it's safe to autoconfigure fixed-voltage supplies +* and the constraints are used by list_voltage. +*/ +if (count ==1 && !cmin) { + cmin =1 ; + cmax =INT_MAX ; + constraints->min_uV = cmin; + constraints->max_uV = cmax; + } + +/* voltage constraints are optional */ +if ((cmin ==0 ) && (cmax ==0 )) { +/* nothing more to do */ + +/* else require explicit machine-level constraints */ + }else if (cmin <=0 || cmax <=0 || cmax < cmin) { +rdev_err (rdev,"invalid voltage constraints\n" ); +return -EINVAL ; + +/* no need to loop voltages if range is continuous */ + }else if (rdev->desc->continuous_voltage_range) { +/* nothing more to do */ + + }else { +/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ +for (i =0 ; i < count; i++) { +int value; + + value = ops->list_voltage (rdev, i); +if (value <=0 ) +continue ; + +/* maybe adjust [min_uV..max_uV] */ +if (value >= cmin && value < min_uV) + min_uV = value; +if (value <= cmax && value > max_uV) + max_uV = value; + } + +/* final: [min_uV..max_uV] valid iff constraints valid */ +if (max_uV < min_uV) { +rdev_err (rdev, +"unsupportable voltage constraints %u-%uuV\n" , + min_uV, max_uV); +return -EINVAL ; + } + +/* use regulator's subset of machine constraints */ +if (constraints->min_uV < min_uV) { +rdev_dbg (rdev,"override min_uV, %d -> %d\n" , + constraints->min_uV, min_uV); + constraints->min_uV = min_uV; + } +if (constraints->max_uV > max_uV) { +rdev_dbg (rdev,"override max_uV, %d -> %d\n" , + constraints->max_uV, max_uV); + constraints->max_uV = max_uV; + } + } + }/* do we need to apply the constraint voltage */ -if (rdev->constraints->apply_uV && - rdev->constraints->min_uV && rdev->constraints->max_uV) { +if (apply_uV) {int target_min, target_max;int current_uV =regulator_get_voltage_rdev (rdev);
@@ -1262,77 +1350,6 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, } } -/* constrain machine-level voltage specs to fit -* the actual range supported by this regulator. -*/ -if (ops->list_voltage && rdev->desc->n_voltages) { -int count = rdev->desc->n_voltages; -int i; -int min_uV =INT_MAX ; -int max_uV =INT_MIN ; -int cmin = constraints->min_uV; -int cmax = constraints->max_uV; - -/* it's safe to autoconfigure fixed-voltage supplies -* and the constraints are used by list_voltage. -*/ -if (count ==1 && !cmin) { - cmin =1 ; - cmax =INT_MAX ; - constraints->min_uV = cmin; - constraints->max_uV = cmax; - } - -/* voltage constraints are optional */ -if ((cmin ==0 ) && (cmax ==0 )) -return 0 ; - -/* else require explicit machine-level constraints */ -if (cmin <=0 || cmax <=0 || cmax < cmin) { -rdev_err (rdev,"invalid voltage constraints\n" ); -return -EINVAL ; - } - -/* no need to loop voltages if range is continuous */ -if (rdev->desc->continuous_voltage_range) -return 0 ; - -/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ -for (i =0 ; i < count; i++) { -int value; - - value = ops->list_voltage (rdev, i); -if (value <=0 ) -continue ; - -/* maybe adjust [min_uV..max_uV] */ -if (value >= cmin && value < min_uV) - min_uV = value; -if (value <= cmax && value > max_uV) - max_uV = value; - } - -/* final: [min_uV..max_uV] valid iff constraints valid */ -if (max_uV < min_uV) { -rdev_err (rdev, -"unsupportable voltage constraints %u-%uuV\n" , - min_uV, max_uV); -return -EINVAL ; - } - -/* use regulator's subset of machine constraints */ -if (constraints->min_uV < min_uV) { -rdev_dbg (rdev,"override min_uV, %d -> %d\n" , - constraints->min_uV, min_uV); - constraints->min_uV = min_uV; - } -if (constraints->max_uV > max_uV) { -rdev_dbg (rdev,"override max_uV, %d -> %d\n" , - constraints->max_uV, max_uV); - constraints->max_uV = max_uV; - } - } -return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 9p: invalidate readdir buffer on seek
In reply to Sasha LevinFrom: Pierre Barre <[email protected]>
[ Upstream commit e661e17ddbed524b5fbda789a091b48b6b677067 ]
The per-fid readdir buffer (fid->rdir) is populated lazily and only refilled when fully drained (rdir->head == rdir->tail). userspace lseek() on a directory fd updates file->f_pos via generic_file_llseek() but does not touch the cached buffer, so the next getdents() iterates the stale cache and emits entries from the previous position instead of the one the caller asked for.
Track the file position the cached data corresponds to in struct p9_rdir, and drop the cache on entry to iterate_shared when it no longer matches ctx->pos. The 9p protocol's Tread/Treaddir already take an arbitrary offset on every request, so a refill at the new position is always legal; no .llseek override or seek restriction is needed.
Message-ID: <[email protected]>
---
LLM Generated explanations, may be completely bogus:
The background searches finished and match the earlier analysis:
- **Current tree (stable/linux-6.18.y at v6.18.44):** The fix is **not** present — e661e17ddbed is not an ancestor of HEAD, and there are no matching commits on HEAD.
- **Other branches:** The fix exists on autosel as 7ac74f9369bf6 (stable backport) and upstream as e661e17ddbed.
- **Subject grep on HEAD:** Only found the unrelated overlayfs readdir cache fix (65cd913ec9d9d), not the 9p patch.
- **Author history:** No prior Pierre Barre commits in fs/9p/ in this checkout.
**Verdict remains YES** — the bug is present in 6.18.y, the fix is small and standalone, and it should be backported.
fs/9p/vfs_dir.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/9p/vfs_dir.c +12 -0
@@ -27,6 +27,7 @@* struct p9_rdir - readdir accounting * @head: start offset of current dirread buffer * @tail: end offset of current dirread buffer +* @offset: file position the data at @head corresponds to * @buf: dirread buffer * * private structure for keeping track of readdir
@@ -36,6 +37,7 @@struct p9_rdir {int head;int tail; +loff_t offset;uint8_t buf[]; };
@@ -102,6 +104,9 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) kvec.iov_base = rdir->buf; kvec.iov_len = buflen; +if (rdir->head < rdir->tail && rdir->offset != ctx->pos) + rdir->head = rdir->tail =0 ; +while (1 ) {if (rdir->tail == rdir->head) {struct iov_iter to;
@@ -117,6 +122,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) rdir->head =0 ; rdir->tail = n; + rdir->offset = ctx->pos; }while (rdir->head < rdir->tail) { err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
@@ -134,6 +140,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) rdir->head += err; ctx->pos += err; + rdir->offset = ctx->pos; } } }
@@ -161,6 +168,9 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)if (!rdir)return -ENOMEM ; +if (rdir->head < rdir->tail && rdir->offset != ctx->pos) + rdir->head = rdir->tail =0 ; +while (1 ) {if (rdir->tail == rdir->head) { err = p9_client_readdir(fid, rdir->buf, buflen,
@@ -170,6 +180,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) rdir->head =0 ; rdir->tail = err; + rdir->offset = ctx->pos; }while (rdir->head < rdir->tail) {
@@ -190,6 +201,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) ctx->pos = curdirent.d_off; rdir->head += err; + rdir->offset = ctx->pos; } } }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu/ras: add ras_suspend callback and use it for cp_ecc_error_irq
In reply to Sasha LevinFrom: Yunxiang Li <[email protected]>
[ Upstream commit e3829992dd9fa0a82511af4f01733fc854cd15a5 ]
cp_ecc_error_irq is acquired in amdgpu_gfx_ras_late_init() but released in gfx_v9_0_hw_fini(), so the put site has to query amdgpu_irq_enabled() because the get is skipped on SR-IOV VF.
ras_late_init / ras_fini have no suspend counterpart, so move the put to amdgpu_gfx_ras_suspend() / amdgpu_gfx_ras_fini() and add a matching ras_suspend callback that is invoked from amdgpu_ras_suspend() before disable_all_features(). The get and put now sit in the same place and check the same condition (not VF, funcs registered), no refcount querying needed.
An active flag gates ras_fini so the suspend-then-unload-without-resume path falls into amdgpu_ras_block_late_fini_default() instead of double-releasing what ras_suspend already cleaned up.
Drop the cp_ecc_error_irq put from gfx_v9_0_hw_fini(). gfx_v8_0 manages cp_ecc_error_irq locally and is unaffected; no other GFX generation has this IRQ.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/amdgpu/ras: add ras_suspend callback and use it for cp_ecc_error_irq
**Local tree:** Linux **6.18.44** (git describe HEAD → v6.18.44) **Upstream commit:** e3829992dd9fa (not present in this tree; cherry- pick applies cleanly)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject parse**
Record: [drm/amdgpu/ras] — **add** (lifecycle fix disguised as infrastructure) — add ras_suspend callback and relocate cp_ecc_error_irq put to match its get site.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Yunxiang Li <[email protected]> (author)
- Acked-by: Alex Deucher <[email protected]> (subsystem maintainer)
- Signed-off-by: Alex Deucher <[email protected]> (committer)
- No Fixes:, Reported-by:, Link:, Cc: [email protected], Tested-by:, or Reviewed-by:
Notable: maintainer Ack from Alex Deucher is a strong quality signal.
**Step 1.3 — Body analysis**
Record:
- **Bug:** cp_ecc_error_irq is acquired in amdgpu_gfx_ras_late_init() but released in gfx_v9_0_hw_fini(), with mismatched conditions (get skipped on SR-IOV VF; put uses broader RAS-support check).
- **Symptom:** amdgpu_irq_put() called when IRQ was never acquired → WARN_ON(!amdgpu_irq_enabled()) in amdgpu_irq.c:637.
- **Root cause:** No suspend counterpart to ras_late_init/ras_fini; get/put live in different subsystems with different guards.
- **Fix approach:** Add ras_suspend callback, move put to amdgpu_gfx_ras_suspend()/amdgpu_gfx_ras_fini() with matching !VF && funcs condition; add active flag to avoid double-release on suspend-then-unload path.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Despite "add callback" wording, this is a reference- counting / lifecycle bug fix. It corrects asymmetric IRQ get/put that can trigger kernel warnings and incorrect teardown ordering.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record:
| File | Change | |------|--------| | `amdgpu_gfx.c` | +26/-4 | | `amdgpu_gfx.h` | +3/-1 | | `amdgpu_ras.c` | +32/-4 | | `amdgpu_ras.h` | +1 | | `gfx_v9_0.c` | -2 | | **Total** | +53/-11, 5 files |
Functions modified: amdgpu_gfx_ras_late_init, new amdgpu_gfx_ras_suspend, new amdgpu_gfx_ras_fini, amdgpu_gfx_ras_sw_init, amdgpu_ras_suspend, amdgpu_ras_late_init, amdgpu_ras_fini, gfx_v9_0_hw_fini.
Scope: **single-subsystem, surgical** (amdgpu RAS/GFX9).
**Step 2.2 — Code flow per hunk**
| Hunk | Before → After | |------|----------------| | `amdgpu_gfx_ras_late_init` | VF early-return then separate `irq_get` → combined `!VF && funcs` guard for `irq_get` | | New `amdgpu_gfx_ras_suspend` | No suspend cleanup → `irq_put` with same guard as get | | New `amdgpu_gfx_ras_fini` | No gfx-specific fini (header-only orphan declaration) → `irq_put` + `amdgpu_ras_block_late_fini` | | `amdgpu_gfx_ras_sw_init` | Only sets `ras_late_init` → also sets default `ras_suspend` and `ras_fini` | | `amdgpu_ras_suspend` | Only disables RAS features → iterates blocks, calls `ras_suspend`, clears `active` | | `amdgpu_ras_late_init` | No tracking → sets `node->active = true` after successful late_init | | `amdgpu_ras_fini` | Always calls custom `ras_fini` if supported → gated by `ras_node->active` to avoid double-cleanup after suspend | | `gfx_v9_0_hw_fini` | `irq_put(cp_ecc_error_irq)` if RAS supported → removed (now handled in RAS layer) |
**Step 2.3 — Bug mechanism**
Record: **Reference counting / resource lifecycle bug.**
- Get: amdgpu_irq_get() in amdgpu_gfx_ras_late_init() — only when !amdgpu_sriov_vf(adev) && cp_ecc_error_irq.funcs.
- Put (current tree): amdgpu_irq_put() in gfx_v9_0_hw_fini() — when amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX) only.
- On SR-IOV VF with RAS telemetry enabled, late_init runs (see amdgpu_ras_late_init VF check) but gfx irq_get is skipped; hw_fini still calls irq_put before the VF early-return → WARN_ON in amdgpu_irq_put().
**Step 2.4 — Fix quality**
Record: Fix is **obviously correct** — symmetric get/put with identical conditions, proper suspend hook, active flag prevents double-release. Minimal regression risk: no blocks currently register custom ras_fini in this tree (verified via grep), so the active flag behavior only affects the newly registered gfx callbacks.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 — Blame**
Record:
- gfx_v9_0_hw_fini put lines: d97b02bb9c7aa (May 2023) — prior fix for put-without-get when legacy GFX RAS disabled; did not fix VF condition mismatch.
- irq_get in amdgpu_gfx_ras_late_init: 6caeee7a708c0 (Sep 2019).
- Buggy asymmetric lifecycle present since **v5.x** era; still present in **6.18.44**.
**Step 3.2 — Fixes: tag**
Record: Not applicable (no Fixes: tag). Related prior fix d97b02bb9c7aa is in this tree but incomplete for the VF/get-put mismatch.
**Step 3.3 — File history**
Record: Part of 2-patch series [PATCH 0/2] drm/amdgpu: balance GFX IRQ get/put across init/suspend/fini. This commit is **patch 1/2** and is **self-contained** for cp_ecc_error_irq. Patch 2/2 (9117d8be850ba on master) addresses fault/EOP IRQs separately and is **not a prerequisite**.
**Step 3.4 — Author context**
Record: Yunxiang Li is an AMD contributor. Alex Deucher (maintainer) Acked and committed.
**Step 3.5 — Dependencies**
Record: **Standalone.** Cherry-pick to 6.18.44 applies cleanly with auto-merge. No prerequisite commits required.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 — Original discussion**
Record:
- URL:
https://patch.msgid.link/[email protected]
- Series: v1 only (no v2/v3 revisions found)
- Patch 1/2 of 2-patch series
**Step 4.2 — Reviewers**
Record: CC'd to [email protected], Alex Deucher, Christian König. Alex Deucher Acked.
**Step 4.3 — Bug report**
Record: No external bug report or syzbot link. Mechanism is documented in commit message; similar prior bug (d97b02bb9c7aa) had stack trace from gfx_v9_0_hw_fini → amdgpu_irq_put during suspend.
**Step 4.4 — Related patches**
Record: Patch 2/2 (drm/amdgpu/gfx: move fault and EOP IRQ get/put to hw_init/hw_fini) is independent. Not required for this fix.
**Step 4.5 — Stable list history**
Record: No Cc: stable nomination found in thread. Not a negative signal per instructions.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Key functions**
Record: amdgpu_gfx_ras_late_init, amdgpu_gfx_ras_suspend, amdgpu_gfx_ras_fini, amdgpu_ras_suspend, amdgpu_ras_late_init, amdgpu_ras_fini, gfx_v9_0_hw_fini, amdgpu_irq_get, amdgpu_irq_put.
**Step 5.2 — Callers**
Record:
- amdgpu_ras_suspend ← amdgpu_device_suspend() (line 5261) — **system suspend path**
- gfx_v9_0_hw_fini ← gfx_v9_0_suspend ← amdgpu_ip_block_suspend ← amdgpu_device_ip_suspend_phase2 — **suspend and driver unload**
- amdgpu_ras_late_init ← amdgpu_device_ip_late_init — boot and **resume** (line 5365)
- amdgpu_ras_fini ← amdgpu_device_ip_fini — driver unload
**Step 5.3 — Key callees**
Record: amdgpu_irq_get/put (atomic refcount on enabled_types), amdgpu_ras_block_late_fini, amdgpu_ras_disable_all_features.
**Step 5.4 — Reachability**
Record: **Yes, reachable from normal operations:**
- System suspend/resume (laptop, server)
- SR-IOV VF with RAS telemetry
- Driver unload after suspend (no resume)
- Config: CONFIG_DRM_AMDGPU + GFX9 hardware + RAS enabled
**Step 5.5 — Similar patterns**
Record: Prior fix d97b02bb9c7aa addressed same amdgpu_irq_put WARN class for different condition (amdgpu_ras_is_supported vs actually enabled). Patch 2/2 in the series addresses similar get/put split for other GFX IRQs.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
**Step 6.1 — Buggy code exists?**
Record: **Yes.** Current 6.18.44 tree has:
- irq_get in amdgpu_gfx_ras_late_init with VF skip (lines 937-943)
- irq_put in gfx_v9_0_hw_fini with only amdgpu_ras_is_supported guard (lines 4087-4088)
- No ras_suspend callback infrastructure
- Orphan amdgpu_gfx_ras_fini declaration in header with no implementation
**Step 6.2 — Backport complications**
Record: **Clean apply** — tested via git cherry-pick --no-commit e3829992dd9fa, auto-merged all 5 files.
**Step 6.3 — Related fixes already present?**
Record: d97b02bb9c7aa (partial fix) is in tree. This commit is not duplicated; it completes the lifecycle fix.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1 — Subsystem criticality**
Record: drivers/gpu/drm/amd/amdgpu — **IMPORTANT** (AMD GPU driver, widely deployed on desktops, laptops, servers, cloud VF).
**Step 7.2 — Activity**
Record: Actively maintained; RAS subsystem receives regular fixes in 6.18.y.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 — Who is affected**
Record: Users of **AMD GFX9 GPUs** with **RAS enabled** — especially **SR-IOV virtual functions** with RAS telemetry, and any system using suspend/resume with RAS.
**Step 8.2 — Trigger conditions**
Record:
- SR-IOV VF + RAS telemetry + suspend → **high likelihood** of amdgpu_irq_put WARN
- Suspend → unload without resume with new ras_fini → potential double irq_put without active flag
- Non-VF suspend/resume works today but has architectural fragility
**Step 8.3 — Failure mode severity**
Record: WARN_ON in amdgpu_irq_put during suspend — **MEDIUM** (kernel warning, incorrect IRQ state; not typically a panic but indicates broken refcounting). Suspend-then-unload double-release — **MEDIUM-HIGH** (refcount underflow / further WARNs).
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** HIGH for enterprise VF/cloud; MEDIUM for general amdgpu suspend users
- **Risk:** LOW — 53 lines, localized, maintainer-acked, applies cleanly, no custom ras_fini handlers exist in tree to be disrupted
- **Ratio:** Favorable
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 — Evidence summary**
| FOR backport | AGAINST backport | |---|---| | Fixes real refcounting/lifecycle bug | Part of 2-patch series (but patch 1 is self-contained) | | Triggerable on suspend (common path) | No syzbot/user report attached | | SR-IOV VF path clearly broken in current code | WARN severity, not panic | | Maintainer Acked-by Alex Deucher | | | Applies cleanly to 6.18.44 | | | Small, contained (53 lines) | | | Similar prior fix (`d97b02`) was stable material | | | Resume path re-acquires via `amdgpu_ras_late_init` in `amdgpu_device_resume` | |
**Step 9.2 — Stable rules checklist**
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — symmetric lifecycle, maintainer ack; no explicit Tested-by | | 2. Fixes real bug affecting users? | **PASS** — VF suspend WARN, suspend/unload edge case | | 3. Important issue? | **PASS** — MEDIUM severity (WARN, IRQ refcount corruption class) | | 4. Small and contained? | **PASS** — 5 files, 53 insertions | | 5. No new features/APIs? | **PASS** — internal driver callback only | | 6. Can apply to local tree? | **PASS** — clean cherry-pick verified |
**Step 9.3 — Exception categories**
Record: None (not device ID, quirk, DT, build fix, or docs).
**Step 9.4 — Decision rationale**
This commit fixes a longstanding asymmetric IRQ lifecycle in the amdgpu RAS/GFX9 path that can trigger WARN_ON during system suspend on SR-IOV VFs and creates fragile teardown on suspend-then-unload. The fix is small, maintainer-reviewed, applies cleanly to 6.18.44, and the affected code is present in this tree. The benefit outweighs the low regression risk.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified hidden refcounting bug
- [Phase 2] Analyzed all 5 file diffs; classified as reference- counting/lifecycle fix
- [Phase 3] git blame on gfx_v9_0.c:4087-4088 → d97b02bb9c7aa (2023); irq_get introduced 6caeee7a708c0 (2019); both ancestors in tree
- [Phase 3] git log --grep found commit e3829992dd9fa on origin/master; not ancestor of HEAD (not in 6.18.44)
- [Phase 3] Confirmed patch 1/2 is standalone; patch 2/2 (9117d8be850ba) is separate
- [Phase 4] b4 dig -c e3829992dd9fa →
https://patch.msgid.link/[email protected]
- [Phase 4] b4 dig -a → v1 only
- [Phase 4] b4 dig -w → CC: amd-gfx, Alex Deucher, Christian König
- [Phase 4] No stable nomination in thread
- [Phase 5] Traced callers: amdgpu_device_suspend → amdgpu_ras_suspend; gfx_v9_0_suspend → gfx_v9_0_hw_fini
- [Phase 5] Read amdgpu_irq_put at amdgpu_irq.c:637 — WARN_ON(!amdgpu_irq_enabled())
- [Phase 5] Grep: no .ras_fini = assignments in tree (no custom ras_fini handlers)
- [Phase 6] git describe HEAD → v6.18.44; buggy code confirmed at amdgpu_gfx.c:937-943, gfx_v9_0.c:4087-4088
- [Phase 6] git cherry-pick --no-commit e3829992dd9fa → clean auto- merge on all 5 files
- [Phase 6] amdgpu_device_resume calls amdgpu_device_ip_late_init → amdgpu_ras_late_init (re-acquires IRQ on resume)
- [Phase 8] Failure mode: WARN_ON during VF suspend — MEDIUM severity
**YES**
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 26 ++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 32 +++++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 -- 5 files changed, 53 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +22 -4
@@ -934,10 +934,7 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *rif (r)return r; -if (amdgpu_sriov_vf (adev)) -return r; - -if (adev->gfx.cp_ecc_error_irq.funcs) { +if (!amdgpu_sriov_vf (adev) && adev->gfx.cp_ecc_error_irq.funcs) { r =amdgpu_irq_get (adev, &adev->gfx.cp_ecc_error_irq,0 );if (r) goto late_fini;
@@ -952,6 +949,21 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *rreturn r; } +void amdgpu_gfx_ras_suspend (struct amdgpu_device *adev, +struct ras_common_if *ras_block) +{ +if (!amdgpu_sriov_vf (adev) && adev->gfx.cp_ecc_error_irq.funcs) +amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 ); +} + +void amdgpu_gfx_ras_fini (struct amdgpu_device *adev, +struct ras_common_if *ras_block) +{ +if (!amdgpu_sriov_vf (adev) && adev->gfx.cp_ecc_error_irq.funcs) +amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 ); +amdgpu_ras_block_late_fini (adev, ras_block); +} +int amdgpu_gfx_ras_sw_init (struct amdgpu_device *adev) {int err =0 ;
@@ -980,6 +992,12 @@ int amdgpu_gfx_ras_sw_init(struct amdgpu_device *adev)if (!ras->ras_block.ras_late_init) ras->ras_block.ras_late_init = amdgpu_gfx_ras_late_init; +if (!ras->ras_block.ras_suspend) + ras->ras_block.ras_suspend = amdgpu_gfx_ras_suspend; + +if (!ras->ras_block.ras_fini) + ras->ras_block.ras_fini = amdgpu_gfx_ras_fini; +/* If not defined special ras_cb function, use default ras_cb */ if (!ras->ras_block.ras_cb) ras->ras_block.ras_cb = amdgpu_gfx_process_ras_data_cb;
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -1
@@ -603,7 +603,8 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable);void amdgpu_gfx_off_ctrl_immediate (struct amdgpu_device *adev,bool enable);int amdgpu_get_gfx_off_status (struct amdgpu_device *adev,uint32_t *value);int amdgpu_gfx_ras_late_init (struct amdgpu_device *adev,struct ras_common_if *ras_block); -void amdgpu_gfx_ras_fini (struct amdgpu_device *adev); +void amdgpu_gfx_ras_suspend (struct amdgpu_device *adev,struct ras_common_if *ras_block); +void amdgpu_gfx_ras_fini (struct amdgpu_device *adev,struct ras_common_if *ras_block);int amdgpu_get_gfx_off_entrycount (struct amdgpu_device *adev,u64 *value);int amdgpu_get_gfx_off_residency (struct amdgpu_device *adev,u32 *residency);int amdgpu_set_gfx_off_residency (struct amdgpu_device *adev,bool value);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +28 -4
@@ -92,6 +92,9 @@ struct amdgpu_ras_block_list {struct list_head node;struct amdgpu_ras_block_object *ras_obj; + +/* set by ras_late_init, cleared by ras_suspend/ras_fini */ +bool active; };const char *get_ras_block_str (struct ras_common_if *ras_block)
@@ -4392,10 +4395,23 @@ void amdgpu_ras_resume(struct amdgpu_device *adev)void amdgpu_ras_suspend (struct amdgpu_device *adev) {struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct amdgpu_ras_block_list *node; +struct amdgpu_ras_block_object *obj;if (!adev->ras_enabled || !con)return ; +/* run per-block ras_suspend before tearing down the RAS context */ +list_for_each_entry (node, &adev->ras_list, node) { +if (!node->active) +continue ; + + obj = node->ras_obj; +if (obj && obj->ras_suspend) + obj->ras_suspend (adev, &obj->ras_comm); + node->active = false; + } +amdgpu_ras_disable_all_features (adev,0 );/* Make sure all ras objects are disabled. */ if (AMDGPU_RAS_GET_FEATURES (con->features))
@@ -4449,8 +4465,15 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev) obj->ras_comm.name, r);return r; } - }else -amdgpu_ras_block_late_init_default (adev, &obj->ras_comm); + }else { + r =amdgpu_ras_block_late_init_default (adev, &obj->ras_comm); +if (r) { +dev_err (adev->dev,"%s failed to execute ras_block_late_init_default! ret:%d\n" , + obj->ras_comm.name, r); +return r; + } + } + node->active = true; }return 0 ;
@@ -4487,11 +4510,12 @@ int amdgpu_ras_fini(struct amdgpu_device *adev)list_for_each_entry_safe (ras_node, tmp, &adev->ras_list, node) {if (ras_node->ras_obj) { obj = ras_node->ras_obj; -if (amdgpu_ras_is_supported (adev, obj->ras_comm.block) && - obj->ras_fini) +/* fall back to default cleanup if ras_suspend already ran */ +if (ras_node->active && obj->ras_fini) obj->ras_fini (adev, &obj->ras_comm);else amdgpu_ras_block_late_fini_default (adev, &obj->ras_comm); + ras_node->active = false; }/* Clear ras blocks from ras_list and free ras block list node */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
@@ -731,6 +731,7 @@ struct amdgpu_ras_block_object {int (*ras_block_match)(struct amdgpu_ras_block_object *block_obj,enum amdgpu_ras_block block,uint32_t sub_block_index);int (*ras_late_init)(struct amdgpu_device *adev,struct ras_common_if *ras_block); +void (*ras_suspend)(struct amdgpu_device *adev,struct ras_common_if *ras_block);void (*ras_fini)(struct amdgpu_device *adev,struct ras_common_if *ras_block);ras_ih_cb ras_cb;const struct amdgpu_ras_block_hw_ops *hw_ops;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -4084,8 +4084,6 @@ static int gfx_v9_0_hw_fini(struct amdgpu_ip_block *ip_block) {struct amdgpu_device *adev = ip_block->adev; -if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__GFX )) -amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );amdgpu_irq_put (adev, &adev->gfx.bad_op_irq,0 );
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: Transition to basic uAPSD with MAC_PM_POWER_TABLE API VER_3
In reply to Sasha LevinFrom: Avinash Bhatt <[email protected]>
[ Upstream commit fc58bb9ecef04aa46f201fc421a16e670b5dc01f ]
uAPSD is transitioning to a certification-only feature. The new firmware API version 3 removes advanced uAPSD fields, keeping only basic parameters needed for certification testing.
Support the new VER_3 API in the MLD driver while maintaining backward compatibility with VER_1/2. The MVM driver continues using VER_2 only. Remove the obsolete PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION notification from the MLD driver
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [wifi: iwlwifi] [Transition] — MLD driver support for MAC_PM_POWER_TABLE firmware API version 3, keeping backward compatibility with VER_1/2.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Avinash Bhatt <[email protected]>
- Link: https://patch.msgid.link/20260512222731...
- Signed-off-by: Miri Korenblit <[email protected]>
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: [email protected]
- Notable: Intel iwlwifi maintainers; no user/fuzzer reports
**Step 1.3 — Body analysis**
Record:
- **Bug described:** Firmware API v3 removes advanced uAPSD fields; driver must use a smaller command layout and stop using obsolete notification/flags.
- **Symptom:** Driver/firmware ABI mismatch on MLD devices when firmware advertises API v3.
- **Root cause:** MLD driver always builds/sends the VER_1/2-sized iwl_mac_power_cmd and handles PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION, which v3 firmware no longer supports.
- **Version info:** MVM stays on VER_2; only MLD needs v3 handling.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Despite “transition” wording, this is firmware API
compatibility: wrong command size and unsupported flags when firmware reports MAC_PM_POWER_TABLE v3.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- 8 files changed (~+200/−60 lines)
- Files: fw/api/power.h, mld/power.c, mld/notif.c, mld/iface.c, mld/iface.h, mld/mld.c, mvm/mvm.h, mvm/power.c
- Functions: iwl_mld_update_mac_power(), iwl_mld_power_build_cmd*(), iwl_mld_power_configure_uapsd*(), notification handlers; MVM rename- only to iwl_mac_power_cmd_v2
- Scope: multi-file, localized to iwlwifi power management
**Step 2.2 — Code flow changes**
Record:
- **Before:** MLD always fills/sends full VER_2 struct via iwl_mld_send_cmd_pdu() (uses sizeof(*data)).
- **After:** iwl_fw_lookup_cmd_ver(..., MAC_PM_POWER_TABLE, 0) selects v3 (20-byte) or v2 (40-byte) struct; explicit sizeof passed to iwl_mld_send_cmd_with_flags_pdu().
- **Before:** MLD registers/handles PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION.
- **After:** Handler/registration removed (obsolete in v3).
- **MVM:** Type rename only; still sends VER_2 struct.
**Step 2.3 — Bug mechanism**
Record: **Logic/correctness + firmware ABI mismatch.** Driver sends oversized command and sets unsupported flags (POWER_FLAGS_SNOOZE_ENA_MSK, POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK) when firmware expects v3 layout.
**Step 2.4 — Fix quality**
Record: Follows existing iwlwifi version-selection pattern (e.g. iwl_phy_cfg_cmd in mvm/fw.c). Minimal risk for v1/v2 firmware. Moderate duplication (v2/v3 paths). Low regression risk on MVM (rename only).
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: Local repo history is shallow; blame on iwl_mld_update_mac_power() not useful for introduction date. MLD power.c copyright is 2024–2025; MLD driver is recent WiFi 7 code present in this tree.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag.
**Step 3.3 — Related file history**
Record: git log --oneline -15 -- drivers/net/wireless/intel/iwlwifi/mld/power.c returned only unrelated commits (shallow history). MLD driver and iwl_mld_update_mac_power() are present in v6.18.44.
**Step 3.4 — Author context**
Record: Intel iwlwifi team (Avinash Bhatt, Miri Korenblit). Subsystem- appropriate authors.
**Step 3.5 — Dependencies**
Record: Standalone. No “patch X/Y” references. Uses existing iwl_fw_lookup_cmd_ver() and iwl_mld_send_cmd_with_flags_pdu() already in tree.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: b4 dig -c <commit> unavailable (commit not in checkout). patch.msgid.link and lore.kernel.org blocked by bot protection. **UNVERIFIED:** review thread content, stable nominations, NAKs.
**Step 4.2 — Reviewers**
Record: **UNVERIFIED** — could not fetch thread recipients.
**Step 4.3 — Bug reports**
Record: None in commit message. No syzbot/bugzilla links.
**Step 4.4 — Related patches/series**
Record: Likely part of Intel iwlwifi May 2026 update series; **UNVERIFIED** whether other series commits are required.
**Step 4.5 — Stable list history**
Record: **UNVERIFIED** — lore blocked.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: iwl_mld_update_mac_power(), iwl_mld_power_build_cmd(), iwl_mld_power_build_cmd_v2(), iwl_mld_power_configure_uapsd(), iwl_mld_handle_uapsd_misbehaving_ap_notif() (removed).
**Step 5.2 — Callers**
Record: iwl_mld_update_mac_power() called from:
- mld/mac80211.c — association, BSS/PM changes (6 call sites)
- mld/d3.c — suspend/WoWLAN
- mld/low_latency.c, mld/debugfs.c
Common runtime paths on WiFi 7 MLD hardware.
**Step 5.3 — Callees**
Record: iwl_fw_lookup_cmd_ver(), iwl_mld_send_cmd_with_flags_pdu() → iwl_trans_send_cmd().
**Step 5.4 — Reachability**
Record: Triggered on normal STA association and power-management updates for CONFIG_IWLMLD devices (WiFi 7, firmware major ≥ 97 per IWL_MLD_SUPPORTED_FW_VERSION).
**Step 5.5 — Similar patterns**
Record: mvm/fw.c already uses iwl_fw_lookup_cmd_ver() + version- specific sizeof() for iwl_phy_cfg_cmd — same established pattern.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Current tree atdrivers/net/wireless/intel/iwlwifi/mld/power.c:
```295:302:drivers/net/wireless/intel/iwlwifi/mld/power.c
int iwl_mld_update_mac_power(struct iwl_mld *mld, struct ieee80211_vif
*vif,
bool d3)
{
struct iwl_mac_power_cmd cmd = {};
iwl_mld_power_build_cmd(mld, vif, &cmd, d3);
return iwl_mld_send_cmd_pdu(mld, MAC_PM_POWER_TABLE, &cmd);
}
```Always sends full VER_2 struct; no v3 handling. MLD driver, CONFIG_IWLMLD, and WiFi 7 opmode selection (IWL_MLD_SUPPORTED_FW_VERSION 97) all exist in this tree.
**Step 6.2 — Backport complications**
Record: Expected **clean apply** — target code exists and matches patch context. MVM changes are type renames only.
**Step 6.3 — Related fixes already present?**
Record: No existing v3 handling found (grep for cmd_ver >= 3 under mld/ returned nothing). Fix not already applied.
---
## Phase 7: Subsystem Context
**Step 7.1 — Subsystem/criticality**
Record: drivers/net/wireless/intel/iwlwifi — **IMPORTANT** (WiFi driver, affects connectivity and power management on Intel WiFi 7 hardware).
**Step 7.2 — Activity**
Record: MLD is actively developed recent subsystem in 6.18; WiFi 7 support is current focus.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Users with CONFIG_IWLMLD on Intel WiFi 7 hardware (BZ/SC/DR families, FM+ RF) running firmware that advertises MAC_PM_POWER_TABLE API v3.
**Step 8.2 — Trigger conditions**
Record: Firmware reports command API v3 at init; driver then sends power table on association/PM changes. Likely with newer Intel firmware releases coordinated with this change. Not userspace-triggerable as a security primitive.
**Step 8.3 — Failure mode severity**
Record: **MEDIUM–HIGH** — firmware command rejection/misparsing → broken power management, connectivity instability, battery impact. Not a kernel oops/panic, but real user-visible hardware malfunction.
**Step 8.4 — Risk/benefit**
Record:
- **Benefit:** Prevents PM breakage on supported WiFi 7 hardware with v3 firmware; backward compatible.
- **Risk:** Low–medium (duplicated code paths, but pattern is proven in iwlwifi).
- **Ratio:** Favorable for backport once v3 firmware is deployed to stable users.
---
## Phase 9: Final Synthesis
**Evidence FOR:**
- Real firmware/driver ABI bug when API v3 is advertised
- Buggy code confirmed in v6.18.44 MLD driver
- Affects common association/PM code paths
- Small, reviewable change following existing iwlwifi conventions
- Backward compatible with VER_1/2
- MLD/WiFi 7 hardware supported in this tree
**Evidence AGAINST:**
- No crash, security, or corruption report
- Commit framed as uAPSD certification API transition
- Moderate size (~200 lines, duplicated v2/v3 paths)
- MVM portion is rename-only (no MVM bug fix)
- Mailing-list review/stable nomination unverified
- Impact depends on v3 firmware actually shipping to 6.18 users
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** (clear version branching; no Tested-by in message)
2. Fixes real bug affecting users? **PASS** (ABI mismatch on MLD + v3 firmware)
3. Important issue? **PASS** (PM/connectivity malfunction, MEDIUM–HIGH)
4. Small and contained? **PASS** (localized iwlwifi PM; moderate line count)
5. No new features/APIs? **PASS** (firmware compatibility, not new userspace API)
6. Can apply to local tree? **PASS** (MLD code present, clean apply expected)
**Exception category:** Firmware API compatibility for existing hardware — qualifies similarly to other iwlwifi command-version fixes.
---
## Verification
- [Phase 1] Parsed subject, tags, body from provided commit message
- [Phase 2] Analyzed full diff: 8 files, version-based struct selection, notification removal
- [Phase 3] git describe HEAD → v6.18.44; Makefile → 6.18.44
- [Phase 3] git log --oneline -15 -- mld/power.c → shallow/unhelpful history
- [Phase 3] git blame on iwl_mld_update_mac_power() → shallow repo artifact
- [Phase 4] b4 dig without commit hash → not usable; lore/patch.msgid.link → bot-blocked (**UNVERIFIED** review discussion)
- [Phase 5] grep iwl_mld_update_mac_power → 10 call sites in mac80211/d3/debugfs/low_latency
- [Phase 5] Read iwl-drv.c: IWL_MLD_SUPPORTED_FW_VERSION 97, MLD opmode selection for WiFi 7
- [Phase 5] Read mvm/fw.c:577-586 → confirmed version-based sizeof pattern
- [Phase 6] Read current mld/power.c:295-302 → always sends VER_2 struct (bug confirmed)
- [Phase 6] Read fw/api/power.h → single iwl_mac_power_cmd (VER_1/2 layout, no v3 split)
- [Phase 6] grep cmd_ver >= 3 in mld/ → no matches (fix absent)
- [Phase 6] grep iwl_mld_handle_uapsd_misbehaving → handler present (to be removed)
- [Phase 7] Kconfig: CONFIG_IWLMLD tristate MLD firmware support exists
- [Phase 8] Struct size: v3 ≈ 20 bytes vs v2 ≈ 40 bytes (verified by field layout)
- **UNVERIFIED:** Whether v3 firmware is already distributed to 6.18.y users
- **UNVERIFIED:** Mailing-list reviewer feedback or explicit stable nomination
## Conclusion
For **this tree (v6.18.44)**, the MLD driver unconditionally sends the wrong MAC_PM_POWER_TABLE command layout when firmware advertises API v3. That is a real compatibility bug on supported Intel WiFi 7 hardware, on common runtime paths, with a contained fix that preserves v1/v2 behavior. It meets stable criteria as a firmware ABI compatibility fix for existing hardware.
**YES**
.../net/wireless/intel/iwlwifi/fw/api/power.h | 48 ++++- .../net/wireless/intel/iwlwifi/mld/iface.c | 18 -- .../net/wireless/intel/iwlwifi/mld/iface.h | 3 - drivers/net/wireless/intel/iwlwifi/mld/mld.c | 1 - .../net/wireless/intel/iwlwifi/mld/notif.c | 6 - .../net/wireless/intel/iwlwifi/mld/power.c | 177 ++++++++++++++++-- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 +- .../net/wireless/intel/iwlwifi/mvm/power.c | 14 +- 8 files changed, 214 insertions(+), 57 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/power.h +43 -5
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2012-2014, 2018-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH */
@@ -85,12 +85,13 @@ struct iwl_ltr_config_cmd {* '1' PM could sleep over DTIM till listen Interval. * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all * access categories are both delivery and trigger enabled. +* (Not supported since version 3) * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and * PBW Snoozing enabled * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable. * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving -* detection enablement +* detection enablement (Not supported since version 3) * @POWER_FLAGS_ENABLE_SMPS_MSK: SMPS is allowed for this vif */ enum iwl_power_flags {
@@ -175,9 +176,9 @@ struct iwl_device_power_cmd { } __packed;/** -* struct iwl_mac_power_cmd - New power command containing uAPSD support +* struct iwl_mac_power_cmd_v2 - power command V2 containing uAPSD support * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response) -* @id_and_color: MAC contex identifier, &enum iwl_ctxt_id_and_color +* @id_and_color: MAC context identifier, &enum iwl_ctxt_id_and_color * @flags: Power table command flags from POWER_FLAGS_* * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. * Minimum allowed:- 3 * DTIM. Keep alive period must be
@@ -216,7 +217,7 @@ struct iwl_device_power_cmd {* @limited_ps_threshold: (unused) * @reserved: reserved (padding) */ -struct iwl_mac_power_cmd { +struct iwl_mac_power_cmd_v2 {/* CONTEXT_DESC_API_T_VER_1 */ __le32 id_and_color;
@@ -242,6 +243,43 @@ struct iwl_mac_power_cmd {u8 reserved; } __packed;/* CLIENT_PM_POWER_TABLE_S_VER_1, VER_2 */ +/** +* struct iwl_mac_power_cmd - power command +* MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response) +* @id_and_color: MAC context identifier, &enum iwl_ctxt_id_and_color +* @flags: Power table command flags from POWER_FLAGS_* +* @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. +* Minimum allowed:- 3 * DTIM. Keep alive period must be +* set regardless of power scheme or current power state. +* FW use this value also when PM is disabled. +* @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to +* PSM transition - legacy PM +* @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to +* PSM transition - legacy PM +* @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. +* Default: 80dbm +* @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag +* is set. For example, if it is required to skip over +* one DTIM, this value need to be set to 2 (DTIM periods). +* @qndp_tid: TID client shall use for uAPSD QNDP triggers +* @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for +* each corresponding AC. +* Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values. +*/ +struct iwl_mac_power_cmd { +/* CONTEXT_DESC_API_T_VER_1 */ +__le32 id_and_color; + +__le16 flags; +__le16 keep_alive_seconds; +__le32 rx_data_timeout; +__le32 tx_data_timeout; +u8 lprx_rssi_threshold; +u8 skip_dtim_periods; +u8 qndp_tid; +u8 uapsd_ac_flags; +} __packed;/* CLIENT_PM_POWER_TABLE_S_VER_3 */ +/* * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when * associated AP is identified as improperly implementing uAPSD protocol.
drivers/net/wireless/intel/iwlwifi/mld/iface.c +0 -18
@@ -588,24 +588,6 @@ void iwl_mld_handle_probe_resp_data_notif(struct iwl_mld *mld,kfree_rcu (old_data, rcu_head); } -void iwl_mld_handle_uapsd_misbehaving_ap_notif (struct iwl_mld *mld, -struct iwl_rx_packet *pkt) -{ -struct iwl_uapsd_misbehaving_ap_notif *notif = (void *)pkt->data; -struct ieee80211_vif *vif; - -if (IWL_FW_CHECK (mld, notif->mac_id >=ARRAY_SIZE (mld->fw_id_to_vif), -"mac id is invalid: %d\n" , notif->mac_id)) -return ; - - vif =wiphy_dereference (mld->wiphy, mld->fw_id_to_vif[notif->mac_id]); - -if (WARN_ON (!vif) ||ieee80211_vif_is_mld (vif)) -return ; - -IWL_WARN (mld,"uapsd misbehaving AP: %pM\n" , vif->bss_conf.bssid); -} -void iwl_mld_handle_datapath_monitor_notif (struct iwl_mld *mld,struct iwl_rx_packet *pkt) {
drivers/net/wireless/intel/iwlwifi/mld/iface.h +0 -3
@@ -234,9 +234,6 @@ void iwl_mld_handle_probe_resp_data_notif(struct iwl_mld *mld,void iwl_mld_handle_datapath_monitor_notif (struct iwl_mld *mld,struct iwl_rx_packet *pkt); -void iwl_mld_handle_uapsd_misbehaving_ap_notif (struct iwl_mld *mld, -struct iwl_rx_packet *pkt); -void iwl_mld_reset_cca_40mhz_workaround (struct iwl_mld *mld,struct ieee80211_vif *vif);
drivers/net/wireless/intel/iwlwifi/mld/mld.c +0 -1
@@ -162,7 +162,6 @@ static const struct iwl_hcmd_names iwl_mld_legacy_names[] = {HCMD_NAME (PHY_CONFIGURATION_CMD ),HCMD_NAME (SCAN_OFFLOAD_UPDATE_PROFILES_CMD ),HCMD_NAME (POWER_TABLE_CMD ), -HCMD_NAME (PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION ),HCMD_NAME (BEACON_NOTIFICATION ),HCMD_NAME (BEACON_TEMPLATE_CMD ), HCMD_NAME(TX_ANT_CONFIGURATION_CMD),
drivers/net/wireless/intel/iwlwifi/mld/notif.c +0 -6
@@ -338,8 +338,6 @@ CMD_VERSIONS(emlsr_mode_notif, CMD_VER_ENTRY(2, iwl_esr_mode_notif)) CMD_VERSIONS(emlsr_trans_fail_notif, CMD_VER_ENTRY(1, iwl_esr_trans_fail_notif)) -CMD_VERSIONS(uapsd_misbehaving_ap_notif, - CMD_VER_ENTRY(1, iwl_uapsd_misbehaving_ap_notif)) CMD_VERSIONS(time_msmt_notif, CMD_VER_ENTRY(1, iwl_time_msmt_notify)) CMD_VERSIONS(time_sync_confirm_notif,
@@ -360,8 +358,6 @@ DEFINE_SIMPLE_CANCELLATION(scan_complete, iwl_umac_scan_complete, uid) DEFINE_SIMPLE_CANCELLATION(scan_start, iwl_umac_scan_start, uid)DEFINE_SIMPLE_CANCELLATION (probe_resp_data, iwl_probe_resp_data_notif, mac_id) -DEFINE_SIMPLE_CANCELLATION (uapsd_misbehaving_ap, iwl_uapsd_misbehaving_ap_notif, - mac_id) DEFINE_SIMPLE_CANCELLATION(ftm_resp, iwl_tof_range_rsp_ntfy, request_id)DEFINE_SIMPLE_CANCELLATION (beacon_filter, iwl_beacon_filter_notif, link_id)
@@ -452,8 +448,6 @@ const struct iwl_rx_handler iwl_mld_rx_handlers[] = { emlsr_mode_notif, RX_HANDLER_ASYNC) RX_HANDLER_NO_OBJECT(MAC_CONF_GROUP, EMLSR_TRANS_FAIL_NOTIF, emlsr_trans_fail_notif, RX_HANDLER_ASYNC) - RX_HANDLER_OF_VIF(LEGACY_GROUP, PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION, - uapsd_misbehaving_ap_notif)RX_HANDLER_NO_OBJECT (LEGACY_GROUP ,WNM_80211V_TIMING_MEASUREMENT_NOTIFICATION , time_msmt_notif,RX_HANDLER_SYNC )
drivers/net/wireless/intel/iwlwifi/mld/power.c +162 -15
221 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright (C) 2012-2014, 2018-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -477,7 +477,7 @@ struct iwl_mvm_vif {struct dentry *dbgfs_slink;struct iwl_dbgfs_pm dbgfs_pm;struct iwl_dbgfs_bf dbgfs_bf; -struct iwl_mac_power_cmd mac_pwr_cmd; +struct iwl_mac_power_cmd_v2 mac_pwr_cmd;int dbgfs_quota_min;bool ftm_unprotected;#endif
drivers/net/wireless/intel/iwlwifi/mvm/power.c +7 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2012-2014, 2018-2019, 2021-2025 Intel Corporation +* Copyright (C) 2012-2014, 2018-2019, 2021-2026 Intel Corporation * Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH */
@@ -83,7 +83,7 @@ void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, }static void iwl_mvm_power_log (struct iwl_mvm *mvm, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) { IWL_DEBUG_POWER(mvm, "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n",
@@ -121,7 +121,7 @@ static void iwl_mvm_power_log(struct iwl_mvm *mvm,static void iwl_mvm_power_configure_uapsd (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);enum ieee80211_ac_numbers ac;
@@ -296,7 +296,7 @@ static bool iwl_mvm_power_is_radar(struct ieee80211_bss_conf *link_conf)static void iwl_mvm_power_config_skip_dtim (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {struct ieee80211_bss_conf *link_conf;unsigned int min_link_skip = ~0 ;
@@ -344,7 +344,7 @@ static void iwl_mvm_power_config_skip_dtim(struct iwl_mvm *mvm,static void iwl_mvm_power_build_cmd (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -struct iwl_mac_power_cmd *cmd) +struct iwl_mac_power_cmd_v2 *cmd) {int dtimper, bi;int keep_alive;
@@ -466,7 +466,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,static int iwl_mvm_power_send_cmd (struct iwl_mvm *mvm,struct ieee80211_vif *vif) { -struct iwl_mac_power_cmd cmd = {}; +struct iwl_mac_power_cmd_v2 cmd = {};iwl_mvm_power_build_cmd (mvm, vif, &cmd);iwl_mvm_power_log (mvm, &cmd);
@@ -717,7 +717,7 @@ int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, int bufsz) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); -struct iwl_mac_power_cmd cmd = {}; +struct iwl_mac_power_cmd_v2 cmd = {};int pos =0 ;mutex_lock (&mvm->mutex);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ata: libata-pmp: add JMicron JMS562 quirk
In reply to Sasha LevinFrom: Xu Rao <[email protected]>
[ Upstream commit c62aff1174cf88e10716c7513702443c47551fc6 ]
JMicron JMS562, as used in QNAP QDA-A2AR RAID1 adapters, may keep the exported ATA device not ready while the array is rebuilding.
In this state, libata may repeatedly try to softreset and classify the fan-out link. On the affected adapter, this can time out, make PMP/SCR access fail, and eventually disable the fan-out link before the RAID volume is exported.
A failing boot shows the fan-out link failing SRST, PMP access timing out, SCR read failing, and the link being disabled:
ata4.00: softreset failed (device not ready) ata4.15: qc timeout after 3000 msecs (cmd 0xe4) ata4.00: failed to read SCR 0 (Emask=0x4) ata4.00: failed to recover link after 3 tries, disabling
After that, the root filesystem on the exported RAID volume cannot be found.
Add JMS562 to the existing JMicron PMP quirk that disables LPM, avoids softreset on fan-out links, and assumes an ATA device. This prevents libata from dropping the exported RAID volume during rebuild recovery.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
- Record: [ata: libata-pmp] [add] JMicron JMS562 quirk for QNAP QDA-A2AR RAID adapter boot failure during array rebuild
**Step 1.2 — Tags**
- Record:
- Signed-off-by: Xu Rao <[email protected]> (author)
- Reviewed-by: Damien Le Moal <[email protected]> (libata maintainer)
- Signed-off-by: Niklas Cassel <[email protected]> (committer)
- No Fixes:, Reported-by:, Tested-by:, `Cc:
[email protected], or Link:` tags
- Notable: maintainer review from Damien Le Moal; no syzbot/fuzzer involvement
**Step 1.3 — Body analysis**
- Record:
- **Bug:** JMicron JMS562 PMP (QNAP QDA-A2AR RAID1 adapter) keeps exported ATA device "not ready" during RAID rebuild
- **Symptom:** libata repeatedly softresets/classifies fan-out link → PMP/SCR timeouts → link disabled → root filesystem on RAID volume not found at boot
- **Failure log:** softreset failed (device not ready), qc timeout, failed to read SCR 0, failed to recover link after 3 tries, disabling
- **Root cause:** Missing quirk; libata error-handling path incompatible with JMS562 behavior during rebuild
- **Fix approach:** Add device ID 0x0562 to existing JMicron quirk block (disable LPM, avoid SRST, assume ATA)
- **Version info:** None stated in commit message
**Step 1.4 — Hidden bug fix detection**
- Record: Not hidden — this is an explicit hardware quirk fix. "Add quirk" language is standard for ATA PMP workarounds; the commit clearly describes a real boot failure.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
- Record:
- Files: drivers/ata/libata-pmp.c (+6, -1)
- Function: sata_pmp_quirks()
- Scope: Single-file, surgical quirk addition (~7 lines net)
**Step 2.2 — Code flow change**
- Record:
- **Before:** JMicron vendor 0x197b quirk applied only to device IDs
`0x2352` (JMB350) and `0x0325` (JMB394)
- **After:** Same quirk also applied to 0x0562 (JMS562)
- **Affected path:** PMP attach → sata_pmp_quirks() → per-link flags set at initialization, before normal I/O
- **Flags set:** ATA_LFLAG_NO_LPM | ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA on all fan-out links
**Step 2.3 — Bug mechanism**
- Record:
- **Category:** Hardware workaround / logic correctness fix
- **Mechanism:** Without quirk, libata performs softreset (SRST) and link classification on a device that legitimately reports "not ready" during RAID rebuild. SRST/classify timeouts trigger error recovery that disables the link before the RAID volume becomes available. Quirk prevents SRST and assumes ATA class, matching proven JMicron PMP behavior.
**Step 2.4 — Fix quality**
- Record:
- Obviously correct: extends an existing, proven quirk pattern for the same vendor
- Minimal scope: one device ID + comment
- Low regression risk: only affects JMS562 PMP hardware; flags mirror those already used for sibling JMicron chips
- No API, structure, or behavioral changes beyond this device
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
- Record:
- JMicron quirk block introduced by 0afc6f5ba9541 (2011, Thermaltake BlackX Duet / JMB350)
- JMB394 added by efb9e0f4f4378 (2014) — that commit included `Cc:
[email protected]`
- Current tree has the quirk for 0x2352 and 0x0325 but not
`0x0562`
- Bug is not from a recent regression — it's a missing quirk for hardware that was never covered
**Step 3.2 — Fixes: tag**
- Record: No Fixes: tag present; not applicable.
**Step 3.3 — Related file history**
- Record:
- Recent libata-pmp.c changes in this tree are unrelated (FBS/CBS defer, tracepoints, spelling)
- Commit c62aff1174cf8 is the only mainline change to this quirk block since v6.18
- Standalone: v2 submission notes "sent as [PATCH 6/6], but this is a standalone patch"
**Step 3.4 — Author context**
- Record: Xu Rao (UnionTech) — first ATA contribution in this tree. Patch reviewed and committed by libata maintainers (Damien Le Moal, Niklas Cassel).
**Step 3.5 — Dependencies**
- Record: No dependencies. git apply --check against current tree succeeds. Quirk infrastructure and target else if block both exist in v6.18.44.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
- Record:
- Lore URL: https://patch.msgid.link/71B4D0BBEC4F886F+20260610052835.1
[email protected]
- Series: v1 as [PATCH 6/6], v2 as standalone [PATCH v2] (committed version)
- Damien Le Moal: "It is really unfortunate that JMicron keeps having these issues. But I do not see any way around this" → Reviewed-by:
- No NAKs found
- No explicit stable nomination in thread
**Step 4.2 — Reviewers**
- Record: CC'd to [email protected], [email protected], linux- [email protected]. Reviewed by libata maintainer Damien Le Moal.
**Step 4.3 — Bug report**
- Record: Real-world hardware bug on QNAP QDA-A2AR; concrete dmesg log in commit message. No external bug tracker link. Severity for affected
users: cannot boot when root is on rebuilding RAID volume.
**Step 4.4 — Related patches**
- Record: Originally part of a 6-patch series but maintainer confirmed v2 is standalone with no code changes from v1. No other series patches required.
**Step 4.5 — Stable list history**
- Record: No stable-list discussion found for this specific fix.
Precedent: JMB394 quirk (efb9e0f4f4378) was explicitly nominated for stable.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
- Record: sata_pmp_quirks() (modified), called from sata_pmp_attach()
**Step 5.2 — Callers**
- Record:
- sata_pmp_attach() defined in libata-pmp.c, called from libata- eh.c during error-handling/recovery when attaching a PMP device
- Triggered during SATA PMP enumeration at boot or hot-plug
**Step 5.3 — Callees**
- Record: Uses sata_pmp_gscr_vendor(), sata_pmp_gscr_devid(), ata_for_each_link() — all standard libata PMP helpers
**Step 5.4 — Reachability**
- Record: Triggered whenever a JMicron JMS562 PMP is detected. Affects boot path for systems using QNAP QDA-A2AR as root storage. Not userspace-triggerable directly, but affects every boot on affected hardware.
**Step 5.5 — Similar patterns**
- Record: Identical quirk pattern already used for JMB350 (0x2352) and JMB394 (0x0325) in the same function. Same vendor, same flags, same failure mode (SRST breaks detection).
---
## Phase 6: Cross-Reference Against Local Tree
**Step 6.1 — Buggy code present?**
- Record:
- Local tree: **v6.18.44** (git describe HEAD)
- Commit c62aff1174cf8 is **NOT** in this tree (git merge-base --is-ancestor → NOT)
- Buggy code **exists**: lines 460–472 of drivers/ata/libata-pmp.c
have JMicron quirk without `0x0562`
- JMicron quirk infrastructure present since v3.x era; bug is absence of device ID, not post-branch regression
**Step 6.2 — Backport complications**
- Record: Clean apply confirmed (git apply --check passes). No conflicting changes to this hunk in v6.18.y. Expected difficulty:
**clean apply**.
**Step 6.3 — Related fixes already present?**
- Record: No existing fix for JMS562 in this tree. git log --grep="JMS562" returns nothing.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 — Subsystem**
- Record: drivers/ata/ — libata PMP (Port Multiplier). Criticality:
**IMPORTANT** (storage/boot path for affected hardware).
**Step 7.2 — Activity**
- Record: Mature subsystem with occasional quirk additions. PMP quirk table is stable; changes are typically small device-ID additions.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
- Record: Users of QNAP QDA-A2AR RAID1 adapters (JMicron JMS562 PMP) booting from or accessing RAID volumes during rebuild. Driver- specific, but impact is total for those users (unbootable system).
**Step 8.2 — Trigger conditions**
- Record: Boot or PMP attach while JMS562-managed RAID array is rebuilding. Reproducible on affected hardware per commit message. Not timing-dependent race — deterministic behavior mismatch.
**Step 8.3 — Failure severity**
- Record: Link disabled → storage unavailable → root filesystem not found. **Severity: CRITICAL** for affected users (unbootable system, potential data access loss during recovery window).
**Step 8.4 — Risk-benefit**
- Record:
- **Benefit: HIGH** — restores bootability on real hardware with documented failure mode
- **Risk: VERY LOW** — 7-line quirk addition, scoped to one PCI device ID, mirrors existing proven quirk
- **Ratio: Strongly favors backport**
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
FOR backport:
- Real hardware bug with concrete dmesg and boot failure
- Hardware quirk/workaround — explicit stable exception category
- Small, surgical, obviously correct
- Reviewed by libata maintainer
- Applies cleanly to v6.18.44
- Standalone, no dependencies
- Precedent: prior JMicron PMP quirks backported to stable
AGAINST backport:
- Affects narrow hardware population (QNAP QDA-A2AR users)
- No syzbot/security angle
- No explicit stable nomination
UNRESOLVED: None material to the decision.
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — extends existing quirk; reviewed by maintainer
2. Fixes real bug affecting users? **PASS** — boot failure on QNAP QDA-A2AR
3. Important issue? **PASS** — unbootable system / root FS unavailable (CRITICAL for affected users)
4. Small and contained? **PASS** — 7 lines, one file
5. No new features or APIs? **PASS** — device quirk only
6. Can apply to local tree? **PASS** — clean apply verified; prerequisite code present
**Step 9.3 — Exception category**
- Record: **Hardware quirk/workaround** — adding device ID 0x0562 to existing JMicron PMP quirk table
**Step 9.4 — Decision rationale**
This commit adds the JMicron JMS562 (0x0562) to an existing, well- tested PMP quirk block in sata_pmp_quirks(). Without it, libata's softreset and link-recovery logic on the QNAP QDA-A2AR adapter can disable the fan-out link during RAID rebuild, preventing the root filesystem from appearing at boot. The fix is minimal, matches the pattern used for other JMicron chips since 2011, applies cleanly to the v6.18.44 tree, and was reviewed by the libata maintainer. This is textbook stable material: a hardware-specific workaround for a serious, reproducible boot failure.
---
## Verification
- [Phase 1] Parsed commit c62aff1174cf8: subject, body, tags (Reviewed-by: Damien Le Moal; no Fixes/Reported-by/stable tags)
- [Phase 2] Diff: +6/-1 in sata_pmp_quirks(), adds devid == 0x0562 to JMicron quirk
- [Phase 3] git blame -L 460,472: quirk block from 2011/2014 commits; JMS562 not present
- [Phase 3] git show efb9e0f4f4378: JMB394 quirk had `Cc:
[email protected]`
- [Phase 3] git merge-base --is-ancestor c62aff1174cf8 HEAD: commit NOT in tree
- [Phase 3] git apply --check on commit diff: applies cleanly
- [Phase 4] b4 dig -c c62aff1174cf8: found lore thread
- [Phase 4] b4 dig -a: v1 as patch 6/6, v2 standalone (committed version)
- [Phase 4] b4 dig -w: CC'd dlemoal, cassel, linux-ide
- [Phase 4] mbox: Damien Le Moal Reviewed-by, no NAKs, v2 confirmed standalone
- [Phase 5] grep sata_pmp_attach: caller in libata-eh.c:3379
- [Phase 5] Read include/linux/libata.h: confirmed flag meanings for NO_SRST, ASSUME_ATA, NO_LPM
- [Phase 6] git describe HEAD: v6.18.44
- [Phase 6] Read drivers/ata/libata-pmp.c:460-472: buggy code (missing 0x0562) confirmed present
- [Phase 6] git log v6.18..master -- drivers/ata/libata-pmp.c: only this commit touches quirk block
- [Phase 8] Commit message dmesg: softreset failure → link disabled → root FS not found
**YES**
drivers/ata/libata-pmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-pmp.c +6 -1
@@ -457,8 +457,13 @@ static void sata_pmp_quirks(struct ata_port *ap)* otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links -1 ].flags |=ATA_LFLAG_NO_RETRY ; - }else if (vendor ==0x197b && (devid ==0x2352 || devid ==0x0325 )) { + }else if (vendor ==0x197b && + (devid ==0x0562 || devid ==0x2352 || devid ==0x0325 )) {/* +* 0x0562: JMicron JMS562, as used in QNAP QDA-A2AR RAID1 +* adapters. The exported device may stay not ready +* while the array is rebuilding, and SRST/classify can +* time out before the RAID volume is exported. * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? * 0x0325: jmicron JMB394. */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 clk: samsung: exynos990: Fix PERIC0/1 USI clock types
In reply to Sasha LevinFrom: Denzeel Oliva <[email protected]>
[ Upstream commit e11560b050ce867bd7d3ccea138231db54e2250a ]
Use nMUX() for USI and UART user muxes to allow reparenting between OSC and CMU IP output when changing rates, and use DIV_F() with CLK_SET_RATE_PARENT on their dividers and gates so rate requests propagate upward.
Consolidate identical USI parent arrays into shared mout_peric0_nonbususer_p and mout_peric1_nonbususer_p.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: clk: samsung: exynos990: Fix PERIC0/1 USI clock types
**Local tree:** v6.18.44 (Linux 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject line**
Record: [clk: samsung: exynos990] [Fix] — Correct PERIC0/1 USI clock types (mux/div clock framework flags).
**Step 1.2 — Tags**
Record:
- Signed-off-by: Denzeel Oliva <[email protected]> (author)
- `Link: https://patch.msgid.link/20260528-perics-
[email protected]`
- Signed-off-by: Krzysztof Kozlowski <[email protected]> (clk/samsung maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, `Cc:
[email protected]`
Notable: maintainer commit; no fuzzer or user bug reports.
**Step 1.3 — Body analysis**
Record:
- **Bug:** PERIC0/1 USI and UART user muxes use MUX() (CLK_SET_RATE_NO_REPARENT) and plain DIV() without CLK_SET_RATE_PARENT, so rate changes cannot reparent between oscclk and dout_cmu_peric*_ip, and rate requests do not propagate up the tree.
- **Symptom:** USI peripherals (UART/SPI/I2C via Samsung USI blocks) and UART debug cannot get correct clock rates when drivers call clk_set_rate().
- **Root cause:** Wrong clock-type macros at PERIC bring-up (author's earlier PERIC0/1 commit).
- **Version info:** None explicit; bug introduced when PERIC0/1 support landed in 6.18.
**Step 1.4 — Hidden bug fix?**
Record: **Yes.** Despite "Fix" in the subject, this is a functional clock-tree correctness bug, not cosmetic cleanup. Same class of bug fixed earlier on GS101 (7b54d9113cd49).
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record:
- **File:** drivers/clk/samsung/clk-exynos990.c only (+143 / −164 lines, net −21)
- **Functions/sections:** peric0_mux_clks[], peric0_div_clks[], peric1_mux_clks[], peric1_div_clks[], parent-name arrays
- **Scope:** Single-file, mechanical clock registration fix
**Step 2.2 — Code flow per hunk**
Record:
- **PERIC0/1 parent arrays:** 11+12 duplicate PNAME() arrays → 2 shared mout_peric*_nonbususer_p arrays (no behavior change).
- **Mux clocks:** MUX() → nMUX() for UART_DBG and all USI user muxes. Before: reparenting blocked on rate change. After: reparenting between OSC (~24.5 MHz) and CMU IP output allowed.
- **Div clocks:** DIV() → DIV_F(..., CLK_SET_RATE_PARENT, 0) for all USI dividers. Before: rate requests stopped at divider. After:
propagate to parent mux.
- **Gates:** unchanged (commit message mentions gates, but diff does not modify GATE() entries).
**Step 2.3 — Bug mechanism**
Record: **Logic / correctness fix** in clock framework registration.
- MUX() sets CLK_SET_RATE_NO_REPARENT (see clk.h line 145).
- nMUX() clears that flag (line 151–152).
- DIV_F() with CLK_SET_RATE_PARENT enables upward rate propagation.
- Category: hardware clock configuration bug; analogous to GS101 PERIC0 USI SPI fix.
**Step 2.4 — Fix quality**
Record:
- **Obviously correct:** Matches established GS101 pattern for the same IP block family.
- **Minimal:** Only affected clocks changed; parent arrays consolidated.
- **Regression risk:** Low — enables intended CCF behavior; no API or structural changes.
- **Note:** Commit message overstates gate changes; gates remain plain GATE() without CLK_SET_RATE_PARENT (unlike GS101). Maintainer accepted as-is.
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 — Blame**
Record: Buggy MUX(CLK_MOUT_PERIC0_USI00_USI_USER, ...) introduced in b3b314ef13e46 (Denzeel Oliva, 2025-09-04) — "Add PERIC0 and PERIC1 clock support". Present since v6.18.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag. Originating commit b3b314ef13e46 is an ancestor of v6.18.44.
**Step 3.3 — Related file history**
Record:
- bdd03ebf721f7 (2024-12-14): Introduce Exynos990 clock driver
- b3b314ef13e46 (2025-09-07): Add PERIC0/PERIC1 — introduced bug
- 44b0a8e433aaa: Enable PERIC0/PERIC1 in exynos990 DT
- Fix commit e11560b050ce8 is the only change to this file between v6.18.44 and mainline
- Standalone 1/1 patch, no series dependencies
**Step 3.4 — Author context**
Record: Denzeel Oliva authored both PERIC bring-up and this fix. Krzysztof Kozlowski (samsung-clk maintainer) committed it.
**Step 3.5 — Prerequisites**
Record: No dependencies. nMUX, DIV_F, and CLK_SET_RATE_PARENT all exist in this tree's drivers/clk/samsung/clk.h. Patch applies cleanly (git apply --check passed).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 — Original discussion**
Record:
- b4 dig -c e11560b050ce8 → https://patch.msgid.link/20260528-perics-
[email protected]
- Single-patch series (v1, 1/1)
- Krzysztof Kozlowski: "Applied, thanks!" — no review thread, no stable nomination, no NAKs
**Step 4.2 — Reviewers**
Record: CC'd Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi, Alim Akhtar, Michael Turquette, Stephen Boyd, Brian Masney; lists linux- clk, linux-samsung-soc, linux-arm-kernel.
**Step 4.3 — Bug reports**
Record: N/A — no Reported-by: or bugzilla/syzbot links.
**Step 4.4 — Related patches**
Record: Direct precedent — 7b54d9113cd49 "clk: samsung: gs101:
propagate PERIC0 USI SPI clock rate" documents identical mechanism (nMUX
+ DIV_F + GATE CLK_SET_RATE_PARENT for USI on GS101 PERIC0).
**Step 4.5 — Stable list**
Record: No stable-list discussion found for this patch.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Key symbols**
Record: PERIC0/1 mux/div clock tables in clk-exynos990.c; no new functions.
**Step 5.2 — Callers**
Record: Clocks registered at init via exynos990 CMU probe; consumed at runtime by device drivers via clk_get() / clk_set_rate(). PERIC0/1 CMUs are enabled in exynos990.dtsi (cmu_peric0, cmu_peric1).
**Step 5.3 — Callees**
Record: Samsung CCF helpers (samsung_clk_register_mux, samsung_clk_register_div); standard Linux common clock framework rate/recalc paths.
**Step 5.4 — Reachability**
Record: Reachable when exynos990 drivers request peripheral clocks. USI device nodes are not yet in mainline exynos990 DTS, but PERIC clock controllers are live and UART_DBG mux is also fixed. Any future or out- of-tree USI/UART driver using these clocks hits the bug today.
**Step 5.5 — Similar patterns**
Record: GS101 PERIC0/1 USI clocks use nMUX + DIV_F(CLK_SET_RATE_PARENT) + GATE(..., CLK_SET_RATE_PARENT). Exynos850 CMGP USI uses MUX_F(CLK_SET_RATE_PARENT) + DIV_F(CLK_SET_RATE_PARENT). Exynos990 PERIC was the outlier using plain MUX/DIV.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (v6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Current HEAD still has MUX() for USI user muxes and DIV() for USI dividers (e.g. lines 1568–1640). Fix commit e11560b050ce8 is **not** in HEAD. Bug introduced in 6.18 with PERIC support.
**Step 6.2 — Backport complications**
Record: **Clean apply** — git apply --check on e11560b050ce8 patch succeeded against HEAD. Only one intervening commit on this file between v6.18.44 and the fix.
**Step 6.3 — Related fixes already present?**
Record: **No** equivalent fix in this tree.
---
## PHASE 7: SUBSYSTEM CONTEXT
**Step 7.1 — Subsystem / criticality**
Record: drivers/clk/samsung — **PERIPHERAL** (Exynos990 platform- specific), but PERIC clocks underpin UART/SPI/I2C for the SoC.
**Step 7.2 — Activity**
Record: exynos990 clk driver actively developed; PERIC support added in 6.18 cycle.
---
## PHASE 8: IMPACT AND RISK
**Step 8.1 — Who is affected**
Record: Exynos990 users (Galaxy S21 family boards: x1s, c1s, r8s, etc. in arch/arm64/boot/dts/exynos/). Config/platform-specific, not universal.
**Step 8.2 — Trigger conditions**
Record: Any driver calling clk_set_rate() on a PERIC0/1 USI or UART_DBG clock. Common during SPI/UART/I2C device probe and transfer setup. Not security-relevant; unprivileged users cannot trigger directly.
**Step 8.3 — Failure mode severity**
Record: **Incorrect clock rates** → peripheral probe failure, wrong baud/SPI timing, device malfunction. **Severity: MEDIUM** (functional hardware breakage, not kernel crash/oops/corruption).
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** Fixes a regression introduced in 6.18 itself; unblocks correct USI/UART clock operation on exynos990; matches proven GS101 fix pattern.
- **Risk:** Very low — declarative flag changes only, clean apply, maintainer-reviewed.
- **Ratio:** Favorable for 6.18.y where the buggy PERIC code already shipped.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 — Evidence summary**
**FOR:**
- Real functional bug in clock registration
- Bug introduced in this stable series (6.18) with PERIC0/1 support
- Buggy code confirmed present in v6.18.44
- Small, mechanical, obviously correct fix
- Clean apply, no dependencies
- Direct precedent (GS101 USI clock fix)
- Samsung clk maintainer committed
**AGAINST:**
- No crash/security/corruption — functional hardware issue only
- No user reports, syzbot, or Tested-by
- exynos990 USI device nodes not yet in mainline DTS (limited immediate impact)
- Commit message inaccurately claims gate changes that aren't in the diff
- Platform-specific, narrow user base on mainline stable
**Unresolved:** Whether gate clocks also need CLK_SET_RATE_PARENT (as on GS101) — not addressed by this commit; maintainer accepted without gate changes.
**Step 9.2 — Stable rules checklist**
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — matches GS101 pattern; no Tested-by | | 2. Fixes real bug affecting users? | **PASS** — broken clock rate setting for USI/UART | | 3. Important issue? | **PASS** (borderline) — MEDIUM severity hardware functionality bug, regression in 6.18 | | 4. Small and contained? | **PASS** — single file, mechanical | | 5. No new features/APIs? | **PASS** — corrects existing clock flags only | | 6. Applies to local tree? | **PASS** — clean apply verified |
**Step 9.3 — Exception categories**
Record: N/A — not a device ID, quirk, DT, build, or docs fix. Standard driver correctness fix.
**Step 9.4 — Decision rationale**
This is a regression fix for code that shipped broken in Linux 6.18. The PERIC0/1 USI and UART mux/div clocks were registered with flags that prevent the common clock framework from reparenting and propagating rate changes — exactly the problem documented and fixed on GS101. For the v6.18.44 tree, the buggy code is present, the fix applies cleanly, and exynos990 platform support (including PERIC CMUs in DT) is already in this release. While severity is functional rather than a kernel crash, correcting a driver bug introduced in the same stable series is appropriate stable material.
---
## Verification
- [Phase 1] Parsed subject, tags, body from provided commit message
- [Phase 2] Read clk.h lines 144–198: confirmed MUX() = CLK_SET_RATE_NO_REPARENT, nMUX() allows reparenting, DIV_F() supports CLK_SET_RATE_PARENT
- [Phase 2] Full diff via git show e11560b050ce8: 143+/164−, no gate changes despite message claim
- [Phase 3] git describe HEAD → v6.18.44; Makefile → 6.18.44
- [Phase 3] git blame lines 1568–1570 → b3b314ef13e46 introduced buggy MUX
- [Phase 3] git merge-base --is-ancestor b3b314ef13e46 v6.18.44 → PERIC0 in tree; fix NOT in HEAD
- [Phase 3] git tag --contains b3b314ef13e46 | grep v6.18 → present since v6.18-rc1
- [Phase 3] git show 7b54d9113cd49 — GS101 precedent with detailed USI/SPI clk_set_rate explanation
- [Phase 4] b4 dig -c e11560b050ce8 → lore URL found
- [Phase 4] b4 dig -w → maintainers CC'd
- [Phase 4] /tmp/perics-usi.mbx — only maintainer "Applied, thanks!" reply; no stable nomination
- [Phase 5] Grep exynos990 DTS — cmu_peric0/cmu_peric1 enabled; no USI device nodes yet
- [Phase 5] Grep clk-gs101.c — CLK_SET_RATE_PARENT on USI mux/div/gate clocks
- [Phase 6] Grep current tree — buggy MUX()/DIV() still present at lines 1565–1640, 2123+
- [Phase 6] git apply --check of fix patch against HEAD → clean apply
- [Phase 6] git log v6.18.44..e11560b050ce8 -- clk-exynos990.c → 1 commit (the fix)
- [Phase 8] Failure mode assessed as MEDIUM (functional), not CRITICAL (no oops/corruption)
**YES**The background searches finished and line up with the earlier analysis:
- **PERIC0 history:** Buggy PERIC0/1 support came in with b3b314ef13e46 ("Add PERIC0 and PERIC1 clock support"), which is in this v6.18.44 tree.
- **Fix commit:** The fix is e11560b050ce8 on mainline; it is **not** in the checked-out v6.18.44 tree yet.
- **GS101 precedent:** 7b54d9113cd49 ("propagate PERIC0 USI SPI clock rate") is the same class of fix and is present in this tree's history.
That supports the earlier verdict: **YES** for backport to this 6.18.y tree.
drivers/clk/samsung/clk-exynos990.c | 307 +++++++++++++--------------- 1 file changed, 143 insertions(+), 164 deletions(-)
drivers/clk/samsung/clk-exynos990.c +143 -164
@@ -1546,54 +1546,44 @@ static const unsigned long peric0_clk_regs[] __initconst = {/* Parent clock list for CMU_PERIC0 muxes */ PNAME (mout_peric0_bus_user_p) = {"oscclk" ,"dout_cmu_peric0_bus" }; -PNAME (mout_peric0_uart_dbg_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi00_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi01_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi02_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi03_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi04_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi05_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi13_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi14_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi15_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; -PNAME (mout_peric0_usi_i2c_user_p) = {"oscclk" ,"dout_cmu_peric0_ip" }; +PNAME (mout_peric0_nonbususer_p) = {"oscclk" ,"dout_cmu_peric0_ip" };static const struct samsung_mux_clock peric0_mux_clks[]__initconst = {MUX (CLK_MOUT_PERIC0_BUS_USER ,"mout_peric0_bus_user" , mout_peric0_bus_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_BUS_USER ,4 ,1 ), -MUX (CLK_MOUT_PERIC0_UART_DBG ,"mout_peric0_uart_dbg" , - mout_peric0_uart_dbg_p,PLL_CON0_MUX_CLKCMU_PERIC0_UART_DBG , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI00_USI_USER ,"mout_peric0_usi00_usi_user" , - mout_peric0_usi00_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI00_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI01_USI_USER ,"mout_peric0_usi01_usi_user" , - mout_peric0_usi01_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI01_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI02_USI_USER ,"mout_peric0_usi02_usi_user" , - mout_peric0_usi02_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI02_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI03_USI_USER ,"mout_peric0_usi03_usi_user" , - mout_peric0_usi03_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI03_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI04_USI_USER ,"mout_peric0_usi04_usi_user" , - mout_peric0_usi04_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI04_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI05_USI_USER ,"mout_peric0_usi05_usi_user" , - mout_peric0_usi05_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI05_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI13_USI_USER ,"mout_peric0_usi13_usi_user" , - mout_peric0_usi13_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI13_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI14_USI_USER ,"mout_peric0_usi14_usi_user" , - mout_peric0_usi14_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI14_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC0_USI15_USI_USER ,"mout_peric0_usi15_usi_user" , - mout_peric0_usi15_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI15_USI_USER , -4 ,1 ), +nMUX (CLK_MOUT_PERIC0_UART_DBG ,"mout_peric0_uart_dbg" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_UART_DBG , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI00_USI_USER ,"mout_peric0_usi00_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI00_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI01_USI_USER ,"mout_peric0_usi01_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI01_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI02_USI_USER ,"mout_peric0_usi02_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI02_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI03_USI_USER ,"mout_peric0_usi03_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI03_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI04_USI_USER ,"mout_peric0_usi04_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI04_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI05_USI_USER ,"mout_peric0_usi05_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI05_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI13_USI_USER ,"mout_peric0_usi13_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI13_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI14_USI_USER ,"mout_peric0_usi14_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI14_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC0_USI15_USI_USER ,"mout_peric0_usi15_usi_user" , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI15_USI_USER , +4 ,1 ),MUX (CLK_MOUT_PERIC0_USI_I2C_USER ,"mout_peric0_usi_i2c_user" , - mout_peric0_usi_i2c_user_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI_I2C_USER , + mout_peric0_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC0_USI_I2C_USER ,4 ,1 ), };
@@ -1602,42 +1592,42 @@ static const struct samsung_div_clock peric0_div_clks[] __initconst = { "mout_peric0_uart_dbg", CLK_CON_DIV_DIV_CLK_PERIC0_UART_DBG, 0, 4), -DIV (CLK_DOUT_PERIC0_USI00_USI ,"dout_peric0_usi00_usi" , -"mout_peric0_usi00_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI00_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI01_USI ,"dout_peric0_usi01_usi" , -"mout_peric0_usi01_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI01_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI02_USI ,"dout_peric0_usi02_usi" , -"mout_peric0_usi02_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI02_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI03_USI ,"dout_peric0_usi03_usi" , -"mout_peric0_usi03_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI03_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI04_USI ,"dout_peric0_usi04_usi" , -"mout_peric0_usi04_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI04_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI05_USI ,"dout_peric0_usi05_usi" , -"mout_peric0_usi05_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI05_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI13_USI ,"dout_peric0_usi13_usi" , -"mout_peric0_usi13_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI13_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI14_USI ,"dout_peric0_usi14_usi" , -"mout_peric0_usi14_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI14_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC0_USI15_USI ,"dout_peric0_usi15_usi" , -"mout_peric0_usi15_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC0_USI15_USI , -0 ,4 ), +DIV_F (CLK_DOUT_PERIC0_USI00_USI ,"dout_peric0_usi00_usi" , +"mout_peric0_usi00_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI00_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI01_USI ,"dout_peric0_usi01_usi" , +"mout_peric0_usi01_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI01_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI02_USI ,"dout_peric0_usi02_usi" , +"mout_peric0_usi02_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI02_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI03_USI ,"dout_peric0_usi03_usi" , +"mout_peric0_usi03_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI03_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI04_USI ,"dout_peric0_usi04_usi" , +"mout_peric0_usi04_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI04_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI05_USI ,"dout_peric0_usi05_usi" , +"mout_peric0_usi05_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI05_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI13_USI ,"dout_peric0_usi13_usi" , +"mout_peric0_usi13_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI13_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI14_USI ,"dout_peric0_usi14_usi" , +"mout_peric0_usi14_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI14_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC0_USI15_USI ,"dout_peric0_usi15_usi" , +"mout_peric0_usi15_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC0_USI15_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), DIV(CLK_DOUT_PERIC0_USI_I2C, "dout_peric0_usi_i2c", "mout_peric0_usi_i2c_user", CLK_CON_DIV_DIV_CLK_PERIC0_USI_I2C,
@@ -2107,58 +2097,47 @@ static const unsigned long peric1_clk_regs[] __initconst = {/* Parent clock list for CMU_PERIC1 muxes */ PNAME (mout_peric1_bus_user_p) = {"oscclk" ,"dout_cmu_peric1_bus" }; -PNAME (mout_peric1_uart_bt_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi06_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi07_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi08_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi09_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi10_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi11_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi12_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi18_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi16_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi17_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; -PNAME (mout_peric1_usi_i2c_user_p) = {"oscclk" ,"dout_cmu_peric1_ip" }; +PNAME (mout_peric1_nonbususer_p) = {"oscclk" ,"dout_cmu_peric1_ip" };static const struct samsung_mux_clock peric1_mux_clks[]__initconst = {MUX (CLK_MOUT_PERIC1_BUS_USER ,"mout_peric1_bus_user" , mout_peric1_bus_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_BUS_USER ,4 ,1 ), -MUX (CLK_MOUT_PERIC1_UART_BT_USER ,"mout_peric1_uart_bt_user" , - mout_peric1_uart_bt_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_UART_BT_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI06_USI_USER ,"mout_peric1_usi06_usi_user" , - mout_peric1_usi06_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI06_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI07_USI_USER ,"mout_peric1_usi07_usi_user" , - mout_peric1_usi07_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI07_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI08_USI_USER ,"mout_peric1_usi08_usi_user" , - mout_peric1_usi08_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI08_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI09_USI_USER ,"mout_peric1_usi09_usi_user" , - mout_peric1_usi09_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI09_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI10_USI_USER ,"mout_peric1_usi10_usi_user" , - mout_peric1_usi10_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI10_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI11_USI_USER ,"mout_peric1_usi11_usi_user" , - mout_peric1_usi11_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI11_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI12_USI_USER ,"mout_peric1_usi12_usi_user" , - mout_peric1_usi12_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI12_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI18_USI_USER ,"mout_peric1_usi18_usi_user" , - mout_peric1_usi18_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI18_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI16_USI_USER ,"mout_peric1_usi16_usi_user" , - mout_peric1_usi16_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI16_USI_USER , -4 ,1 ), -MUX (CLK_MOUT_PERIC1_USI17_USI_USER ,"mout_peric1_usi17_usi_user" , - mout_peric1_usi17_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI17_USI_USER , -4 ,1 ), +nMUX (CLK_MOUT_PERIC1_UART_BT_USER ,"mout_peric1_uart_bt_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_UART_BT_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI06_USI_USER ,"mout_peric1_usi06_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI06_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI07_USI_USER ,"mout_peric1_usi07_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI07_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI08_USI_USER ,"mout_peric1_usi08_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI08_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI09_USI_USER ,"mout_peric1_usi09_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI09_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI10_USI_USER ,"mout_peric1_usi10_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI10_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI11_USI_USER ,"mout_peric1_usi11_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI11_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI12_USI_USER ,"mout_peric1_usi12_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI12_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI18_USI_USER ,"mout_peric1_usi18_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI18_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI16_USI_USER ,"mout_peric1_usi16_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI16_USI_USER , +4 ,1 ), +nMUX (CLK_MOUT_PERIC1_USI17_USI_USER ,"mout_peric1_usi17_usi_user" , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI17_USI_USER , +4 ,1 ),MUX (CLK_MOUT_PERIC1_USI_I2C_USER ,"mout_peric1_usi_i2c_user" , - mout_peric1_usi_i2c_user_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI_I2C_USER , + mout_peric1_nonbususer_p,PLL_CON0_MUX_CLKCMU_PERIC1_USI_I2C_USER ,4 ,1 ), };
@@ -2167,46 +2146,46 @@ static const struct samsung_div_clock peric1_div_clks[] __initconst = { "mout_peric1_uart_bt_user", CLK_CON_DIV_DIV_CLK_PERIC1_UART_BT, 0, 4), -DIV (CLK_DOUT_PERIC1_USI06_USI ,"dout_peric1_usi06_usi" , -"mout_peric1_usi06_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI06_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI07_USI ,"dout_peric1_usi07_usi" , -"mout_peric1_usi07_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI07_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI08_USI ,"dout_peric1_usi08_usi" , -"mout_peric1_usi08_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI08_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI18_USI ,"dout_peric1_usi18_usi" , -"mout_peric1_usi18_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI18_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI12_USI ,"dout_peric1_usi12_usi" , -"mout_peric1_usi12_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI12_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI09_USI ,"dout_peric1_usi09_usi" , -"mout_peric1_usi09_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI09_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI10_USI ,"dout_peric1_usi10_usi" , -"mout_peric1_usi10_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI10_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI11_USI ,"dout_peric1_usi11_usi" , -"mout_peric1_usi11_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI11_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI16_USI ,"dout_peric1_usi16_usi" , -"mout_peric1_usi16_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI16_USI , -0 ,4 ), -DIV (CLK_DOUT_PERIC1_USI17_USI ,"dout_peric1_usi17_usi" , -"mout_peric1_usi17_usi_user" , -CLK_CON_DIV_DIV_CLK_PERIC1_USI17_USI , -0 ,4 ), +DIV_F (CLK_DOUT_PERIC1_USI06_USI ,"dout_peric1_usi06_usi" , +"mout_peric1_usi06_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI06_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI07_USI ,"dout_peric1_usi07_usi" , +"mout_peric1_usi07_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI07_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI08_USI ,"dout_peric1_usi08_usi" , +"mout_peric1_usi08_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI08_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI18_USI ,"dout_peric1_usi18_usi" , +"mout_peric1_usi18_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI18_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI12_USI ,"dout_peric1_usi12_usi" , +"mout_peric1_usi12_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI12_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI09_USI ,"dout_peric1_usi09_usi" , +"mout_peric1_usi09_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI09_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI10_USI ,"dout_peric1_usi10_usi" , +"mout_peric1_usi10_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI10_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI11_USI ,"dout_peric1_usi11_usi" , +"mout_peric1_usi11_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI11_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI16_USI ,"dout_peric1_usi16_usi" , +"mout_peric1_usi16_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI16_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_PERIC1_USI17_USI ,"dout_peric1_usi17_usi" , +"mout_peric1_usi17_usi_user" , +CLK_CON_DIV_DIV_CLK_PERIC1_USI17_USI ,0 ,4 , +CLK_SET_RATE_PARENT ,0 ), DIV(CLK_DOUT_PERIC1_USI_I2C, "dout_peric1_usi_i2c", "mout_peric1_usi_i2c_user", CLK_CON_DIV_DIV_CLK_PERIC1_USI_I2C,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The patch introduces a significant mismatch between the commit message and the code by failing…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch introduces a significant mismatch between the commit message and the code by failing to add the CLK_SET_RATE_PARENT flag to the UART dividers and leaf gate clocks. --
commit 2775b50651cf5053c13e282c77800e616a6622f6
Author: Denzeel Oliva <[email protected]>
clk: samsung: exynos990: Fix PERIC0/1 USI clock types
This commit changes USI and UART user muxes to use nMUX() to allow reparenting between OSC and CMU IP. It also updates USI dividers to use DIV_F() with CLK_SET_RATE_PARENT so rate requests propagate upward.
Quoted 4 lines
Use
nMUX()for USI and UART user muxes to allow reparenting between OSC and CMU IP output when changing rates, and useDIV_F()withCLK_SET_RATE_PARENTon their dividers and gates so rate requests propagate upward.
[Severity: Medium]
The commit message states that CLK_SET_RATE_PARENT is applied to both the dividers and the gates for USI and UART. However, the patch does not modify any of the leaf gate clocks (such as CLK_GOUT_PERIC0_TOP0_IPCLK_5 for USI or the UART gates) to include the CLK_SET_RATE_PARENT flag.
Without this flag on the gates, when a peripheral driver calls clk_set_rate() on the leaf gate clock provided by the device tree, clk_calc_new_rates() will return -EINVAL because the gate lacks the flag and has no .set_rate callback. Does this code also need to update the gate clocks to match the commit message and ensure upward rate requests propagate correctly?
drivers/clk/samsung/clk-exynos990.c static const struct samsung_div_clock peric0_div_clks[] __initconst = { · line 1595
Quoted 9 lines
drivers/clk/samsung/clk-exynos990.c +0
-0@@ -1602,42 +1592,42 @@ static const struct samsung_div_clock peric0_div_clks[] __initconst = {DIV (CLK_DOUT_PERIC0_UART_DBG ,"dout_peric0_uart_dbg" ,"mout_peric0_uart_dbg" ,CLK_CON_DIV_DIV_CLK_PERIC0_UART_DBG , 0, 4),
[Severity: Medium]
The commit message mentions applying DIV_F() and CLK_SET_RATE_PARENT to the UART dividers as well, but CLK_DOUT_PERIC0_UART_DBG is left as a standard DIV() here. Does this UART divider also need to be converted to DIV_F() with CLK_SET_RATE_PARENT so that its rate requests propagate upward?
[ ... ]
drivers/clk/samsung/clk-exynos990.c static const struct samsung_div_clock peric1_div_clks[] __initconst = { · line 2149
Quoted 5 lines
drivers/clk/samsung/clk-exynos990.c +0
-0@@ -2167,46 +2146,46 @@ static const struct samsung_div_clock peric1_div_clks[] __initconst = {DIV (CLK_DOUT_PERIC1_UART_BT ,"dout_peric1_uart_bt" ,"mout_peric1_uart_bt_user" ,CLK_CON_DIV_DIV_CLK_PERIC1_UART_BT , 0, 4),
[Severity: Medium]
Similarly, CLK_DOUT_PERIC1_UART_BT was left unmodified. Does this divider also need the CLK_SET_RATE_PARENT flag for rate propagation to function correctly?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 ACPICA: add boundary checks in acpi_ps_get_next_field()
In reply to Sasha LevinFrom: ikaros <[email protected]>
[ Upstream commit e15aa60de0256d63df2331bf5a4bc4dd287504cd ]
Add boundary checks in acpi_ps_get_next_field() to prevent out-of-bounds access.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ACPICA boundary checks in acpi_ps_get_next_field()
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [ACPICA] [add] boundary checks in acpi_ps_get_next_field() to prevent out-of-bounds access
### Step 1.2: Commit Message Tags
**Record:**
- **Link:** https://github.com/acpica/acpica/commit/c39183ea84bc
(upstream ACPICA commit)
- **Signed-off-by:** ikaros <[email protected]> (author)
- **Signed-off-by:** Rafael J. Wysocki <[email protected]> (ACPI maintainer)
- **Link:**
https://patch.msgid.link/[email protected] (Linux integration patch reference)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or Reviewed-by: tags
- Notable: upstream ACPICA issue **#1125** with ASAN heap-buffer- overflow report and reproducible acpiexec test case
### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** acpi_ps_get_next_field() reads AML bytes without verifying they remain within the AML buffer (aml_end)
- **Symptom:** Heap-buffer-overflow (ASAN) when parsing malformed/truncated ACPI AML field lists
- **Root cause:** Reads of 1, 2, and 4 bytes proceed without checking parser_state->aml_end; caller loop uses pkg_end, which can extend past aml_end on corrupt package-length encoding
- **Version info:** None in commit message; bug exists in long-standing code (function dates to 2005)
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not disguised — explicitly a defensive boundary-check fix for out-of-bounds memory access. This is a real memory-safety bug fix, not cleanup.
---
## Phase 2: Diff Analysis
### Step 2.1: Change Inventory
**Record:**
- **File:** drivers/acpi/acpica/psargs.c (+20 / -0)
- **Function:** acpi_ps_get_next_field() only
- **Scope:** Single-file, surgical fix
### Step 2.2: Code Flow Changes
**Record:**
1. **Entry check:** Before any AML read, if aml >= parser_state->aml_end, return NULL
2. **Named field path:** Before 4-byte name read (ACPI_MOVE_32_TO_32), verify aml + ACPI_NAMESEG_SIZE <= aml_end; free allocated op on failure
3. **Access field path:** Before reading 2 bytes (type/attribute), verify aml + 2 <= aml_end; free op on failure
4. **Extended access field:** Before reading third byte (access_length), verify aml < aml_end; free op on failure
**Before → After:** Unbounded AML pointer advancement → bounded reads with graceful NULL return and proper acpi_ps_free_op() cleanup on post-allocation failures.
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Buffer overflow / out-of-bounds read (memory safety)
- **Mechanism:** On truncated or malformed AML, acpi_ps_get_next_field() advances parser_state->aml and reads past the end of the AML buffer. ASAN report confirms a 4-byte read past a 175-byte heap allocation at the named-field path.
### Step 2.4: Fix Quality
**Record:**
- Fix is minimal, follows existing aml_end semantics used elsewhere in ACPICA
- Properly frees field on error paths after acpi_ps_alloc_op() succeeds
- Does not cover every read in the function (e.g., AML_INT_CONNECTION_OP sub-paths, acpi_ps_get_next_package_length()), but addresses the ASAN-confirmed overflow sites
- Low regression risk; only adds early-exit guards on malformed input
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Core acpi_ps_get_next_field() logic introduced in 2005 (^1da177e4c3f4). Buggy unbounded-read pattern has been present since initial implementation. parser_state->aml_end field added long ago and is set in dswstate.c.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related File History
**Record:** Related recent fix in this tree:
- e6169a8ffee8a — "ACPICA: Fix memory leak if acpi_ps_get_next_field() fails" (April 2024)
- Ensures caller frees partial field list when acpi_ps_get_next_field() returns NULL
- Complements this fix: boundary failure returns NULL, and caller already handles that path
### Step 3.4: Author Context
**Record:** Author ikaros reported the bug via ACPICA GitHub issue #1125. Patch integrated by Rafael J. Wysocki (ACPI subsystem maintainer). No other commits from this author in the Linux ACPICA tree.
### Step 3.5: Dependencies
**Record:**
- Requires parser_state->aml_end in struct acpi_parse_state — **present** in this tree (aclocal.h:912)
- Requires ACPI_NAMESEG_SIZE — **present** (used at line 527)
- Requires acpi_ps_free_op() — **present**
- Standalone; no patch-series dependency
- **This commit is NOT yet in the local tree** (6.18.44); boundary checks absent from current psargs.c
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Discussion
**Record:**
- b4 dig -c c39183ea84bc — no match (hash is from upstream ACPICA repo, not Linux kernel)
- ACPICA GitHub issue #1125: detailed ASAN report, reproduction with acpiexec -m issue10.aml, fixed by commit c39183ea84bc
- lore.kernel.org — blocked by bot protection; could not fetch thread
### Step 4.2: Reviewers
**Record:** Rafael J. Wysocki signed off on Linux integration (per commit message). Full lore review thread unverified due to access block.
### Step 4.3: Bug Report
**Record:**
- **Severity:** Heap-buffer-overflow (ASAN), READ of 4 bytes past allocation boundary
- **Reproducible:** Yes, with crafted AML via acpiexec
- **Stack trace:** AcpiPsGetNextField → AcpiPsGetNextArg → AcpiPsGetArguments → AcpiPsParseLoop → AcpiPsParseAml → table load path
### Step 4.4: Related Patches
**Record:** Standalone fix. Related but separate: memory-leak fix e6169a8ffee8a already in this tree.
### Step 4.5: Stable List Discussion
**Record:** Could not verify stable-list discussion (lore blocked). Absence of prior stable nomination is not a negative signal per review guidelines.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** acpi_ps_get_next_field() (modified), called from acpi_ps_get_next_arg() for ARGP_FIELDLIST.
### Step 5.2: Callers
**Record:**
- acpi_ps_get_next_arg() — psargs.c:787, in ARGP_FIELDLIST case
- Called from acpi_ps_get_arguments() in psloop.c
- Reached during ACPI AML parsing: acpi_ps_execute_table() → acpi_ns_parse_table() → acpi_ns_load_table()
- **Context:** ACPI table load at boot (DSDT/SSDT) and dynamic table load paths
### Step 5.3: Callees
**Record:** ACPI_GET8(), ACPI_MOVE_32_TO_32(), acpi_ps_alloc_op(), acpi_ps_free_op(), acpi_ps_get_next_package_length(), acpi_ps_get_next_namestring()
### Step 5.4: Reachability
**Record:**
- Triggered when kernel parses ACPI AML containing malformed field lists
- ACPI tables come from firmware at boot on virtually all x86/ARM systems with ACPI
- Additional paths: CONFIG_ACPI_TABLE_UPGRADE, initrd ACPI override (tables.c), configfs (acpi_configfs.c) — root/privileged, but firmware-supplied tables are the primary real-world vector
- **Userspace trigger:** Indirect — via firmware/BIOS ACPI tables, not direct syscall; still kernel memory safety issue
### Step 5.5: Similar Patterns
**Record:** aml_end used as bound in psloop.c:300, dswexec.c:745, but **not** in acpi_ps_get_next_field() in this tree — this is a gap the fix addresses.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.44)
### Step 6.1: Buggy Code Present?
**Record:** **YES.** Current psargs.c at lines 474–586 performs unbounded reads in acpi_ps_get_next_field() with no aml_end checks. aml_end field exists and is initialized in dswstate.c:580–585.
### Step 6.2: Backport Complications
**Record:** git apply --check on the provided diff — **applies cleanly** to this tree. No conflicts expected.
### Step 6.3: Related Fixes Already Present? **Record:** Memory-leak companion fix e6169a8ffee8a is present. Boundary-check fix is **not** present.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem Criticality
**Record:** **drivers/acpi/acpica** — ACPI core parser. **Criticality:
CORE/IMPORTANT** — affects all ACPI-enabled systems during table parsing.
### Step 7.2: Subsystem Activity
**Record:** ACPICA receives periodic syncs from upstream; active maintenance by Rafael Wysocki's team. Recent related fix (memory leak) landed in 2024.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** All systems using ACPI (majority of PCs, servers, many ARM boards) when loading ACPI tables with malformed field-list AML.
### Step 8.2: Trigger Conditions
**Record:**
- Malformed/truncated ACPI DSDT/SSDT field definitions
- Most likely: buggy firmware ACPI tables; also crafted tables via override mechanisms
- Not every boot — requires specific AML corruption in field lists
- Unprivileged direct trigger unlikely; firmware is primary vector
### Step 8.3: Failure Mode Severity
**Record:**
- **Failure mode:** Out-of-bounds heap read during ACPI AML parsing
- **Severity: HIGH** — memory safety violation; potential info leak or crash during boot/table load; ASAN-confirmed
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit: HIGH** — prevents OOB read in widely-used ACPI parser
- **Risk: LOW** — 20-line additive guards, only affects malformed-input paths
- **Ratio:** Strongly favors backport
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real, ASAN-confirmed heap-buffer-overflow
- Fixes memory safety bug in ACPI core parser used at boot
- Small (+20 lines), single file, applies cleanly
- Signed off by ACPI maintainer (Rafael Wysocki)
- Complements existing memory-leak fix already in tree
- aml_end infrastructure already present — no structural dependency
**AGAINST backport:**
- Partial coverage (does not add bounds checks to all read paths in the function, e.g., connection-op sub-path)
- Trigger primarily via firmware ACPI tables (not direct userspace attack)
- NULL return on boundary failure reported as AE_NO_MEMORY by caller (pre-existing semantic imprecision, not introduced by this patch)
**Unresolved:**
- Full lore.kernel.org review thread not accessible
- Whether Linux mainline has merged this yet (not in 6.18.44)
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — straightforward bounds checks; ASAN-tested upstream via acpiexec/issue #1125
2. Fixes a real bug? **PASS** — confirmed heap-buffer-overflow
3. Important issue? **PASS** — OOB read in kernel ACPI parser (HIGH severity)
4. Small and contained? **PASS** — +20 lines, one function, one file
5. No new features/APIs? **PASS** — defensive checks only
6. Can apply to local tree? **PASS** — verified clean apply; prerequisites present
### Step 9.3: Exception Category
**Record:** N/A — standard memory-safety bug fix, not a device- ID/quirk/DT/build/doc exception.
### Step 9.4: Decision Rationale
This commit fixes a confirmed out-of-bounds heap read in the ACPI AML field parser — a core subsystem path exercised during every ACPI table load. The fix is minimal, uses existing aml_end bounds infrastructure, applies cleanly to Linux 6.18.44, and is signed off by the ACPI maintainer. While the primary trigger is malformed firmware ACPI tables rather than direct userspace input, heap buffer overflows in kernel parsers are exactly the class of fixes stable trees exist to deliver. The companion memory-leak fix is already in this tree, making the NULL- return error path safe.
---
## Verification
- **[Phase 1]** Parsed commit message and tags; confirmed ASAN report via ACPICA GitHub issue #1125
- **[Phase 1]** Identified subsystem (ACPICA), action (add boundary checks), bug type (OOB access)
- **[Phase 2]** Diff analysis: +20 lines in acpi_ps_get_next_field(), 4 boundary-check insertion points
- **[Phase 2]** Read current psargs.c:457-686 — confirmed buggy code without bounds checks
- **[Phase 3]** git describe HEAD → v6.18.44; make kernelversion → 6.18.44
- **[Phase 3]** git blame on lines 474–590: function code from 2005, long-standing vulnerability
- **[Phase 3]** git log --oneline -20 -- drivers/acpi/acpica/psargs.c:
found related fix e6169a8ffee8a
- **[Phase 3]** git show e6169a8ffee8a: memory-leak fix on NULL return from same function
- **[Phase 3]** git log --grep="boundary checks in acpi_ps_get_next_field": no match — fix not in tree
- **[Phase 4]** WebFetch ACPICA commit c39183ea84bc and issue #1125:
ASAN heap-buffer-overflow confirmed
- **[Phase 4]** b4 dig -c c39183ea84bc: no Linux kernel match (ACPICA- only hash)
- **[Phase 4]** lore.kernel.org fetch: blocked (bot protection) — review thread unverified
- **[Phase 5]** Grep callers: acpi_ps_get_next_field called from acpi_ps_get_next_arg() at line 787
- **[Phase 5]** Traced load path: acpi_ns_load_table → acpi_ns_parse_table → acpi_ps_execute_table
- **[Phase 5]** Read caller at psargs.c:780-807: NULL return handled with field-list cleanup
- **[Phase 6]** Confirmed struct acpi_parse_state has aml_end at aclocal.h:912
- **[Phase 6]** Confirmed dswstate.c:580-585 initializes aml_end from AML buffer length
- **[Phase 6]** git apply --check on provided diff: **clean apply**
- **[Phase 6]** Grep aml >= parser_state->aml_end in psargs.c: no matches — fix absent
- **[Phase 8]** Assessed severity: heap OOB read during ACPI parse = HIGH
**YES**The analysis is done: **backport recommended** for Linux **6.18.44**.
The commit adds aml_end boundary checks in acpi_ps_get_next_field() to stop out-of-bounds reads when parsing malformed ACPI AML. That’s a real, ASAN-confirmed heap buffer overflow on the ACPI table load path, the patch is small (+20 lines), applies cleanly here, and the needed aml_end infrastructure is already in this tree.
**YES**
drivers/acpi/acpica/psargs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/acpica/psargs.c +17 -0
@@ -474,6 +474,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_stateASL_CV_CAPTURE_COMMENTS_ONLY (parser_state); aml = parser_state->aml; +if (aml >= parser_state->aml_end) { +return_PTR (NULL ); + } +/* Determine field type */ switch (ACPI_GET8 (parser_state->aml)) {
@@ -522,6 +526,11 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the 4-character name */ +if ((parser_state->aml +ACPI_NAMESEG_SIZE ) > + parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + }ACPI_MOVE_32_TO_32 (&name, parser_state->aml);acpi_ps_set_name (field, name); parser_state->aml +=ACPI_NAMESEG_SIZE ;
@@ -567,6 +576,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the two bytes (Type/Attribute) */ +if ((parser_state->aml +2 ) > parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_type =ACPI_GET8 (parser_state->aml); parser_state->aml++; access_attribute =ACPI_GET8 (parser_state->aml);
@@ -578,6 +591,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* This opcode has a third byte, access_length */ if (opcode ==AML_INT_EXTACCESSFIELD_OP ) { +if (parser_state->aml >= parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_length =ACPI_GET8 (parser_state->aml); parser_state->aml++;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdkfd: fix SMI event cross-process information leak
In reply to Sasha LevinFrom: Yongqiang Sun <[email protected]>
[ Upstream commit 92a8dba246d371fe268280e5fd74b0955688e6df ]
kfd_smi_ev_enabled() skips the suser privilege check when pid=0. PROCESS_START, PROCESS_END, and VMFAULT events are emitted with pid=0 while carrying another process's PID and command name, so any /dev/kfd user in the render group can monitor all GPU workloads.
Pass the target process PID into kfd_smi_event_add() for these events so the existing per-client filter restricts delivery to the owning process or CAP_SYS_ADMIN subscribers.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [drm/amdkfd] [fix] SMI event cross-process information leak
**Step 1.2 — Tags**
Record:
- Signed-off-by: Yongqiang Sun <[email protected]> (author)
- Acked-by: Alex Deucher <[email protected]> (AMD DRM maintainer)
- Signed-off-by: Alex Deucher <[email protected]> (committer)
- No Fixes:, Reported-by:, Tested-by:, Link:, or `Cc:
[email protected]`
Notable: maintainer Acked-by; no syzbot or user bug report tags.
**Step 1.3 — Body analysis**
Record:
- **Bug:** kfd_smi_ev_enabled() does not apply per-client PID filtering when the filter PID argument is 0. PROCESS_START, PROCESS_END, and VMFAULT events are emitted with filter PID 0 but carry another process's PID and command name in the event payload.
- **Symptom:** Any /dev/kfd user in the render group can monitor all GPU workloads (other processes' PIDs and command names).
- **Root cause:** kfd_smi_event_add(0, ...) bypasses the if (pid && ...) guard in kfd_smi_ev_enabled().
- **Fix:** Pass task_info->tgid into kfd_smi_event_add() so the existing filter restricts delivery to the owning process or CAP_SYS_ADMIN subscribers (client->suser).
**Step 1.4 — Hidden bug fix?**
Record: No — this is an explicit security/privacy bug fix, not disguised cleanup.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- **File:** drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c (+5 / -3 lines)
- **Functions modified:** kfd_smi_event_update_vmfault(), kfd_smi_event_process()
- **Scope:** Single-file surgical fix
**Step 2.2 — Code flow changes**
Record:
- **Hunk 1 (kfd_smi_event_update_vmfault):** Before:
kfd_smi_event_add(0, dev, VMFAULT, ...) → all subscribed clients receive VM fault events with other processes' PID/comm. After:
kfd_smi_event_add(task_info->tgid, dev, VMFAULT, ...) → only matching client or admin receives it.
- **Hunk 2 (kfd_smi_event_process):** Before: kfd_smi_event_add(0, pdd->dev, PROCESS_START/END, ...) → broadcast. After:
kfd_smi_event_add(task_info->tgid, pdd->dev, ...) → per-process filtering.
**Step 2.3 — Bug mechanism**
Record: **Information leak / missing access control.** Category (d) memory-safety adjacent — logic/correctness in security filtering. pid=0 is intentional for system-wide events (GPU reset, thermal throttle); using it for per-process events defeats isolation.
**Step 2.4 — Fix quality**
Record: Obviously correct — uses task_info->tgid, which matches client->pid = current->tgid set in kfd_smi_event_open(). Minimal change. Low regression risk; system-wide events still use pid=0.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record:
- kfd_smi_ev_enabled() filter: Philip Yang, 2022-01-13 (163a5a58437062); superuser logic simplified by Eric Huang, 2025-04-14 (6b9d26089f56f).
- VMFAULT with pid=0: since at least Shashank Sharma refactor, 2024-01-18 (b8f67b9ddf4f8); format-only change in 2024-02-16 (663b0f1e141dc).
- PROCESS_START/END with pid=0: introduced 2025-04-07 (4172b556fd5bd).
**Step 3.2 — Fixes: tag**
Record: Not applicable — no Fixes: tag. Buggy PROCESS events introduced by 4172b556fd5bd; VMFAULT leak predates that.
**Step 3.3 — Related file history**
Record: Recent related commits in this tree:
- 6b9d26089f56f — superuser SMI filter fix (present)
- 4172b556fd5bd — process start/end events (present, introduced leak)
- 9315860d05aa2 — NULL check fix for process SMI event
- 9fd86747daa6c — queue restore string fix
- On master but not in 6.18.44: 92a8dba246d37 / 3b347d011773d (this fix), 1142738572ef3 (container PID reporting — separate, larger change)
**Step 3.4 — Author context**
Record: Yongqiang Sun has at least one other amdkfd fix in history. Alex Deucher (maintainer) Acked and committed the fix.
**Step 3.5 — Dependencies**
Record: Standalone — uses task_info->tgid already present in struct amdgpu_task_info since 2018 (2aa37bf58838f). No series prerequisites. git apply --check passes cleanly on 6.18.44.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: b4 dig -c 3b347d011773d found v1 only at
https://patch.msgid.link/[email protected].
Lore fetch blocked by Anubis bot protection; no thread replies retrieved.
**Step 4.2 — Reviewers**
Record: b4 dig -w — sent to Yongqiang Sun and amd- [email protected]. Alex Deucher Acked in commit.
**Step 4.3 — Bug report**
Record: Not applicable — no Reported-by: or Link: tags. Bug identified by code review / internal AMD analysis per commit message.
**Step 4.4 — Related patches**
Record: Container PID fix (1142738572ef3) is a separate follow-up on master; not required for this security fix to function on non-container or host-PID setups.
**Step 4.5 — Stable list**
Record: Not searched (lore blocked). No stable nomination found in available sources.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: kfd_smi_ev_enabled(), kfd_smi_event_add(), kfd_smi_event_update_vmfault(), kfd_smi_event_process(), kfd_smi_event_open()
**Step 5.2 — Callers**
Record:
- kfd_smi_event_update_vmfault() ← kfd_int_process_v9.c, kfd_int_process_v11.c, cik_event_interrupt.c (GPU fault interrupt paths)
- kfd_smi_event_process() ← kfd_process.c (process start at line ~1727, end at ~1059)
- kfd_smi_event_open() ← kfd_chardev.c via kfd_ioctl_smi_events() (userspace ioctl)
**Step 5.3 — Callees**
Record: amdgpu_vm_get_task_info_pasid(), amdgpu_vm_get_task_info_vm(), add_event_to_kfifo() → iterates all SMI clients and checks kfd_smi_ev_enabled().
**Step 5.4 — Reachability**
Record: Userspace opens SMI event fd via KFD ioctl (/dev/kfd, render group). GPU faults and process lifecycle events are triggered by normal KFD compute workloads. **Reachable by unprivileged render-group users** who can subscribe to SMI events and receive other users' process metadata.
**Step 5.5 — Similar patterns**
Record: Other per-process events (page_fault, migration, queue_eviction, etc.) already pass non-zero PID and are correctly filtered. Only VMFAULT and PROCESS_START/END incorrectly used pid=0.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.44)
**Step 6.1 — Buggy code present?**
Record: **Yes.** Local tree is v6.18.44 on stable/linux-6.18.y. Verified:
- Line 257: kfd_smi_event_add(0, dev, KFD_SMI_EVENT_VMFAULT, ...)
- Line 359: kfd_smi_event_add(0, pdd->dev, PROCESS_START/END, ...)
- Filter at lines 168-169 skips all PID checks when pid==0
- Fix commit 3b347d011773d is **not** an ancestor of HEAD (merge- base exit 1)
**Step 6.2 — Backport complications**
Record: **Clean apply** — git show 3b347d011773d -p | git apply --check succeeded with no conflicts.
**Step 6.3 — Related fixes already present?**
Record: Superuser filter fix (6b9d26089f56f) is present but does not address pid=0 bypass. This specific information-leak fix is absent.
---
## Phase 7: Subsystem Context
**Step 7.1 — Subsystem**
Record: drivers/gpu/drm/amd/amdkfd — AMD KFD (ROCm/HSA GPU compute).
Criticality: **IMPORTANT** for AMD GPU compute users; config-dependent (CONFIG_HSA_AMD).
**Step 7.2 — Activity**
Record: Actively maintained — multiple SMI event commits in 2024-2026 in this file.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Multi-user systems with AMD GPUs and KFD/ROCm enabled; any user in the render group with /dev/kfd access.
**Step 8.2 — Trigger conditions**
Record: Another user's KFD process starts/ends or triggers a VM fault while a malicious/co-resident user has an SMI event fd subscribed. Common on shared GPU servers, HPC clusters, and multi-tenant workstations.
**Step 8.3 — Failure mode severity**
Record: **Cross-process information disclosure** — other processes' PIDs and command names exposed. Severity: **HIGH** (security/privacy; not crash/corruption, but violates process isolation). Unprivileged render- group users can trigger it.
**Step 8.4 — Risk vs benefit**
Record:
- **Benefit:** HIGH — closes a real cross-process monitoring hole on shared GPU systems
- **Risk:** VERY LOW — 8-line change, uses existing fields and filtering logic, maintainer-acked
- **Ratio:** Strongly favors backport
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
**FOR:**
- Real security/privacy bug (cross-process PID/comm leak)
- Small, surgical, maintainer-acked fix
- Applies cleanly to 6.18.44
- Buggy code confirmed present in this tree
- Unprivileged users in render group can exploit
- Aligns with stable policy for security fixes
**AGAINST:**
- Affects only AMD KFD users (not universal)
- No external bug report or syzbot confirmation
- Container PID correctness is a separate follow-up on master (not a reason to reject this fix)
**UNRESOLVED:**
- Full lore thread discussion (Anubis blocked fetch)
- No explicit stable-list nomination found
**Step 9.2 — Stable rules checklist**
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — logic clear; Acked-by maintainer | | 2. Fixes real bug affecting users? | **PASS** — cross-process info leak on shared GPUs | | 3. Important issue? | **PASS** — security information disclosure (HIGH) | | 4. Small and contained? | **PASS** — 8 lines, 1 file | | 5. No new features/APIs? | **PASS** — corrects existing event delivery only | | 6. Can apply to this tree? | **PASS** — clean apply verified |
**Step 9.3 — Exception categories**
Record: None (not a quirk/DT/build/doc fix) — qualifies on security bug- fix merits.
**Step 9.4 — Decision rationale**
This commit fixes a genuine cross-process information leak in AMD KFD SMI events. The buggy code is present in Linux 6.18.44, the fix is minimal and obviously correct, and it restores the intended per-process isolation that kfd_smi_ev_enabled() was designed to provide. Shared- GPU and multi-user ROCm deployments on stable kernels should receive this security fix.
---
## Verification
- [Phase 1] Parsed commit message and tags from user query and git show 3b347d011773d
- [Phase 2] Read current kfd_smi_events.c lines 163-366; confirmed diff changes only VMFAULT and PROCESS paths
- [Phase 3] git blame on filter and event functions; identified introducing commits 4172b556fd5bd, b8f67b9ddf4f8, 6b9d26089f56f, 163a5a58437062
- [Phase 3] git merge-base --is-ancestor: PROCESS events and superuser fix present; info-leak fix absent
- [Phase 3] git show 3b347d011773d -p | git apply --check: clean apply
- [Phase 4] b4 dig -c 3b347d011773d: found lore URL; v1 only
- [Phase 4] b4 dig -w: amd-gfx list CC'd
- [Phase 4] b4 dig -a: single v1 revision
- [Phase 4] WebFetch lore URL: blocked by Anubis (no thread content)
- [Phase 5] grep callers of kfd_smi_event_update_vmfault and kfd_smi_event_process
- [Phase 5] Read kfd_smi_event_open(): client->pid = current->tgid, client->suser = capable(CAP_SYS_ADMIN)
- [Phase 5] Verified task_info->tgid populated in amdgpu_vm.c:2543
- [Phase 6] git describe HEAD: v6.18.44
- [Phase 6] Confirmed buggy kfd_smi_event_add(0, ...) at lines 257 and 359 in current tree
- [Phase 6] git log stable/linux-6.18.y..master -- kfd_smi_events.c:
fix on master, not in stable
- [Phase 8] Assessed severity as cross-process information disclosure via render-group /dev/kfd access
**YES**
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +5 -3
@@ -254,8 +254,10 @@ void kfd_smi_event_update_vmfault(struct kfd_node *dev, uint16_t pasid)if (task_info) {/* Report VM faults from user applications, not retry from kernel */ if (task_info->task.pid) -kfd_smi_event_add (0 , dev,KFD_SMI_EVENT_VMFAULT ,KFD_EVENT_FMT_VMFAULT ( - task_info->task.pid, task_info->task.comm)); +kfd_smi_event_add (task_info->tgid, dev, +KFD_SMI_EVENT_VMFAULT , +KFD_EVENT_FMT_VMFAULT (task_info->task.pid, + task_info->task.comm));amdgpu_vm_put_task_info (task_info); } }
@@ -356,7 +358,7 @@ void kfd_smi_event_process(struct kfd_process_device *pdd, bool start) task_info =amdgpu_vm_get_task_info_vm (avm);if (task_info) { - kfd_smi_event_add(0, pdd->dev, + kfd_smi_event_add(task_info->tgid, pdd->dev, start ? KFD_SMI_EVENT_PROCESS_START : KFD_SMI_EVENT_PROCESS_END, KFD_EVENT_FMT_PROCESS(task_info->task.pid,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18] drm/amdkfd: fix SMI event cross-process information leak
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Kernel panic due to NULL pointer dereferences in amdgpu_vm_get_task_info_vm() and amdgpu_vm_fini() when vm->task_info allocation fails.
- [High] Potential Use-After-Free of amdgpu_vm in amdgpu_vm_get_task_info_pasid.
--
commit ac56a0fa84d860ce75aeb92f4bc1e57cf68cb0d2
Author: Yongqiang Sun <[email protected]>
drm/amdkfd: fix SMI event cross-process information leak
This commit fixes a cross-process information leak by passing the target process PID into kfd_smi_event_add() for system-wide events. This ensures that the existing per-client filter properly restricts delivery to the owning process instead of bypassing the filter with a PID of 0.
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c void kfd_smi_event_update_vmfault(struct kfd_node *dev, uint16_t pasid) · line 254
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +0
-0@@ -254,8 +254,10 @@ void kfd_smi_event_update_vmfault(struct kfd_node *dev, uint16_t pasid)if (task_info) {
[Severity: High]
This isn't a regression introduced by this patch, but can the retrieval of task_info just above this line lead to a Use-After-Free of the amdgpu_vm pointer?
In the call to amdgpu_vm_get_task_info_pasid(), it retrieves the vm pointer from the pasids xarray and immediately drops the lock before passing the bare pointer to amdgpu_vm_get_task_info_vm():
amdgpu_vm_get_task_info_pasid() {
...
return amdgpu_vm_get_task_info_vm(
amdgpu_vm_get_vm_from_pasid(adev, pasid));
}If the owning process concurrently exits and amdgpu_vm_fini() is called, the vm could be freed between dropping the xarray lock and dereferencing the pointer in amdgpu_vm_get_task_info_vm(). This could be triggered via concurrent VM fault interrupts and process teardown.
Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +4
-2/* Report VM faults from user applications, not retry from kernel */ if (task_info->task.pid) -kfd_smi_event_add (0 , dev,KFD_SMI_EVENT_VMFAULT ,KFD_EVENT_FMT_VMFAULT ( - task_info->task.pid, task_info->task.comm)); +kfd_smi_event_add (task_info->tgid, dev, +KFD_SMI_EVENT_VMFAULT , +KFD_EVENT_FMT_VMFAULT (task_info->task.pid, + task_info->task.comm));amdgpu_vm_put_task_info (task_info); } }
[ ... ]
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c void kfd_smi_event_process(struct kfd_process_device *pdd, bool start) · line 358
Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +0
-0@@ -356,7 +358,7 @@ void kfd_smi_event_process(struct kfd_process_device *pdd, bool start) task_info =amdgpu_vm_get_task_info_vm (avm);
[Severity: High]
This is a pre-existing regression, but can this call result in a kernel panic due to a NULL pointer dereference?
Looking at amdgpu_vm_get_task_info_vm(), it checks if the vm pointer is valid but unconditionally accesses vm->task_info:
amdgpu_vm_get_task_info_vm() {
...
if (vm) {
ti = vm->task_info;
kref_get(&vm->task_info->refcount);
}
return ti;
}If the memory allocation fails during initialization in amdgpu_vm_init(), the error is logged but execution continues:
amdgpu_vm_init() {
...
r = amdgpu_vm_create_task_info(vm);
if (r)
dev_dbg(adev->dev, "Failed to create task info for VM\n");
...
}This leaves the vm->task_info pointer as NULL, which will cause a crash when kref_get() is called here.
Additionally, this missing NULL check can cause another dereference during VM destruction in amdgpu_vm_fini() when formatting the warning message:
amdgpu_vm_fini() {
...
dev_warn(adev->dev,
"VM memory stats for proc %s(%d) task %s(%d) is non-zero when fini\n",
ti->process_name, ti->task.pid, ti->task.comm, ti->tgid);
...
}Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +1
-1if (task_info) { - kfd_smi_event_add(0, pdd->dev, + kfd_smi_event_add(task_info->tgid, pdd->dev, start ? KFD_SMI_EVENT_PROCESS_START : KFD_SMI_EVENT_PROCESS_END, KFD_EVENT_FMT_PROCESS(task_info->task.pid,
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 smb: client: fix races in cifsd thread creation
In reply to Sasha LevinFrom: Fredric Cover <[email protected]>
[ Upstream commit e8a5cf2ff5a13fefb228f2069e29dd7d8e37185d ]
The cifsd demultiplex thread can run and access tcp_ses before the parent thread has finished populating tcp_ses, which the worker thread accesses locklessly.
Also, the kthread_run macro may start the thread before returning the thread pointer. Because the pointer is part of the structure that the thread can access, if the kernel is preempted after the thread is spawned, but before the thread pointer is populated and the thread attempts to exit, it will sleep, waiting for a SIGKILL signal.
Fix this by moving creation of the thread to after all of tcp_ses'es fields are populated, and spawning the thread last, using a split kthread_create/wake_up_process logic.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: smb: client: fix races in cifsd thread creation
**Local tree:** v6.18.44 (linux-6.18.y stable), HEAD detached at 2736c32da98b9
**Upstream fix:** e8a5cf2ff5a13 (not in this tree; git merge-base --is-ancestor returned 1)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [smb: client] [fix] — fix races in cifsd (demultiplex) thread creation during TCP session setup.
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Fredric Cover <[email protected]> (author)
- **Signed-off-by:** Steve French <[email protected]> (SMB maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Link:, or Cc:
stable tags
- Notable: maintainer sign-off only; no syzbot or user bug report
### Step 1.3: Body analysis
**Record:**
- **Bug 1:** cifs_demultiplex_thread can run and access tcp_ses before the parent finishes populating fields the worker reads without locking.
- **Bug 2:** kthread_run() may wake the thread before the parent stores tcp_ses->tsk. If the thread exits while tsk is still NULL, exit logic sleeps indefinitely waiting for SIGKILL.
- **Symptom:** Race during mount/session setup; potential hung cifsd kernel thread.
- **Root cause:** kthread_run() creates and immediately wakes the thread mid-initialization; comment claiming “kernel thread not created yet” is incorrect.
- **Fix:** Populate all tcp_ses fields first; use kthread_create() + wake_up_process() last.
### Step 1.4: Hidden bug fix?
**Record:** No — explicitly described as a race fix. The spin_lock removal around tcpStatus is a consequence of correct ordering (thread not running yet), not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** fs/smb/client/connect.c (+16 / −11, 27 lines touched)
- **Function:** cifs_get_tcp_session()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow per hunk
**Hunk 1 — remove early kthread_run:**
- **Before:** Thread created and woken immediately after __module_get(), before min_offload, retrans, tcpStatus, max_credits, etc. are set.
- **After:** No thread yet; parent continues initialization.
**Hunk 2 — remove spin_lock around tcpStatus:**
- **Before:** Lock taken because thread could already be running (contradicting the comment).
- **After:** Unlocked write is safe because thread is still stopped.
**Hunk 3 — kthread_create after all fields populated:**
- **Before:** Thread running during list insertion and echo work setup.
- **After:** Thread exists but is not scheduled; tcp_ses->tsk is assigned before any concurrent access.
**Hunk 4 — wake_up_process() at end:**
- **Before:** Thread could run before tsk pointer stored in struct.
- **After:** All fields and tsk are valid before thread executes.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Race condition / initialization ordering bug
- **Mechanism 1:** TOCTOU between kthread_run() wake and field initialization — demux thread reads max_credits, tcpStatus, etc. locklessly while parent still writes them.
- **Mechanism 2:** kthread_run macro (kthread_create + wake_up_process) returns task pointer to caller *after* thread may already be running. Exit path in cifs_demultiplex_thread():
```1437:1448:fs/smb/client/connect.c
task_to_wake = xchg(&server->tsk, NULL);
clean_demultiplex_info(server);
/* if server->tsk was NULL then wait for a signal before exiting
*/
if (!task_to_wake) {
set_current_state(TASK_INTERRUPTIBLE);
while (!signal_pending(current)) {
schedule();
set_current_state(TASK_INTERRUPTIBLE);
}
```If server->tsk was never set, the thread hangs forever.
### Step 2.4: Fix quality
**Record:** Obviously correct — standard kernel pattern (kthread_create + wake_up_process). Minimal, no API changes. Low regression risk; removing the unnecessary srv_lock around tcpStatus is correct given new ordering.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- kthread_run(cifs_demultiplex_thread, ...) introduced in 7c97c200e2c5a (2011, Al Viro)
- task_to_wake exit-wait logic from b1c8d2b421376 (2008, Jeff Layton), re-added in a5c3e1c725af9 (2014 revert of removal)
- Buggy pattern present since ~2011; hang path possible since 2008/2014 tsk handling
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Recent connect.c changes in this tree include negotiate timeout race fix (266b5d02e14f3), channel deadlock fix (711741f94ac3c), netns leak fix (59b33fab4ca4d). No duplicate fix for this specific race. Standalone patch.
### Step 3.4: Author context
**Record:** Fredric Cover has prior SMB client fixes in tree (86f9c23e0814c OOB read, 6cc1518357369 kvzalloc). Not subsystem maintainer; patch signed off by Steve French.
### Step 3.5: Dependencies
**Record:** No prerequisites. kthread_create/wake_up_process exist in this tree. Patch applies cleanly (git apply --check succeeded). Self-contained.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig -c e8a5cf2ff5a13 →
https://patch.msgid.link/[email protected]
Submitted as [PATCH RFC] on 2026-06-01. Lore page blocked by bot protection; could not read thread replies.
### Step 4.2: Reviewers
**Record:** b4 dig -w returned same URL only. CC list from web search:sfrench, linux-cifs, [email protected]. Maintainer sign-off present.
### Step 4.3: Bug reports
**Record:** No Reported-by or syzbot link. Theoretical/review-found race, but mechanism is verifiable in code.
### Step 4.4: Series context
**Record:** b4 dig -a shows single revision. Not part of a multi-patch series.
### Step 4.5: Stable list
**Record:** UNVERIFIED — could not search lore stable archive due to fetch blocking. No evidence against backport.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Modified functions
**Record:** cifs_get_tcp_session() (primary), affects startup of cifs_demultiplex_thread().
### Step 5.2: Callers
**Record:** cifs_get_tcp_session() called from:
- Mount path (~line 3667 in connect.c) — every CIFS/SMB mount
- sess.c:561 — multichannel session setup
Every SMB/CIFS mount triggers this path.
### Step 5.3: Callees
**Record:** kthread_create, wake_up_process, list_add, queue_delayed_work, field initialization. Demux thread calls cifs_read_from_socket, allocate_buffers, credit handling — all use server fields set in this function.
### Step 5.4: Reachability
**Record:** Reachable from userspace via mount -t cifs / SMB mount syscalls. Common enterprise and desktop path. Unprivileged users can trigger if permitted to mount.
### Step 5.5: Similar patterns
**Record:** No other kthread_run(cifs_demultiplex_thread instances. This is the sole creation site.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **YES.** Current tree at fs/smb/client/connect.c:1874-1906 has identical buggy kthread_run ordering. Bug predates 6.18.y branch (code from 2008–2011).
### Step 6.2: Backport complications
**Record:** **Clean apply.** git show e8a5cf2ff5a13 -- fs/smb/client/connect.c | git apply --check succeeded with no conflicts.
### Step 6.3: Related fixes already present? **Record:** No equivalent fix in this tree. git merge-base --is- ancestor e8a5cf2ff5a13 HEAD → exit 1 (not merged).
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem criticality
**Record:** fs/smb/client — **IMPORTANT**. CIFS/SMB client used widely on servers, desktops, NAS mounts. Not core VFS, but affects any system mounting SMB shares.
### Step 7.2: Activity
**Record:** Actively maintained in 6.18.y (20+ recent commits to connect.c).
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who is affected
**Record:** All users mounting CIFS/SMB shares (CONFIG_CIFS).
### Step 8.2: Trigger conditions
**Record:**
- **Init race:** Any mount — timing-dependent, more likely under preemption/scheduling pressure.
- **Hang:** Failed mount or fast teardown after kthread_run but before tsk assignment; requires unlucky scheduling.
- **Unprivileged trigger:** Yes, if user can mount SMB shares.
### Step 8.3: Failure severity
**Record:**
- Init race: incorrect credit/state handling, unpredictable behavior, potential protocol errors — **HIGH**
- Hung cifsd thread: stuck kernel thread, module unload failure, resource leak — **CRITICAL**
- Overall: **HIGH to CRITICAL**
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH — prevents mount-path races and potential hung threads on common filesystem
- **Risk:** LOW — 27-line ordering fix, well-established pattern, applies cleanly
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Fixes real, verifiable race in mount hot path
- Can cause hung kernel thread (indefinite sleep in exit path)
- Small, surgical, maintainer-approved
- Applies cleanly to v6.18.44
- Buggy code confirmed present in this tree since long before branch
- No dependencies or new APIs
**AGAINST backport:**
- No user bug report or syzbot reproduction (theoretical timing race)
- RFC submission — may have had review comments we could not read
**UNRESOLVED:**
- Full lore review thread content (bot-blocked)
- Whether any reviewer explicitly nominated for stable
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic is sound; maintainer SOB; no Tested-by
2. Fixes real bug affecting users? **PASS** — mount-path race with verifiable hang mechanism
3. Important issue? **PASS** — hung task / mount failures (**CRITICAL**)
4. Small and contained? **PASS** — 1 file, 27 lines
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs fix — standard bug fix).
### Step 9.4: Decision rationale
This fix addresses two concrete problems in cifs_get_tcp_session():
the demux thread running before tcp_ses is fully initialized, and the tsk pointer race that can leave cifsd sleeping forever on exit. The buggy code is present in v6.18.44, the patch is minimal and applies cleanly, and the failure modes (hung thread, mount instability) are serious enough for stable. The absence of a public bug report does not diminish the technical merit — the race is structurally present in code that has been wrong since kthread_run was adopted here.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body from provided commit message and git show e8a5cf2ff5a13
- **[Phase 2]** Analyzed diff; read cifs_demultiplex_thread exit path at lines 1437–1448; read kthread_run macro in include/linux/kthread.h:69–76
- **[Phase 3]** git blame -L 1870,1910 fs/smb/client/connect.c — kthread_run from 2011
- **[Phase 3]** git log -S 'kthread_run(cifs_demultiplex_thread' — introduced 7c97c200e2c5a
- **[Phase 3]** git log -S 'if (!task_to_wake)' — tsk exit wait from b1c8d2b421376, re-added a5c3e1c725af9
- **[Phase 3]** git log --oneline -20 -- fs/smb/client/connect.c — no duplicate fix
- **[Phase 3]** git log --author="Fredric Cover" -- fs/smb/client/ — 2 prior fixes
- **[Phase 4]** b4 dig -c e8a5cf2ff5a13 → lore URL found; b4 dig -a → single revision
- **[Phase 4]** Lore fetch blocked (bot protection) — review comments UNVERIFIED
- **[Phase 5]** grep cifs_get_tcp_session — callers at connect.c:3667, sess.c:561
- **[Phase 5]** Read cifs_demultiplex_thread startup loop (lines 1251–1285)
- **[Phase 6]** git describe HEAD → v6.18.44; buggy code at connect.c:1874–1906 confirmed
- **[Phase 6]** git merge-base --is-ancestor e8a5cf2ff5a13 HEAD → exit 1 (fix not in tree)
- **[Phase 6]** git show e8a5cf2ff5a13 -- fs/smb/client/connect.c | git apply --check → clean apply
- **[Phase 8]** Failure modes: init race (HIGH), hung cifsd thread (CRITICAL)
**YES**
fs/smb/client/connect.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
fs/smb/client/connect.c +16 -11
@@ -1871,14 +1871,6 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* this will succeed. No need for try_module_get(). */ __module_get (THIS_MODULE ); - tcp_ses->tsk =kthread_run (cifs_demultiplex_thread, - tcp_ses,"cifsd" ); -if (IS_ERR (tcp_ses->tsk)) { - rc =PTR_ERR (tcp_ses->tsk); -cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); -module_put (THIS_MODULE ); - goto out_err_crypto_release; - } tcp_ses->min_offload = ctx->min_offload; tcp_ses->retrans = ctx->retrans;/*
@@ -1886,9 +1878,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* to the struct since the kernel thread not created yet * no need to spinlock this update of tcpStatus */ -spin_lock (&tcp_ses->srv_lock); tcp_ses->tcpStatus = CifsNeedNegotiate; -spin_unlock (&tcp_ses->srv_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 )) tcp_ses->max_credits =SMB2_MAX_CREDITS_AVAILABLE ;
@@ -1897,7 +1887,16 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, tcp_ses->nr_targets =1 ; tcp_ses->ignore_signature = ctx->ignore_signature; -/* thread spawned, put it on the list */ + + tcp_ses->tsk =kthread_create (cifs_demultiplex_thread, + tcp_ses,"cifsd" ); +if (IS_ERR (tcp_ses->tsk)) { + rc =PTR_ERR (tcp_ses->tsk); +cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); +module_put (THIS_MODULE ); + goto out_err_crypto_release; + } +/* thread created, put it on the list */ spin_lock (&cifs_tcp_ses_lock);list_add (&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);spin_unlock (&cifs_tcp_ses_lock);
@@ -1905,6 +1904,12 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,/* queue echo request delayed work */ queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval); +/* +* Use split create/wake logic to ensure that tcp_ses is fully populated +* and tcp_ses->tsk is valid +*/ +wake_up_process (tcp_ses->tsk); +return tcp_ses; out_err_crypto_release:
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 crypto: atmel-sha204a - remove sysfs group before hwrng
In reply to Sasha LevinFrom: Thorsten Blum <[email protected]>
[ Upstream commit d58b4a09d7f06750a706b70d068f5a678dad8233 ]
atmel_sha204a_probe() registers the hwrng before creating the sysfs group. Mirror this order in atmel_sha204a_remove() by removing the sysfs group before unregistering the hwrng.
---
LLM Generated explanations, may be completely bogus:
The background searches finished. The Herbert crypto tree is reachable, and the upstream commit is **d58b4a09d7f06** (crypto: atmel-sha204a - remove sysfs group before hwrng). It isn’t in the current **6.18.44** ancestry — the buggy teardown order is still present in drivers/crypto/atmel-sha204a.c.
That doesn’t change the earlier verdict: **YES** for backport to this tree. It’s a one-line reorder that should keep the existing kfree() (the LKML version also dropped it, which would be wrong here).
drivers/crypto/atmel-sha204a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/atmel-sha204a.c +1 -2
@@ -205,11 +205,10 @@ static void atmel_sha204a_remove(struct i2c_client *client) {struct atmel_i2c_client_priv *i2c_priv =i2c_get_clientdata (client); +sysfs_remove_group (&client->dev.kobj, &atmel_sha204a_groups);devm_hwrng_unregister (&client->dev, &i2c_priv->hwrng);atmel_i2c_flush_queue (); -sysfs_remove_group (&client->dev.kobj, &atmel_sha204a_groups); -kfree ((void *)i2c_priv->hwrng.priv); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: em28xx-video: fix missing res_free() on init_usb_xfer failure
In reply to Sasha LevinFrom: Haoxiang Li <[email protected]>
[ Upstream commit cc20e81da6d99926f94fad7af21f75c07e865769 ]
res_get() is called before em28xx_init_usb_xfer(), but the error path of em28xx_init_usb_xfer() does not release the resource, leading to a persistent busy state.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject line
**Record:** [media: em28xx-video] [fix] — missing res_free() on em28xx_init_usb_xfer() failure in em28xx_start_analog_streaming().
### Step 1.2: Commit message tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** — none in message (Hans Verkuil appears only as Signed-off-by)
- **Link:** — none
- **Cc: stable:** — none
- **Signed-off-by:** Haoxiang Li (author), Hans Verkuil (V4L2/media maintainer)
No syzbot, no multi-reporter signals. Hans Verkuil's sign-off is a quality indicator.
### Step 1.3: Commit body analysis
**Record:**
- **Bug:** res_get() is called before em28xx_init_usb_xfer(), but the error return path does not call res_free().
- **Symptom:** Persistent busy state — dev->resources stays set for VIDEO or VBI.
- **Root cause (author):** Missing cleanup on the em28xx_init_usb_xfer() failure path.
- **Version info:** None in the message. Patch was submitted April 2026 and merged for v7.2 media pull.
### Step 1.4: Hidden bug fix detection
**Record:** Not disguised — explicitly labeled a fix. This is an error- path resource-leak fix (missing res_free()), a well-known stable backport category.
---
## Phase 2: Diff Analysis
### Step 2.1: Change inventory
**Record:**
- **File:** drivers/media/usb/em28xx/em28xx-video.c (+3 / -1 lines)
- **Function:** em28xx_start_analog_streaming()
- **Scope:** Single-file, surgical fix in one error path
### Step 2.2: Code flow change
**Record:**
- **Before:** On em28xx_init_usb_xfer() failure → return rc with resource still held.
- **After:** On failure → res_free(dev, vq->type) then return rc.
- **Path affected:** First streaming user (streaming_users == 0), USB xfer initialization error path only.
### Step 2.3: Bug mechanism
**Record:** **Category:** Error-path resource leak / reference-style lock not released.
Mechanism verified in tree:
1. Line 1085: res_get(dev, vq->type) sets dev->resources bit.
2. Lines 1102–1107: em28xx_init_usb_xfer() may fail (URB alloc, usb_clear_halt, usb_submit_urb).
3. Lines 1108–1109 (current tree): early return rc without res_free().
4. streaming_users++ at line 1132 is never reached on this path.
5. videobuf2 does **not** call stop_streaming when start_streaming fails (start_streaming_called cleared at line 1794 of videobuf2-core.c without invoking stop_streaming).
### Step 2.4: Fix quality
**Record:** Obviously correct — mirrors res_free() already called unconditionally in em28xx_stop_streaming() (line 1146) and em28xx_stop_vbi_streaming() (line 1181). Minimal, no API changes. Regression risk: very low.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Buggy lines (1085–1109) blame to 5d324e5159d9e (Merge tag 'usb-6.18-rc8', Nov 2025). res_get/res_free helpers and the res_get() before em28xx_init_usb_xfer() pattern are part of the driver as present in this 6.18.y tree. Shallow history here (file added in that merge); the resource-lock pattern is longstanding em28xx design, not a recent regression.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Recent commits on drivers/media/usb/em28xx/ in this tree:
- 871b8ea8ef39a — em28xx UAF fix in em28xx_v4l2_open() (already backported to 6.18.y)
- 5d324e5159d9e — merge bringing em28xx driver into this tree
Standalone fix; not part of a multi-patch series.
### Step 3.4: Author context
**Record:** Haoxiang Li — contributor (also has other stable-nominated resource-leak fixes in wider kernel). Hans Verkuil signed off — V4L2/media subsystem maintainer.
### Step 3.5: Dependencies
**Record:** None. Patch applies cleanly (git apply --check exit 0). No prerequisite commits required.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original patch discussion
**Record:** Found at
https://www.spinics.net/lists/kernel/msg6153558.html (Apr 14, 2026). Single-patch submission to Mauro Chehab. Follow-up from Markus Elfring listed but content not retrieved (fetch timeout). No NAK visible in available thread content. b4 dig -c could not run — commit hash not in this checkout.
### Step 4.2: Reviewers
**Record:** CC'd: linux-media@, linux-kernel@, Mauro Chehab. Hans Verkuil sign-off indicates maintainer acceptance.
### Step 4.3: Bug report
**Record:** No external bug report, syzbot, or user Reported-by. Bug identified by code-path analysis.
### Step 4.4: Related patches
**Record:** Included in v7.2 media pull (lists.openwall.net). Standalone; no series dependencies.
### Step 4.5: Stable list history
**Record:** No stable-specific discussion found. Patch does not include Cc: [email protected].
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key functions
**Record:** em28xx_start_analog_streaming(), res_get(), res_free(), em28xx_init_usb_xfer().
### Step 5.2: Callers
**Record:** em28xx_start_analog_streaming is the vb2 .start_streaming callback for:
- Video capture queue (em28xx_video_qops, line 1230)
- VBI capture queue (em28xx-vbi.c, line 85)
Triggered via VIDIOC_STREAMON → vb2 → driver start path. Common userspace capture path.
### Step 5.3: Callees
**Record:** res_get() → checks/sets dev->resources; em28xx_init_usb_xfer() → URB alloc/submit, USB I/O; res_free() → clears resource bit.
### Step 5.4: Reachability
**Record:** Reachable from userspace via V4L2 streaming ioctl on em28xx devices (CONFIG_VIDEO_EM28XX). Unprivileged users with device access can trigger streaming start. Failure conditions (USB errors, ENOMEM, bandwidth) are realistic though not every-boot common.
### Step 5.5: Similar patterns
**Record:** Normal success path relies on em28xx_stop_streaming() / em28xx_stop_vbi_streaming() for res_free(). The missing cleanup is unique to the early-error path before streaming_users++ — consistent with vb2 semantics (no stop_streaming on failed start_streaming).
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy code in this tree?
**Record:** **YES.** Tree is v6.18.43 (stable/linux-6.18.y, make kernelversion = 6.18.43). Current code at lines 1108–1109 lacks res_free() on error. Fix is **not** yet applied.
### Step 6.2: Backport complications
**Record:** **Clean apply** — verified with git apply --check. No conflicts expected.
### Step 6.3: Related fixes already present?
**Record:** Related em28xx fix 871b8ea8ef39a (UAF in open) is present; this res_free fix is **not** present.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem criticality
**Record:** drivers/media/usb/em28xx — **PERIPHERAL** driver (USB analog TV/capture dongles). Important for users of that hardware, not universal.
### Step 7.2: Subsystem activity
**Record:** Low churn in this 6.18.y tree (3 commits on em28xx path). Driver is mature; recent activity includes stable-worthy bug fixes.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who is affected
**Record:** Users of Empia EM28xx USB capture devices with CONFIG_VIDEO_EM28XX enabled.
### Step 8.2: Trigger conditions
**Record:** VIDIOC_STREAMON when em28xx_init_usb_xfer() fails (URB allocation, USB halt clear, URB submit). Realistic on USB errors or resource pressure. Userspace-triggerable by device node holders.
### Step 8.3: Failure mode severity
**Record:** Resource bit stuck → subsequent streaming attempts get -EBUSY from res_get() (line 861). Device remains unusable for that buffer type until unplug/reprobe. **Severity: MEDIUM** — functional breakage, not kernel crash, data corruption, or security issue.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Restores recoverability after transient USB init failures; prevents permanent device busy state.
- **Risk:** Very low — 3-line symmetric cleanup on documented error path.
- **Ratio:** Favorable for stable; conservative fix aligned with vb2 driver contract.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence summary
**FOR backport:**
- Real, verifiable resource leak on error path
- User-visible persistent -EBUSY until device reset
- vb2 contract requires driver self-cleanup on failed start_streaming — fix does exactly that
- Minimal (3 lines), applies cleanly to 6.18.43
- Signed off by media maintainer Hans Verkuil
- Buggy code confirmed present in this tree
**AGAINST backport:**
- No crash, security issue, or data corruption
- Driver-specific; limited user base
- No fuzzer/user reports documenting field impact
- Failure path may be uncommon
**Unresolved:** Exact mainline commit SHA not in this checkout; Markus Elfring review reply not read; no explicit stable nomination on list.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic mirrors existing stop_streaming cleanup; maintainer sign-off
2. Fixes real bug affecting users? **PASS** — persistent busy state on em28xx hardware
3. Important issue? **PASS** — MEDIUM severity functional breakage requiring device reset
4. Small and contained? **PASS** — 3 lines, one function
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — clean apply verified
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs). Standard error-path bug fix.
### Step 9.4: Decision rationale
For **linux-6.18.y (v6.18.43)**, this commit should be backported. The buggy pattern exists in the checked-out tree, the fix is minimal and obviously correct, and it addresses a real driver bug where a failed stream start leaves the device permanently busy because videobuf2 does not invoke stop_streaming on start_streaming failure. While impact is limited to em28xx users and severity is functional rather than catastrophic, stable trees routinely accept such error-path resource leaks that brick device operation until physical reset.
---
## Verification
- **[Phase 1]** git describe HEAD → v6.18.43-1-gc7f0dac02d232; make kernelversion → 6.18.43
- **[Phase 1]** Parsed commit message from user query and spinics mirror
- **[Phase 2]** Read em28xx_start_analog_streaming() lines 1069–1135; confirmed missing res_free on error
- **[Phase 2]** Read res_get()/res_free() at lines 854–876
- **[Phase 2]** Read em28xx_init_usb_xfer() failure paths in em28xx- core.c lines 1021–1052
- **[Phase 3]** git blame -L 1085,1110 → all lines from 5d324e5159d9e
- **[Phase 3]** git log --oneline -20 -- drivers/media/usb/em28xx/ → 3 commits including UAF fix
- **[Phase 4]** WebFetch spinics msg6153558 — patch content and submission date confirmed
- **[Phase 4]** Web search — patch in v7.2 media pull; b4 dig -c failed (commit not in tree)
- **[Phase 5]** Grep callers — video and VBI queues use em28xx_start_analog_streaming
- **[Phase 5]** Read vb2_start_streaming() lines 1775–1828 — no stop_streaming on failure
- **[Phase 5]** Read __vb2_queue_cancel() lines 2210–2211 — stop_streaming only if start_streaming_called
- **[Phase 6]** Confirmed buggy lines 1108–1109 in working tree
- **[Phase 6]** git apply --check with patch → exit 0 (clean apply)
- **[Phase 6]** git diff HEAD -- em28xx-video.c — fix not already applied
- **[Phase 8]** Verified res_get() returns -EBUSY when resource held (line 861)
- **UNVERIFIED:** Markus Elfring review reply content; exact mainline commit SHA; how long res_get before init_usb_xfer has existed in mainline pre-6.18
**YES**The background git log -S "res_get(dev, vq->type)" --all search was stopped — --all scans too many branches and had been running for 90+ seconds. The same question was already answered with a targeted
search: in this 6.18.43 tree, that pattern dates to 5d324e5159d9e, and the buggy error path is still present at lines 1108–1109.
**Verdict unchanged: YES** — backport the missing res_free() on em28xx_init_usb_xfer() failure; it’s a small, clean fix for a real resource leak that leaves em28xx devices stuck busy until unplug.
drivers/media/usb/em28xx/em28xx-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-video.c +3 -1
@@ -1105,8 +1105,10 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count) dev->max_pkt_size, dev->packet_multiplier, em28xx_urb_data_copy); -if (rc <0 ) +if (rc <0 ) { +res_free (dev, vq->type);return rc; + }/* * djh: it's not clear whether this code is still needed. I'm
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nvme-core: align fabrics_q teardown with admin_q in nvme_free_ctrl
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit f702badaf7d31dc3dea6c66da92b5f35fadd89dc ]
Currently, the final reference for the fabrics admin queue (fabrics_q) is dropped inside nvme_remove_admin_tag_set(). However, the primary admin queue (admin_q) defers dropping its final reference until nvme_free_ctrl().
Move the blk_put_queue() call for fabrics_q from nvme_remove_admin_tag_set() to nvme_free_ctrl(). This aligns the lifecycle management of both admin queues, ensuring they are freed symmetrically when the controller is finally torn down.
---
LLM Generated explanations, may be completely bogus:
The background git searches finished: all three lookups (git log --grep='align fabrics_q' and --grep='fabrics_q teardown' on HEAD and stable/linux-6.18.y) returned no matches. That confirms the fabrics_q alignment fix is not in this 6.18.44 tree yet, which matches the earlier analysis — the asymmetry from 03b3bcd319b3a is still present, and the backport recommendation remains **YES**.
drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -4908,10 +4908,8 @@ void nvme_remove_admin_tag_set(struct nvme_ctrl *ctrl)*/ nvme_stop_keep_alive (ctrl);blk_mq_destroy_queue (ctrl->admin_q); -if (ctrl->ops->flags &NVME_F_FABRICS ) { +if (ctrl->fabrics_q)blk_mq_destroy_queue (ctrl->fabrics_q); -blk_put_queue (ctrl->fabrics_q); - }blk_mq_free_tag_set (ctrl->admin_tagset); }EXPORT_SYMBOL_GPL (nvme_remove_admin_tag_set);
@@ -5053,6 +5051,8 @@ static void nvme_free_ctrl(struct device *dev)if (ctrl->admin_q)blk_put_queue (ctrl->admin_q); +if (ctrl->fabrics_q) +blk_put_queue (ctrl->fabrics_q);if (!subsys || ctrl->instance != subsys->instance)ida_free (&nvme_instance_ida, ctrl->instance);nvme_free_cels (ctrl);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 nvme-fc: Do not cancel requests in io target before it is initialized
In reply to Sasha LevinFrom: Mohamed Khalfella <[email protected]>
[ Upstream commit ee38469f88492df99e1d97f03aa40ecfd218934f ]
A new nvme-fc controller in CONNECTING state sees admin request timeout schedules ctrl->ioerr_work to abort inflight requests. This ends up calling __nvme_fc_abort_outstanding_ios() which aborts requests in both admin and io tagsets. In case fc_ctrl->tag_set was not initialized we see the warning below. This is because ctrl.queue_count is initialized early in nvme_fc_alloc_ctrl().
nvme nvme0: NVME-FC{0}: starting error recovery Connectivity Loss
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe lpfc 0000:ab:00.0: queue 0 connect admin queue failed (-6). you didn't initialize this object before use?
turning off the locking correctness validator.
Workqueue: nvme-reset-wq nvme_fc_ctrl_ioerr_work [nvme_fc] Call Trace: <TASK> dump_stack_lvl+0x57/0x80 register_lock_class+0x567/0x580 __lock_acquire+0x330/0xb90 lock_acquire.part.0+0xad/0x210 blk_mq_tagset_busy_iter+0xf9/0xc00 __nvme_fc_abort_outstanding_ios+0x23f/0x320 [nvme_fc] nvme_fc_ctrl_ioerr_work+0x172/0x210 [nvme_fc] process_one_work+0x82c/0x1450 worker_thread+0x5ee/0xfd0 kthread+0x3a0/0x750 ret_from_fork+0x439/0x670 ret_from_fork_asm+0x1a/0x30 </TASK>
Update the check in __nvme_fc_abort_outstanding_ios() confirm that io tagset was created before iterating over busy requests. Also make sure to cancel ctrl->ioerr_work before removing io tagset.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: nvme-fc: Do not cancel requests in io target before it is initialized
**Local tree:** v6.18.44 (Linux 6.18.y stable) **Upstream commit:** ee38469f88492 (2026-06-10) **Candidate stable commit:** 7e1a5ff60479b (exists in repo, **not** merged into HEAD)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 – Subject line**
Record: [nvme-fc] [prevent/ensure] Do not cancel requests in io tagset before it is initialized
**Step 1.2 – Tags**
Record:
- **Reviewed-by:** Randy Jennings, Hannes Reinecke, Daniel Wagner, Christoph Hellwig (four NVMe/FC reviewers)
- **Signed-off-by:** Mohamed Khalfella, James Smart, Maurizio Lombardi, Keith Busch
- No Fixes:, Reported-by:, Cc: [email protected], Link:, or Tested-by: tags
- Absence of stable tags is expected for manual review candidates
**Step 1.3 – Body analysis**
Record:
- **Bug:** During NVME_CTRL_CONNECTING, an admin request timeout schedules ctrl->ioerr_work, which calls __nvme_fc_abort_outstanding_ios(). That function aborts both admin and IO tagsets when queue_count > 1, but fc_ctrl->tag_set may not yet be initialized.
- **Symptom:** lockdep warning "you didn't initialize this object before use?" in blk_mq_tagset_busy_iter(); lockdep validator disabled; observed with lpfc during admin queue connect failure (-6).
- **Root cause:** ctrl->queue_count is set early in nvme_fc_alloc_ctrl(), while IO tagset creation is deferred to the connect path.
- **Version info:** Not specified; bug is structural in existing init ordering.
**Step 1.4 – Hidden bug fix?**
Record: **Yes.** Subject uses "Do not cancel" rather than "fix", but the body and stack trace describe a real uninitialized-lock / premature tagset iteration bug, plus a teardown race fixed by cancel_work_sync().
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 – Inventory**
Record:
- **File:** drivers/nvme/host/fc.c (+6, −1)
- **Functions:** __nvme_fc_abort_outstanding_ios(), nvme_fc_create_io_queues() error path (out_cleanup_tagset)
- **Scope:** Single-file, surgical fix
**Step 2.2 – Code flow changes**
Record:
- **Hunk 1 (line 2462):** Before: abort IO tagset whenever `queue_count
Quoted 1 line
1
. After: also requirectrl->ctrl.tagset` (set by
nvme_alloc_io_tag_set()).
- **Hunk 2 (out_cleanup_tagset):** Before: directly remove IO tagset on create failure. After: cancel_work_sync(&ctrl->ioerr_work) first, preventing ioerr_work from iterating a tagset being torn down.
**Step 2.3 – Bug mechanism**
Record:
- **Category:** Uninitialized data / memory safety (uninitialized spinlock in blk_mq_tag_set)
- **Mechanism:** queue_count > 1 is true from allocation, but tag_set is zero-initialized until nvme_fc_create_io_queues() succeeds in nvme_alloc_io_tag_set(). Error recovery during CONNECTING calls blk_mq_tagset_busy_iter() on an uninitialized tagset.
**Step 2.4 – Fix quality**
Record:
- Fix is minimal and follows existing patterns (ctrl->ctrl.tagset is already checked at lines 3236 and 3267 in the same file).
- Low regression risk: only skips IO abort when no tagset exists; admin queue abort still proceeds.
- cancel_work_sync() in the error path mirrors the pattern from 0a2c5495b6d1e (already in this tree for nvme_fc_delete_ctrl()).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 – Blame**
Record:
- Buggy if (ctrl->ctrl.queue_count > 1) at line 2462 introduced by 95ced8a2c72d (James Smart, 2020-10-27): "nvme-fc: eliminate terminate_io use by nvme_fc_error_recovery"
- Early queue_count init dates to 2016–2017 (e399441de9115, d858e5f04e58a4)
- Tagset deferral comment at lines 3504–3508 confirms intentional late IO tagset init
**Step 3.2 – Fixes: tag**
Record: Not applicable (no Fixes: tag in commit message).
**Step 3.3 – Related file history**
Record:
- ee59e3820ca92 (2025-01): "do not ignore connectivity loss during connecting" — increases CONNECTING-state error handling
- f13409bb3f914 (2025-02): connectivity loss state machine changes — present in this tree
- 0a2c5495b6d1e: related ioerr_work cancellation fix in delete path — already in HEAD
- e810b290922c5: admin tagset release on init failure — recent related work
- Standalone 1/1 patch, not part of a multi-patch dependency series
**Step 3.4 – Author context**
Record: Mohamed Khalfella (Pure Storage); patch submitted by Maurizio Lombardi; reviewed by NVMe maintainers (Hellwig, Busch chain). Author is an active NVMe-FC contributor.
**Step 3.5 – Prerequisites**
Record: No prerequisite commits required. Patch applies cleanly (git apply --check passed). Uses only existing symbols (ctrl->ctrl.tagset, cancel_work_sync).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 – Original discussion**
Record:
- b4 dig -c 7e1a5ff60479b:
https://patch.msgid.link/[email protected]
- Standalone v1 patch (2026-05-28), not part of the larger Rapid Path Failure Recovery series
- Lore page blocked by bot protection; could not read inline review text
**Step 4.2 – Reviewers**
Record: b4 dig -w shows CC to [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
**Step 4.3 – Bug report**
Record: Stack trace embedded in commit message; lpfc admin queue connect failure (-6); no external bugzilla/syzbot link.
**Step 4.4 – Series context**
Record: b4 dig -a shows unrelated RFR series revisions; this fix was submitted separately as [PATCH 1/1].
**Step 4.5 – Stable list**
Record: UNVERIFIED — could not search lore stable archive due to fetch restrictions; no stable nomination found in commit metadata.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 – Key functions**
Record: __nvme_fc_abort_outstanding_ios(), nvme_fc_error_recovery(), nvme_fc_ctrl_ioerr_work(), nvme_fc_create_io_queues()
**Step 5.2 – Callers**
Record:
- nvme_fc_ctrl_ioerr_work() → nvme_fc_error_recovery() → __nvme_fc_abort_outstanding_ios() (CONNECTING path)
- nvme_fc_delete_association() → __nvme_fc_abort_outstanding_ios(ctrl, false)
- ioerr_work queued from nvme_fc_fcpio_done() (check_error at line 2052) on transport errors
- Triggered during controller connect/reconnect — common enterprise FC storage path
**Step 5.3 – Callees**
Record: blk_mq_tagset_busy_iter(), nvme_quiesce_io_queues(), nvme_sync_io_queues(), nvme_remove_io_tag_set(), cancel_work_sync()
**Step 5.4 – Reachability**
Record:
- Userspace triggers NVMe-FC device discovery/connect via sysfs/fc transport
- Connectivity loss or admin timeout during CONNECTING is a realistic failure mode (documented in commit message with lpfc)
- **Reachable from normal device operation**, not obscure debug-only path
**Step 5.5 – Similar patterns**
Record: File already guards ctrl->ctrl.tagset before IO queue teardown at lines 3236 and 3267; this fix aligns abort path with existing teardown guards.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE (6.18.44)
**Step 6.1 – Buggy code present?**
Record: **Yes.** HEAD at drivers/nvme/host/fc.c:2462 still has if (ctrl->ctrl.queue_count > 1) without tagset check. out_cleanup_tagset at line 2900 lacks cancel_work_sync(). Upstream fix ee38469f88492 is **not** an ancestor of HEAD.
**Step 6.2 – Backport complications**
Record: **Clean apply** — git show 7e1a5ff60479b | git apply --check succeeded with no conflicts.
**Step 6.3 – Related fixes already present?**
Record: 0a2c5495b6d1e fixes ioerr_work cancellation ordering in nvme_fc_delete_ctrl() but does not cover the nvme_fc_create_io_queues() failure path or the uninitialized tagset abort. No duplicate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1 – Subsystem**
Record: drivers/nvme/host/fc.c — NVMe over Fibre Channel host driver. **Criticality: IMPORTANT** (enterprise storage; not core kernel, but stability-critical for FC deployments).
**Step 7.2 – Activity**
Record: 14 commits to fc.c since ee59e3820ca92; actively maintained with recent connectivity/error-recovery work.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 – Who is affected**
Record: Users with CONFIG_NVME_FC and FC HBAs (lpfc, etc.) during controller connect, reconnect, or connectivity-loss scenarios.
**Step 8.2 – Trigger conditions**
Record:
- Controller in NVME_CTRL_CONNECTING
- queue_count > 1 (normal when IO queues configured)
- IO tagset not yet created (admin connect in progress or IO queue setup failed)
- Admin timeout or connectivity loss schedules ioerr_work
- **Likelihood:** Moderate during link/target issues — exactly when error recovery runs
**Step 8.3 – Failure severity**
Record:
- lockdep: "you didn't initialize this object before use?" — disables lock validator
- Without lockdep: use of uninitialized spinlock in blk_mq_tagset_busy_iter() — unpredictable behavior, potential oops/panic
- **Severity: HIGH** (kernel instability during error recovery)
**Step 8.4 – Risk vs benefit**
Record:
- **Benefit: HIGH** — prevents crash/warning during connect-failure error recovery on production FC storage
- **Risk: LOW** — 7-line change, matches existing tagset guards, four maintainer reviews
- **Ratio:** Strong benefit, minimal risk
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 – Evidence summary**
| FOR backport | AGAINST backport | |---|---| | Real bug with reproduced stack trace | Only affects NVMe-FC users (not all kernels) | | Uninitialized lock use — HIGH severity | No syzbot/CVE, but real lpfc scenario | | Small, surgical, 4 Reviewed-by | Lore review text UNVERIFIED | | Applies cleanly to 6.18.44 | — | | Buggy code confirmed in HEAD | — | | Complements existing `ioerr_work` fix | — |
**Step 9.2 – Stable rules checklist**
1. Obviously correct and tested? **PASS** — logic matches existing ctrl->ctrl.tagset guards; four subsystem reviewers
2. Fixes a real bug affecting users? **PASS** — lpfc connect failure scenario with stack trace
3. Important issue? **PASS** — kernel instability during error recovery (HIGH)
4. Small and contained? **PASS** — 1 file, 7 lines
5. No new features/APIs? **PASS** — error-path guard only
6. Can apply to local tree? **PASS** — clean apply verified
**Step 9.3 – Exception categories**
Record: Not a device-ID/quirk/DT/docs/build fix; qualifies as a straight bug fix.
**Step 9.4 – Decision rationale**
This is a longstanding init-order bug: queue_count is set at allocation time but the IO tagset is created later. Error recovery during CONNECTING can call blk_mq_tagset_busy_iter() on an uninitialized tagset. The fix is minimal, reviewed by NVMe maintainers, applies cleanly to 6.18.44, and prevents kernel instability during exactly the failure scenarios stable users encounter (connectivity loss, admin queue connect failure). The complementary cancel_work_sync() prevents a race when IO queue creation fails partway through.
---
## Verification
- [Phase 1] Parsed subject, tags, body; identified hidden bug fix
- [Phase 2] Read diff: tagset guard + cancel_work_sync() in error path
- [Phase 3] git blame -L 2462: buggy check from 95ced8a2c72d (2020); early queue_count from 2016–2017
- [Phase 3] git log --oneline -20 -- drivers/nvme/host/fc.c: related commits identified; no duplicate fix
- [Phase 3] git merge-base --is-ancestor ee38469f88492 HEAD: upstream fix **NOT** in HEAD
- [Phase 3] git show 7e1a5ff60479b | git apply --check: applies cleanly
- [Phase 4] b4 dig -c 7e1a5ff60479b: lore URL found
- [Phase 4] b4 dig -a: standalone 1/1 patch confirmed
- [Phase 4] b4 dig -w: maintainers CC'd
- [Phase 4] UNVERIFIED: lore thread content (bot protection)
- [Phase 5] Traced call chain: ioerr_work → nvme_fc_error_recovery → __nvme_fc_abort_outstanding_ios
- [Phase 5] Verified nvme_alloc_io_tag_set() sets ctrl->tagset at core.c:4961
- [Phase 6] git describe HEAD: v6.18.44
- [Phase 6] Read HEAD fc.c:2462,2900: buggy code present
- [Phase 6] 0a2c5495b6d1e in tree: related but incomplete coverage
- [Phase 8] Failure mode: uninitialized lock in blk_mq_tagset_busy_iter, severity HIGH
**YES**
drivers/nvme/host/fc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +6 -1
@@ -2459,7 +2459,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)* io requests back to the block layer as part of normal completions * (but with error status). */ -if (ctrl->ctrl.queue_count >1 ) { +if (ctrl->ctrl.queue_count >1 && ctrl->ctrl.tagset) {nvme_quiesce_io_queues (&ctrl->ctrl);nvme_sync_io_queues (&ctrl->ctrl); blk_mq_tagset_busy_iter(&ctrl->tag_set,
@@ -2898,6 +2898,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) out_delete_hw_queues:nvme_fc_delete_hw_io_queues (ctrl); out_cleanup_tagset: +/* +* In CONNECTING state ctrl->ioerr_work will abort both admin +* and io tagsets. Cancel it first before removing io tagset. +*/ +cancel_work_sync (&ctrl->ioerr_work);nvme_remove_io_tag_set (&ctrl->ctrl);nvme_fc_free_io_queues (ctrl);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 gpio: dwapb: Mask interrupts at hardware initialization
In reply to Sasha LevinFrom: Liang Hao <[email protected]>
[ Upstream commit aaf7766ba3b99a3834319e7cf939838afc705574 ]
GPIO interrupts may retain stale state across warm reboots when peripherals remain powered. If a GPIO line is not explicitly configured for interrupts, this can result in interrupt storms due to missing handlers.
Fix this by ensuring all interrupts are masked and disabled at hardware initialization time via the init_hw() callback. Pending interrupts are also cleared to start from a known-safe state.
Interrupts will be unmasked only when explicitly configured by userspace or kernel drivers.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: gpio: dwapb: Mask interrupts at hardware initialization
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [gpio: dwapb] [Mask] — Ensure GPIO interrupt hardware is in a known-safe masked state during driver initialization.
### Step 1.2: Parse all commit message tags
**Record:**
- **Fixes:** — not present (expected for manual review)
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** — none
- **Acked-by:** — none
- **Link:** https://patch.msgid.link/[email protected]
- **Cc: stable:** — not present (not a negative signal)
- **Signed-off-by:** Liang Hao <[email protected]> (author)
- **Signed-off-by:** Bartosz Golaszewski <[email protected]> (GPIO maintainer)
Notable: maintainer sign-off; no syzbot/fuzzer report; no explicit user bug report in the message.
### Step 1.3: Analyze commit body
**Record:**
- **Bug:** GPIO interrupt registers can retain stale enabled/unmasked state across warm reboots when the GPIO block stays powered.
- **Symptom:** Interrupt storms on lines not explicitly configured for interrupts, because hardware is firing but software has no proper handler setup for those lines.
- **Root cause:** Driver did not reset interrupt enable/mask/EOI registers at probe time.
- **Fix approach:** Add init_hw callback that disables all interrupts (GPIO_INTEN=0), masks all lines (GPIO_INTMASK=0xffffffff), and clears pending interrupts (GPIO_PORTA_EOI=0xffffffff) before the irqchip/domain is fully operational.
- **Version info:** none stated in the message.
### Step 1.4: Detect hidden bug fixes
**Record:** Not disguised as cleanup — this is an explicit hardware-init bug fix. The failure mode (interrupt storm → potential soft lockup / system unresponsiveness) is a real stability bug, not cosmetic cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the changes
**Record:**
- **Files:** drivers/gpio/gpio-dwapb.c only (+16 lines net)
- **Functions added/modified:**
- New: dwapb_irq_init_hw()
- Modified: dwapb_configure_irqs() (assigns girq->init_hw)
- **Scope:** Single-file, surgical driver fix.
### Step 2.2: Code flow change per hunk
**Hunk 1 — new dwapb_irq_init_hw():**
- **Before:** No hardware interrupt reset at GPIO irqchip registration.
- **After:** On gpiochip_add_data(), gpiolib calls init_hw which writes:
- GPIO_INTEN = 0 (disable all interrupt enables)
- GPIO_INTMASK = 0xffffffff (mask all lines)
- GPIO_PORTA_EOI = 0xffffffff (clear all pending interrupts)
**Hunk 2 — dwapb_configure_irqs():**
- **Before:** girq->handler = handle_bad_irq, girq->default_type = IRQ_TYPE_NONE only.
- **After:** Also sets girq->init_hw = dwapb_irq_init_hw.
**Execution path:** Driver probe → dwapb_gpio_add_port() → dwapb_configure_irqs() → devm_gpiochip_add_data() → gpiochip_irqchip_init_hw() → dwapb_irq_init_hw().
### Step 2.3: Bug mechanism
**Record:** **Category (h): Hardware initialization / stale-state workaround**
The DesignWare APB GPIO block does not reset interrupt state on warm reboot if power is maintained. Without explicit masking at probe, lines left enabled from a prior boot can assert interrupts continuously. The driver sets handle_bad_irq as default handler, but unmasked hardware interrupts on unconfigured lines can still flood the CPU with IRQ activity.
The fix mirrors established patterns in other GPIO drivers (e.g. gpio- max77620.c explicitly documents bootloader-left interrupts).
### Step 2.4: Fix quality assessment
**Record:**
- **Quality:** High — minimal, register writes match existing driver register definitions and irq enable/disable logic.
- **Regression risk:** Very low — interrupts are only unmasked later via dwapb_irq_unmask() / dwapb_irq_enable() when explicitly configured.
- **Minor nuance:** On ACPI platforms, devm_request_irq() in dwapb_configure_irqs() runs *before* devm_gpiochip_add_data() triggers init_hw. This is a pre-existing ordering characteristic; the fix still addresses the steady-state stale-hardware problem and is strictly better than no masking. Verified in current tree code at lines 484–566 of gpio-dwapb.c.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame changed lines
**Record:** dwapb_configure_irqs() and surrounding interrupt code trace to 5d324e5159d9e (v6.18 merge base in this tree). The driver and interrupt path have been present since this tree's import; no init_hw hook was ever set for dwapb in this tree.
### Step 3.2: Follow Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: File history for related changes **Record:** Recent gpio-dwapb.c history in this tree:
- 5e15cf51982f8 gpio: dwapb: Defer clock gating until noirq
- 6c736c5ccf4a3 gpio: dwapb: reduce allocation to single kzalloc
- d7b5497e0e45b gpio: dwapb: Use modern PM macros
No related interrupt-init fix already present. Standalone patch, not part of a series.
### Step 3.4: Author's other commits
**Record:** No commits by Liang Hao found in this tree's history (git log --author returned empty). Author appears to be an external contributor; patch carries GPIO maintainer SOB.
### Step 3.5: Prerequisites / dependencies
**Record:**
- **init_hw infrastructure:** Present in this tree — include/linux/gpio/driver.h defines gpio_irq_chip::init_hw; gpiochip_irqchip_init_hw() in gpiolib.c calls it during gpiochip_add_data() at line 1196.
- **No other commits required.** Patch is self-contained.
- **Can apply standalone:** Yes.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:** Attempted b4 dig -c <commit> — commit not in local tree (not yet applied). Attempted lore fetch via WebFetch and curl — blocked by Anubis bot protection. **Could not retrieve mailing list thread content.**
### Step 4.2: Reviewers from b4 dig -w
**Record:** Not performed — commit hash unavailable locally; b4 requires -c COMMITISH.
### Step 4.3: Bug report search
**Record:** No Reported-by or syzbot link in commit message. No external bug report retrieved.
### Step 4.4: Related patches / series
**Record:** Appears to be a standalone 1-patch fix. No series indicators in subject.
### Step 4.5: Stable mailing list history
**Record:** Not searchable due to lore access failure. No stable-list discussion verified.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** dwapb_irq_init_hw() (new), dwapb_configure_irqs() (modified), called via gpiochip_irqchip_init_hw() in gpiolib.
### Step 5.2: Callers
**Record:**
- dwapb_configure_irqs() ← dwapb_gpio_add_port() ← dwapb_gpio_probe() (platform driver probe)
- gpiochip_irqchip_init_hw() ← gpiochip_add_data() ← devm_gpiochip_add_data()
- Probe runs at boot for all DesignWare APB GPIO instances (DT:
snps,dw-apb-gpio; ACPI on Intel platforms per driver comment).
### Step 5.3: Callees
**Record:** dwapb_write() / dwapb_read() — MMIO register accessors with v2 register offset remapping.
### Step 5.4: Call chain / reachability
**Record:** Triggered on every dwapb controller probe at boot (or module load). Warm reboot with powered GPIO block is the specific failure scenario. Affects embedded SoCs (RISC-V T-Head, Sophgo, many others in DT) and Intel ACPI platforms using shared GPIO IRQ lanes.
### Step 5.5: Similar patterns
**Record:** Identical pattern already used in this tree by:
- gpio-max77620.c — "GPIO interrupts may be left ON after bootloader"
- gpio-idt3243x.c — masks all interrupts in init_hw
- gpio-tangier.c — clears edge-detect registers in init_hw
This is an established, maintainer-accepted GPIO subsystem pattern.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE (6.18.44)
### Step 6.1: Does buggy code exist?
**Record:** **YES.** Current gpio-dwapb.c has no dwapb_irq_init_hw and no girq->init_hw assignment. dwapb_configure_irqs() at lines 472–474 sets only handler and default_type. The driver has been present in this tree without hardware interrupt masking at init.
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** File structure matches the patch context exactly. init_hw callback and gpiolib support are present. No conflicting changes identified.
### Step 6.3: Related fixes already present?
**Record:** **None.** grep for dwapb_irq_init_hw and init_hw in gpio-dwapb.c returns no matches.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **drivers/gpio** — IMPORTANT. GPIO/IRQ infrastructure affects many embedded and ACPI platforms. Interrupt storms are a system- wide stability issue.
### Step 7.2: Subsystem activity
**Record:** Active — recent dwapb commits in 6.18.y (PM, allocation, clock gating). Driver is maintained and in active use.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of DesignWare APB GPIO (CONFIG_GPIO_DWAPB) on platforms where the GPIO block retains power across warm reboot — embedded SoCs, Intel ACPI systems with shared GPIO IRQ lanes. Config- specific but affects a broad class of hardware.
### Step 8.2: Trigger conditions
**Record:**
- Warm reboot (not full power cycle)
- GPIO block stays powered
- Prior boot left interrupt enables/masks in non-default state
- Lines not re-configured for interrupts in new boot
- **Likelihood:** Platform-dependent but realistic on embedded/ACPI systems that use warm reboot
- **Unprivileged trigger:** No direct userspace trigger; boot-time / reboot-time hardware state issue
### Step 8.3: Failure mode severity
**Record:** **Interrupt storm** → sustained IRQ handling → CPU saturation → soft lockup / hung system / severely degraded responsiveness. **Severity: HIGH to CRITICAL** (system stability).
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH — prevents boot-time or post-warm-reboot interrupt storms on widely deployed IP block
- **Risk:** VERY LOW — ~16 lines, standard register init, no API changes, interrupts restored only when explicitly enabled
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compile
**FOR backport:**
- Fixes real hardware stale-state bug causing interrupt storms
- Can cause system hang / severe instability (HIGH severity)
- Small, surgical, obviously correct fix
- Uses existing init_hw infrastructure already in 6.18.44
- Precedent in multiple GPIO drivers in this same tree
- GPIO maintainer (Bartosz Golaszewski) signed off
- Buggy code confirmed present; fix not yet applied
- No dependencies on other commits
**AGAINST backport:**
- No syzbot report or explicit user bug report in commit message (weaker evidence of real-world hit rate)
- ACPI probe ordering means parent IRQ is requested before init_hw runs (minor window; pre-existing, not introduced by patch)
- Lore discussion could not be retrieved to confirm review feedback
**Unresolved:**
- Mailing list review thread content (lore blocked)
- Exact platforms where author observed the bug
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — register init matches driver conventions; maintainer SOB; pattern used elsewhere
2. Fixes a real bug? **PASS** — stale interrupt state on warm reboot
3. Important issue? **PASS** — interrupt storm / system stability
4. Small and contained? **PASS** — one file, ~16 lines
5. No new features/APIs? **PASS** — uses existing init_hw callback
6. Can apply to local tree? **PASS** — infrastructure present, clean apply expected
### Step 9.3: Exception categories
**Record:** Hardware workaround / driver initialization quirk — qualifies under stable exception for hardware-specific workarounds that fix real hardware behavior.
### Step 9.4: Decision rationale
This commit fixes a genuine stability bug in a widely used GPIO controller driver. The failure mode (interrupt storm after warm reboot) is serious, the fix is minimal and follows an established pattern already present in this tree's GPIO subsystem, and all prerequisites exist in Linux 6.18.44. The fix is not yet in this tree and should be backported.
---
## Verification
- [Phase 1] git describe HEAD → v6.18.44-1-g2736c32da98b9; Makefile → 6.18.44
- [Phase 1] Parsed commit message tags from user-provided content
- [Phase 2] Read drivers/gpio/gpio-dwapb.c lines 182–509, 750–875; confirmed diff targets match current code structure
- [Phase 2] Verified register constants GPIO_INTEN, GPIO_INTMASK, GPIO_PORTA_EOI at lines 35–41
- [Phase 2] Verified irq enable/disable logic at lines 283–313 uses same registers the fix initializes
- [Phase 3] git blame -L 454,490 drivers/gpio/gpio-dwapb.c → code from v6.18 merge base
- [Phase 3] git log --oneline -20 -- drivers/gpio/gpio-dwapb.c → recent PM/allocation commits, no interrupt-init fix
- [Phase 3] grep init_hw drivers/gpio/gpio-dwapb.c → no matches (fix not present)
- [Phase 3] git log -S 'init_hw' -- drivers/gpio/gpiolib.c → infrastructure present since tree base
- [Phase 4] b4 dig -c — failed (commit not in tree)
- [Phase 4] WebFetch + curl lore URL — blocked by Anubis; thread content UNVERIFIED
- [Phase 5] Read gpiolib.c lines 1185–1202 — gpiochip_irqchip_init_hw() called before gpiochip_add_irqchip()
- [Phase 5] grep init_hw drivers/gpio/ → found precedent in max77620, idt3243x, tangier, realtek-otto
- [Phase 5] Read gpio-max77620.c lines 263–274 — identical rationale ("left ON after bootloader")
- [Phase 6] Confirmed dwapb_configure_irqs() lacks girq->init_hw at line 472–474
- [Phase 6] Confirmed include/linux/gpio/driver.h has init_hw at line 264
- [Phase 6] grep snps,dw-apb-gpio → multiple DT platforms (T-Head th1520, Sophgo sg2042, etc.)
- [Phase 7] drivers/gpio/Kconfig line 273 — CONFIG_GPIO_DWAPB tristate driver exists
- [Phase 8] Analyzed ACPI vs non-ACPI probe order in dwapb_configure_irqs() + dwapb_gpio_add_port()
**YES**
drivers/gpio/gpio-dwapb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpio/gpio-dwapb.c +17 -0
@@ -201,6 +201,22 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)dwapb_write (gpio,GPIO_INT_POLARITY , pol); } +static int dwapb_irq_init_hw (struct gpio_chip *gc) +{ +struct dwapb_gpio *gpio =to_dwapb_gpio (gc); + +/* +* GPIO interrupts may retain stale state across warm reboots when +* peripherals stay powered. Force a known-safe state before the GPIO +* irqchip and irq domain are set up. +*/ +dwapb_write (gpio,GPIO_INTEN ,0 ); +dwapb_write (gpio,GPIO_INTMASK ,0xffffffff ); +dwapb_write (gpio,GPIO_PORTA_EOI ,0xffffffff ); + +return 0 ; +} +static u32 dwapb_do_irq (struct dwapb_gpio *gpio) {struct gpio_generic_chip *gen_gc = &gpio->ports[0 ].chip;
@@ -472,6 +488,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, girq = &gc->irq; girq->handler = handle_bad_irq; girq->default_type =IRQ_TYPE_NONE ; + girq->init_hw = dwapb_irq_init_hw; port->pirq = pirq;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ALSA: hda/realtek: Add mute LED quirk for HP Victus 16-e0xxx (MB 88ED)
In reply to Sasha LevinFrom: André Pragosa <[email protected]>
[ Upstream commit 630c45e92db44b738d1e9224c5f3c032c76a33ca ]
Add subsystem ID 103c:88ed to the existing HP Victus 16-e0xxx mute LED quirk list.
The HP Victus 16-e0xxx with subsystem ID 103c:88ed uses the same mute LED coefficient configuration as the already supported 103c:88eb variant.
The mute LED was verified by manually toggling coefficient index 0x0b (bit 3) using hda-verb. After adding the quirk, the LED is registered as hda::mute and follows the audio mute state.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ALSA hda/realtek HP Victus 16-e0xxx (MB 88ED) mute LED quirk
**Local tree:** Linux **6.18.44** (git describe HEAD → v6.18.44-2-g1b9e1abadee04)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [ALSA: hda/realtek] [Add] mute LED quirk for HP Victus 16-e0xxx (MB 88ED)
### Step 1.2: Tags
**Record:**
- **Signed-off-by:** André Pragosa <[email protected]> (author)
- **Link:** https://patch.msgid.link/[email protected]
- **Signed-off-by:** Takashi Iwai <[email protected]> (ALSA maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked- by:, or Cc: [email protected]
- Notable: maintainer sign-off from Takashi Iwai; no syzbot or user bug reports
### Step 1.3: Body analysis
**Record:**
- **Bug:** HP Victus 16-e0xxx with subsystem ID 103c:88ed does not get the mute-LED quirk; the F-key mute LED does not track audio mute state.
- **Symptom:** Mute LED stays non-functional; audio mute itself is unaffected.
- **Root cause:** Missing SND_PCI_QUIRK table entry for this mainboard variant.
- **Fix approach:** Reuse ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT (same as 103c:88eb).
- **Verification:** Author tested coefficient index 0x0b bit 3 via hda-verb; after quirk, LED registers as hda::mute and follows mute state.
- **Version info:** None in message.
### Step 1.4: Hidden bug fix?
**Record:** Not a crash/leak/race fix. This is an explicit **hardware quirk / device-ID extension** for mute-LED support on a specific laptop SKU. Classified as hardware enablement, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** sound/hda/codecs/realtek/alc269.c only (+2 lines, minor formatting)
- **Functions modified:** None; only alc269_fixup_tbl[] quirk table
- **Scope:** Single-file, surgical quirk-table addition
### Step 2.2: Code flow change
**Record:**
- **Before:** snd_hda_pick_fixup() during codec probe finds no match for SSID 103c:88ed → no mute-LED fixup applied.
- **After:** SSID 103c:88ed maps to ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT → alc245_fixup_hp_mute_led_v2_coefbit() runs at HDA_FIXUP_ACT_PRE_PROBE, configures coef 0x0b bit 3, registers hda::mute LED class device.
- **Path affected:** HDA codec probe for matching HP Victus hardware only.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Hardware workaround (audio codec quirk)
- **Mechanism:** Missing PCI subsystem ID in quirk table prevents existing, correct fixup from being selected.
### Step 2.4: Fix quality
**Record:**
- **Quality:** Obviously correct — identical fixup to already-supported 103c:88eb sibling variant; manually verified.
- **Regression risk:** Very low — adds one table row, no logic changes.
- **Red flags:** None.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- Adjacent entry 0x88eb introduced in commit 9745c2561e55f (2026-01-13, Bharat Dev Burman): *"add HP Victus 16-e0xxx mute LED quirk"*
- That commit also introduced ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT and alc245_fixup_hp_mute_led_v2_coefbit().
- 0x88ed is absent from this tree (confirmed via grep).
### Step 3.2: Fixes: tag
**Record:** No Fixes: tag present; not applicable.
### Step 3.3: Related file history
**Record:**
- Multiple similar mute-LED quirk commits already in this 6.18.y tree, including:
- 9745c2561e55f — Victus 16-e0xxx (0x88eb) + V2 fixup (prerequisite)
- a424946e00f2e, 7556bd5cd8ef3, 8db3663d3c3e2, bee43f7b9bc62,
`3210077ed2648` — other HP mute-LED quirks
- Standalone one-liner; not part of a multi-patch series.
### Step 3.4: Author context
**Record:** André Pragosa has no prior commits in sound/hda/codecs/realtek/ in this tree. Takashi Iwai (maintainer) signed off.
### Step 3.5: Dependencies
**Record:**
- **Requires:** ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT and alc245_fixup_hp_mute_led_v2_coefbit() — **both present** (from 9745c2561e55f, confirmed ancestor of HEAD).
- **Standalone:** Yes; only adds a quirk-table entry.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig -c <commit> not possible — commit hash not in local tree. b4 dig with patch URL failed (wrong invocation). Lore/patch.msgid.link blocked by bot protection (Anubis). **UNVERIFIED:** full review thread content.
### Step 4.2: Reviewers
**Record:** **UNVERIFIED** via b4 -w. Commit message shows Takashi Iwai maintainer sign-off.
### Step 4.3: Bug report
**Record:** No external bug report linked. Author self-reported hardware issue and manual verification.
### Step 4.4: Related patches
**Record:** Part of ongoing HP Victus mute-LED quirk pattern; sibling 0x88eb fix already in this tree. Commit message references 0x88eb as the matching configuration.
### Step 4.5: Stable list history
**Record:** **UNVERIFIED** — lore.kernel.org inaccessible. Precedent in this tree: similar mute-LED quirks already backported.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** No functions modified. Affected data: alc269_fixup_tbl[]. Selected fixup: alc245_fixup_hp_mute_led_v2_coefbit().
### Step 5.2: Callers
**Record:** snd_hda_pick_fixup(codec, alc269_fixup_models, alc269_fixup_tbl, alc269_fixups) called from codec init at line 8471 during HDA probe. Standard path for every Realtek ALC269-family codec load.
### Step 5.3: Callees
**Record:** Fixup calls snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set) which hooks LED brightness to codec coefficient updates.
### Step 5.4: Reachability
**Record:** Triggered at boot/module load when HDA codec probes on hardware with SSID 103c:88ed. Not userspace-triggerable after probe; affects only matching HP Victus 16-e0xxx machines.
### Step 5.5: Similar patterns
**Record:** Many adjacent SND_PCI_QUIRK entries for HP mute LEDs in the same table, including 0x88eb (same fixup) and 0x8a3d (Victus 15, same V2 fixup).
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **Yes.** 0x88eb is supported but 0x88ed is missing (grep 0x88ed → no matches). Affected hardware on 6.18.44 gets no mute- LED fixup. Prerequisite V2 fixup infrastructure has been in tree since 9745c2561e55f.
### Step 6.2: Backport complications
**Record:** **Clean apply expected.** Insert one SND_PCI_QUIRK line after existing 0x88eb entry at line 6809. Mainline diff references 0x88ee entry not yet in 6.18.44; no conflict — patch simply adds 0x88ed after 0x88eb.
### Step 6.3: Related fixes already present?
**Record:** Prerequisite commit 9745c2561e55f (88eb + V2 fixup) is in tree. No duplicate 0x88ed entry. No alternate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **sound/ALSA hda/realtek** — IMPORTANT (laptop audio/LED UX), PERIPHERAL for users without this exact hardware.
### Step 7.2: Subsystem activity
**Record:** Active — frequent HP mute-LED quirk commits in recent alc269.c history; this file is actively maintained for new laptop SKUs.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Owners of HP Victus 16-e0xxx laptops with mainboard SSID 103c:88ed and Realtek ALC245 codec. Driver-specific, hardware-specific population.
### Step 8.2: Trigger conditions
**Record:** Every boot/probe on matching hardware. Common for affected owners; zero impact on all other systems. Unprivileged users cannot trigger; not a security issue.
### Step 8.3: Failure mode severity
**Record:** Mute LED does not reflect audio mute state. Audio function unaffected. **Severity: LOW** (UX/cosmetic indicator). Not crash, corruption, deadlock, or security.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Enables expected F-key mute LED behavior on an additional Victus SKU; matches established stable practice for HP HDA quirks in this tree.
- **Risk:** Minimal — 2-line table addition, existing fixup, maintainer- reviewed.
- **Ratio:** High benefit for affected users, negligible risk for everyone else.
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Hardware quirk / device-ID extension (explicit stable exception category)
- Trivial, surgical 2-line change
- Reuses proven fixup already in tree for sibling 0x88eb variant
- Manually verified by author; Takashi Iwai sign-off
- Prerequisite infrastructure present (9745c2561e55f is ancestor of HEAD)
- Multiple analogous HP mute-LED quirk commits already backported to this 6.18.y tree
- Clean apply expected
**AGAINST backport:**
- Not a crash, security, corruption, or deadlock fix
- Does not meet strict "important issue" wording in stable rules if quirks exception is not applied
- No syzbot/user bugzilla report
- Lore review thread not accessible for independent verification
**UNRESOLVED:**
- Full mailing-list review discussion (lore blocked)
- Whether reviewers explicitly nominated for stable
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — same fixup as 0x88eb, hda- verb verified, maintainer SOB
2. Fixes a real bug? **PASS** — mute LED non-functional on matching hardware
3. Important issue? **PASS (via quirk exception)** — LOW severity UX bug; qualifies under audio codec quirk / hardware workaround exception routinely accepted for stable
4. Small and contained? **PASS** — 2 lines, one table entry
5. No new features/APIs? **PASS** — quirk table extension only; no new fixup type or userspace API
6. Can apply to local tree? **PASS** — prerequisites present, clean insert after 0x88eb
### Step 9.3: Exception category
**Record:** **Hardware quirk / device ID addition** — SND_PCI_QUIRK entry for existing ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT fixup on HP Victus 16-e0xxx (MB 88ED).
### Step 9.4: Decision rationale
For **Linux 6.18.44**, this commit should be backported. The missing quirk leaves mute LED broken on a specific HP Victus SKU while audio works; the fix is a two-line table entry reusing an already-present, maintainer-accepted fixup (9745c2561e55f). This matches the established pattern of HP mute-LED quirk backports already present in this stable tree. Risk is negligible; benefit is real for affected laptop owners.
---
## Verification
- **[Phase 1]** Parsed subject, tags, and body from user-provided commit message
- **[Phase 2]** Diff analysis: +2 lines to alc269_fixup_tbl[], no function changes
- **[Phase 3]** git describe HEAD → v6.18.44; make kernelversion equivalent via Makefile → 6.18.44
- **[Phase 3]** git log -S "0x88eb" → prerequisite 9745c2561e55f
- **[Phase 3]** git log -S "ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT" → introduced in 9745c2561e55f, 2e8194b4fdee7
- **[Phase 3]** git merge-base --is-ancestor 9745c2561e55f HEAD → prerequisite is in tree
- **[Phase 3]** git blame -L 6809 → 0x88eb line from 9745c2561e55f
- **[Phase 3]** grep 0x88ed → not in tree (bug present)
- **[Phase 3]** grep 0x88ee → not in tree (mainline context differs; no apply conflict)
- **[Phase 4]** b4 dig -c → not run (commit not in tree)
- **[Phase 4]** b4 dig <url> → failed (incorrect usage)
- **[Phase 4]** WebFetch lore/patch.msgid.link → blocked by Anubis bot protection
- **[Phase 4]** curl lore → blocked by Anubis
- **[Phase 5]** Read alc245_fixup_hp_mute_led_v2_coefbit() at lines 1598–1612
- **[Phase 5]** Read snd_hda_pick_fixup() call at line 8471
- **[Phase 5]** grep alc269_fixup_tbl → table at 6510, used at 8472
- **[Phase 6]** Confirmed ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT enum, fixup struct, and function all exist
- **[Phase 6]** Confirmed 0x88eb at line 6809, 0x88ed absent
- **[Phase 7]** git log --grep="mute LED" → multiple similar quirk commits in tree including 9745c2561e55f, a424946e00f2e
- **[Phase 8]** Failure mode assessed as non-crash LED indicator issue, LOW severity
- **UNVERIFIED:** Mailing-list reviewer feedback and explicit stable nominations
**YES**
sound/hda/codecs/realtek/alc269.c | 2 ++ 1 file changed, 2 insertions(+)
sound/hda/codecs/realtek/alc269.c +2 -0
@@ -6856,6 +6856,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x88d1 ,"HP Pavilion 15-eh1xxx (mainboard 88D1)" ,ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x88dd ,"HP Pavilion 15z-ec200" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x88eb ,"HP Victus 16-e0xxx" ,ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT ), +SND_PCI_QUIRK (0x103c ,0x88ed ,"HP Victus 16-e0xxx (MB 88ED)" , +ALC245_FIXUP_HP_MUTE_LED_V2_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x88ee ,"HP Victus 16-e0xxx (MB 88EE)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8902 ,"HP OMEN 16" ,ALC285_FIXUP_HP_MUTE_LED ), SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net/rds: Don't sleep inside rds_ib_conn_path_shutdown
In reply to Sasha LevinFrom: Allison Henderson <[email protected]>
[ Upstream commit 16f48efaeb6991193fb7775c577f06f5b20b0c90 ]
New rds rdma self tests exposed a hang when tearing down the ib network configs. This is caused by the shutdown worker thread sleeping on the wait_event call, which blocks other work items in the queue. Fix this by changing wait_event to wait_event timeout, and looping until the wait check succeeds.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: net/rds: Don't sleep inside rds_ib_conn_path_shutdown
**Local tree:** v6.18.44 (Makefile: 6.18.44)
**Verdict target:** Should this commit be backported to **this** 6.18.y tree?
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the subject line
**Record:** [net/rds] [Don't sleep / fix] — prevent indefinite sleeping in rds_ib_conn_path_shutdown() during IB connection teardown.
### Step 1.2: Parse all commit message tags
**Record:**
- **Signed-off-by:** Allison Henderson <[email protected]> (author)
- **Link:** https://patch.msgid.link/20260518012443.2629206-2- [email protected] (patch 2 of a series, per Message-ID)
- **Signed-off-by:** Jakub Kicinski <[email protected]> (netdev maintainer merge)
- No Fixes:, Reported-by:, Cc: [email protected], Tested- by:, or Reviewed-by: tags
- Notable: no syzbot report; bug found by new RDS RDMA selftests
### Step 1.3: Analyze commit body
**Record:**
- **Bug:** Hang when tearing down IB network configs during new RDS RDMA selftests
- **Symptom:** System/workqueue stalls during teardown (not a crash/oops)
- **Root cause (author):** Shutdown worker sleeps on wait_event, blocking other work items on the same queue
- **Fix approach:** Replace wait_event with wait_event_timeout in a loop; schedule send/recv tasklets on timeout to drive completion
### Step 1.4: Detect hidden bug fixes
**Record:** Yes — despite not using "fix" in the subject, this is a real hang fix disguised as a sleep/workqueue interaction problem. The infinite wait_event in a single-threaded workqueue context is a classic teardown hang pattern.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory changes
**Record:**
- **Files:** net/rds/ib_cm.c only (+15 lines net, ~1 function added, 1 function modified)
- **Functions:** new rds_ib_conn_path_shutdown_check_wait(), modified rds_ib_conn_path_shutdown()
- **Scope:** Single-file surgical fix
### Step 2.2: Code flow change per hunk
**Record:**
**Hunk 1 — new helper rds_ib_conn_path_shutdown_check_wait():**
- Before: N/A
- After: Encapsulates the shutdown-ready condition (recv ring empty, no signaled sends, FRWR segments released). Returns 0 when ready, non- zero otherwise.
**Hunk 2 — rds_ib_conn_path_shutdown():**
- Before: After rdma_disconnect() and rds_ib_flush_mrs(), blocks forever on:
```c wait_event(rds_ib_ring_empty_wait, <all conditions true>); ```
- After: Loops with 1-second timeout; on timeout, explicitly schedules i_send_tasklet and i_recv_tasklet to make progress, then re-checks until conditions are met.
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Deadlock/hang in teardown path (workqueue + async completion interaction)
- **Mechanism:**
1. rds_ib_conn_path_shutdown() runs on rds_wq via rds_shutdown_worker() → rds_conn_shutdown()
2. rds_wq is a **single-threaded** workqueue
(`create_singlethread_workqueue("krdsd")` in `threads.c:259`) 3. wait_event() puts that sole worker thread to sleep indefinitely
4. Wait conditions require send/recv ring draining and FRWR cleanup, which depends on tasklet progress (i_send_tasklet / i_recv_tasklet, normally kicked from CQ handlers at ib_cm.c:256,384)
5. Without explicit tasklet scheduling, the worker can sleep forever while also blocking all other rds_wq work — including other connection shutdowns during IB config teardown
### Step 2.4: Fix quality assessment
**Record:**
- Fix is minimal and logically sound: same wait conditions, but bounded sleep + explicit tasklet kicks
- Still calls tasklet_kill() after the loop, preserving original safety
- Low regression risk: does not change teardown ordering or destroy IB resources early
- Minor style note: helper returns msecs_to_jiffies(1000) when not ready, but only == 0 is tested — harmless
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame changed lines
**Record:**
- wait_event(rds_ib_ring_empty_wait, ...) introduced in ec16227e14141 (Andy Grover, 2009) — RDS/IB transport
- Signaled-sends condition: f046011cd73c3 (2010)
- i_fastreg_inuse_count wait: 3a2886cca703f (Gerd Rausch, 2019) — "Keep track of and wait for FRWR segments in use upon shutdown"
- Buggy infinite wait has been present since at least 2019 in its current form; newly exposed under concurrent IB teardown/selftests
### Step 3.2: Follow Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: File history for related changes
**Record:**
- Recent ib_cm.c changes in this tree are unrelated (IPv6 NULL deref, setup unwind, ib_modify_qp removal)
- RDS selftest infrastructure added in 3ade6ce1255e6 (Aug 2024) — TCP- focused initially; new RDMA selftests triggered this hang
- No conflicting recent refactor of the shutdown path in 6.18.y
### Step 3.4: Author's other commits
**Record:**
- Allison Henderson is an active RDS maintainer (Oracle)
- Prior stability fix in this tree: f1acf1ac84d2a "net:rds: Fix possible deadlock in rds_message_put" (syzbot-reported deadlock, 2024)
- Same subsystem, same author pattern of fixing RDS teardown/concurrency bugs
### Step 3.5: Prerequisites / dependencies
**Record:**
- Message-ID indicates patch 2/2 of a series (likely selftests + this fix)
- **This fix is standalone** — it only modifies ib_cm.c shutdown logic; does not depend on selftest patches to be correct
- No structural/API prerequisites; applies cleanly to current 6.18.44 code
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original patch discussion
**Record:** **UNVERIFIED** — b4 dig requires a commit hash (commit not in this tree); lore.kernel.org and patch.msgid.link blocked by Anubis bot protection. Could not read thread discussion.
### Step 4.2: Reviewers
**Record:** **UNVERIFIED** — b4 dig -w not possible without commit hash.
### Step 4.3: Bug report
**Record:** Bug found by new RDS RDMA selftests during IB network config teardown. No external bugzilla/syzbot link. Selftests added separately (3ade6ce1255e6 and follow-ups in this tree).
### Step 4.4: Related patches / series
**Record:** Patch 2 of series per Message-ID (...-2-achender@...). Patch 1 likely adds RDMA selftests that expose the hang. Fix itself is independent.
### Step 4.5: Stable mailing list
**Record:** **UNVERIFIED** — could not search lore stable list due to bot protection.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** rds_ib_conn_path_shutdown(), rds_ib_conn_path_shutdown_check_wait() (new), callers unchanged.
### Step 5.2: Trace callers
**Record:**
- rds_ib_conn_path_shutdown registered as conn_path_shutdown in ib.c:571
- Called from rds_conn_shutdown() (connection.c:401)
- rds_conn_shutdown() called by rds_shutdown_worker() (threads.c:249)
- rds_shutdown_worker runs on rds_wq via queue_work(rds_wq, &cp->cp_down_w) (connection.c:905)
- Also reached via rds_conn_path_destroy() → rds_conn_path_drop() → flush_work(&cp->cp_down_w) (connection.c:457-458)
- Module exit: rds_ib_exit() → rds_ib_destroy_nodev_conns() → rds_conn_destroy() → shutdown path
### Step 5.3: Key callees
**Record:** rdma_disconnect(), rds_ib_flush_mrs(), wait_event/wait_event_timeout, tasklet_schedule(), tasklet_kill(), rdma_destroy_qp(), ib_destroy_cq()
### Step 5.4: Call chain / reachability
**Record:**
- Triggered during connection drop, module unload (rds_ib_exit), IB device removal, network namespace teardown
- Requires CONFIG_RDS + CONFIG_RDS_RDMA (tristate modules)
- Reachable from admin operations (rmmod, IB config changes) — not a random syscall path, but real production teardown scenarios (Oracle RAC clusters using RDS over IB)
### Step 5.5: Similar patterns
**Record:** Prior RDS hang/deadlock fixes in history (f1acf1ac84d2a, 7b4b000951f09, 9c79440e2c5e2) confirm this subsystem has had stable- worthy concurrency/teardown issues before.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Does buggy code exist?
**Record:** **YES.** Current net/rds/ib_cm.c:1086-1090 still has the infinite wait_event. Fix is **not** present in v6.18.44.
### Step 6.2: Backport complications
**Record:** Clean apply expected — no recent refactor of this function in 6.18.y. File structure matches the patch context exactly.
### Step 6.3: Related fixes already present?
**Record:** No equivalent timeout/tasklet-kick fix found. FRWR wait logic from 3a2886cca703f is present (the conditions being waited on).
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** net/rds — **IMPORTANT** for Oracle RAC / RDMA cluster users; **PERIPHERAL** for general Linux users (optional CONFIG_RDS_RDMA module).
### Step 7.2: Subsystem activity
**Record:** Actively maintained — recent fixes in 6.18.y (IPv6 NULL deref, zerocopy pin failure, selftest infrastructure). Not a dead subsystem.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users with CONFIG_RDS_RDMA enabled — primarily enterprise cluster deployments (Oracle RAC). Not universal, but production-critical for that population.
### Step 8.2: Trigger conditions
**Record:**
- IB connection teardown, especially multiple concurrent shutdowns (IB network config teardown)
- Module unload (rds_ib_exit / rds_rdma_exit)
- Not easily triggered by unprivileged users; admin/module operations
- Selftests reliably reproduce; production impact likely under similar admin teardown scenarios
### Step 8.3: Failure mode severity
**Record:** **Hang** — single-threaded rds_wq worker blocked indefinitely; teardown never completes, flush_work may never return, module unload stalls. **Severity: HIGH** for affected configs (system/admin operation hangs); **LOW** for users without RDS/RDMA.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for RDS/IB users — prevents teardown/module-unload hangs
- **Risk:** LOW — ~15 lines, same wait conditions, well-understood tasklet kick pattern
- **Ratio:** Favorable for backport to 6.18.y
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence compile
**FOR backport:**
- Real hang during connection/IB config teardown
- Buggy code confirmed present in v6.18.44
- Small, surgical, obviously correct fix
- Runs on single-threaded workqueue — blocking sleep is a known anti- pattern
- Same maintainer (Allison Henderson) has prior stable-worthy RDS deadlock fixes
- Module unload path (rds_ib_exit → rds_conn_destroy → shutdown) is affected
- Fix does not require companion selftest patches
**AGAINST backport:**
- CONFIG_RDS_RDMA is niche/optional
- No syzbot or widespread user reports — found by new selftests
- Underlying wait_event pattern existed since 2009 (may indicate rare production trigger)
- Lore review/stable nomination not verified
**UNRESOLVED:**
- Mailing list review discussion and any explicit stable nominations
### Step 9.2: Stable rules checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — logic is sound; selftests found the bug | | 2. Fixes a real bug? | **PASS** — teardown hang | | 3. Important issue? | **PASS** — hang on admin teardown/module unload (HIGH for RDS/IB users) | | 4. Small and contained? | **PASS** — one file, ~15 lines | | 5. No new features/APIs? | **PASS** — behavior fix only | | 6. Can apply to local tree? | **PASS** — code present, clean apply expected |
### Step 9.3: Exception categories
**Record:** None (not a device ID, quirk, DT, build, or docs fix). Qualifies on merit as a hang fix.
### Step 9.4: Decision rationale
For **Linux 6.18.44**: the buggy wait_event in rds_ib_conn_path_shutdown() is present, the fix is small and self- contained, and it addresses a real hang during IB connection teardown on the single-threaded rds_wq workqueue. While RDS over IB is not universal, hangs during module unload or IB network reconfiguration are exactly the kind of issues stable trees should fix — especially with a low-risk, surgical patch from the subsystem maintainer.
---
## Verification
- **[Phase 1]** Parsed commit message: subject, tags, body; no Fixes:/Reported-by:/Cc: stable
- **[Phase 2]** Read diff and current net/rds/ib_cm.c:1051-1092; confirmed wait_event → timeout loop + tasklet schedule change
- **[Phase 3]** git describe HEAD → v6.18.44; git blame -L 1086,1090 → wait since 2009, FRWR conditions since 2019 (3a2886cca703f); git log --oneline -20 -- net/rds/ib_cm.c
- **[Phase 3]** git show 3a2886cca703f — FRWR shutdown wait introduction
- **[Phase 3]** git show f1acf1ac84d2a — prior RDS deadlock fix by same author
- **[Phase 4]** b4 dig — failed (commit not in tree, needs -c COMMITISH)
- **[Phase 4]** WebFetch/curl lore.kernel.org — blocked by Anubis; **UNVERIFIED** mailing list review
- **[Phase 5]** grep rds_ib_conn_path_shutdown — call chain through connection.c, threads.c, ib.c
- **[Phase 5]** Read threads.c:257-263 — confirmed create_singlethread_workqueue("krdsd")
- **[Phase 5]** Read connection.c:368-401, 905, 457-458 — shutdown worker path
- **[Phase 5]** Read ib_cm.c:247-257, 375-385 — CQ handlers schedule tasklets
- **[Phase 5]** Read ib_rdma.c:161-173, 524-537 — rds_ib_flush_mrs() and destroy path
- **[Phase 6]** grep wait_event(rds_ib_ring_empty_wait — buggy code at ib_cm.c:1086 in this tree
- **[Phase 6]** grep rds_ib_conn_path_shutdown_check_wait — not present (fix not applied)
- **[Phase 7]** Read net/rds/Kconfig — CONFIG_RDS_RDMA is tristate, depends on INFINIBAND
- **[Phase 8]** Traced module exit: ib.c:536-548 → rds_ib_destroy_nodev_conns() → rds_conn_destroy()
This commit should be backported to the local 6.18.y tree: it fixes a confirmed teardown hang with a minimal, low-risk change that applies cleanly to code already present in v6.18.44.
**YES**The background searches finished. They didn’t turn up the commit itself in this tree (expected — the fix isn’t in v6.18.44 yet), but they did add useful context:
- The wait_event shutdown logic traces back to the original RDS/IB transport (2009), with the FRWR wait conditions added in 3a2886cca703f (2019).
- Allison Henderson has other RDS stability fixes here, including f1acf1ac84d2a (deadlock in rds_message_put).
That supports the earlier analysis: the hang is in long-standing teardown code, and this is a small, maintainer-authored stability fix worth backporting to 6.18.y.
**YES**
net/rds/ib_cm.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
net/rds/ib_cm.c +20 -5
@@ -1043,6 +1043,19 @@ int rds_ib_conn_path_connect(struct rds_conn_path *cp)return ret; } +static unsigned long rds_ib_conn_path_shutdown_check_wait (struct rds_conn_path *cp) +{ +struct rds_connection *conn = cp->cp_conn; +struct rds_ib_connection *ic = conn->c_transport_data; + +return (!ic->i_cm_id || + (rds_ib_ring_empty (&ic->i_recv_ring) && + (atomic_read (&ic->i_signaled_sends) ==0 ) && + (atomic_read (&ic->i_fastreg_inuse_count)) ==0 && + (atomic_read (&ic->i_fastreg_wrs) ==RDS_IB_DEFAULT_FR_WR ))) ?0 + :msecs_to_jiffies (1000 ); +} +/* * This is so careful about only cleaning up resources that were built up * so that it can be called at any point during startup. In fact it
@@ -1083,11 +1096,13 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)* sends to complete we're ensured that there will be no * more tx processing. */ -wait_event (rds_ib_ring_empty_wait, -rds_ib_ring_empty (&ic->i_recv_ring) && - (atomic_read (&ic->i_signaled_sends) ==0 ) && - (atomic_read (&ic->i_fastreg_inuse_count) ==0 ) && - (atomic_read (&ic->i_fastreg_wrs) ==RDS_IB_DEFAULT_FR_WR )); +while (!wait_event_timeout (rds_ib_ring_empty_wait, +rds_ib_conn_path_shutdown_check_wait (cp) ==0 , +msecs_to_jiffies (1000 ))) { +tasklet_schedule (&ic->i_send_tasklet); +tasklet_schedule (&ic->i_recv_tasklet); + } +tasklet_kill (&ic->i_send_tasklet);tasklet_kill (&ic->i_recv_tasklet);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 thunderbolt: Set tb->root_switch to NULL when domain is stopped
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit e56249d8a68e712f3b60e1f3fdbb5b4fea146468 ]
Similarly what we do with the firmware connection manager. This makes tb_xdp_handle_request() return error to the remote host. However, we need to make sure we keep the uuid alive so that we can reply until the whole domain is released.
---
LLM Generated explanations, may be completely bogus:
The background git branch -a --contains lookup timed out — this repo has too many branches for that to finish quickly.
The analysis itself is complete. **Verdict: YES** for backport to this tree (linux-6.18.y at v6.18.43).
The fix is missing from your current checkout and from stable/linux-6.18.y, but is already present in mainline (origin/master). It's a small teardown fix: tb_stop() leaves a dangling tb->root_switch after switch removal, which can cause a UAF crash when in-flight XDomain request work runs during driver unload. The patch mirrors what icm_stop() already does and applies cleanly here.The git branch -a --contains e56249d8a68e7 lookup timed out again — too many branches in this repo for that to finish in a reasonable time.
I checked the important branches directly instead: the fix is **not** in your current 6.18.43 checkout or stable/linux-6.18.y, but **is** in origin/master. That supports the earlier **YES** backport verdict.
drivers/thunderbolt/tb.c | 1 + drivers/thunderbolt/xdomain.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/thunderbolt/tb.c +1 -0
@@ -2952,6 +2952,7 @@ static void tb_stop(struct tb *tb)tb_tunnel_put (tunnel); }tb_switch_remove (tb->root_switch); + tb->root_switch =NULL ; tcm->hotplug_active = false;/* signal tb_handle_hotplug to quit */ }
drivers/thunderbolt/xdomain.c +5 -1
@@ -756,7 +756,7 @@ static void tb_xdp_handle_request(struct work_struct *work)mutex_lock (&tb->lock);if (tb->root_switch) - uuid = tb->root_switch->uuid; + uuid =kmemdup (tb->root_switch->uuid,sizeof (*uuid),GFP_KERNEL );else uuid =NULL ;mutex_unlock (&tb->lock);
@@ -870,6 +870,7 @@ static void tb_xdp_handle_request(struct work_struct *work) } out: +kfree (uuid);kfree (xw->pkg);kfree (xw);
@@ -2344,6 +2345,9 @@ static struct tb_xdomain *switch_find_xdomain(struct tb_switch *sw, {struct tb_port *port; +if (!sw) +return NULL ; +tb_switch_for_each_port (sw, port) {struct tb_xdomain *xd;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 thunderbolt: Don't disable lane adapter if XDomain lane bonding isn't possible
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit 7c7345bcde6c611fa8fa13e624207c6005798aa8 ]
This happens when firmware connection manager is being used. It will deal with disabling the lane 1 adapter after the tunnel has been established and re-enabling it afterwards. For this reason only do this when we know that lane bonding is possible (e.g running software connection manager).
---
LLM Generated explanations, may be completely bogus:
The background git log --all search was killed — it was hanging on this repo, as expected.
A follow-up git log -S 'tb_xdomain_link_exit' (without --all) finished after ~48s, but the hits (19eef1d98eeda, ac3fd01e4c1ef) are base-import commits, not a clean “introduced in commit X” answer. That’s normal on this 6.18.y tree where history is squashed.
The backport analysis doesn’t depend on that: the buggy tb_xdomain_link_exit() path is present in 6.18.43, and the verdict remains **YES**.
drivers/thunderbolt/xdomain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thunderbolt/xdomain.c +7 -1
@@ -1951,7 +1951,13 @@ static void tb_xdomain_link_exit(struct tb_xdomain *xd)if (tb_port_get_link_generation (down) >=4 ) { down->bonded = false; down->dual_link_port->bonded = false; - }else if (xd->link_width >TB_LINK_WIDTH_SINGLE ) { +return ; + } + +if (!xd->bonding_possible) +return ; + +if (xd->link_width >TB_LINK_WIDTH_SINGLE ) {/* * Just return port structures back to way they were and * update credits. No need to update userspace because
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 netfilter: nf_conntrack_expect: zero at allocation time
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 241ccd2fed9051db443aadce248fc0ab30f55e97 ]
There are occasional LLM hints wrt. leaking uninitialized data to userspace via ctnetlink. Just zero at allocation time, expectations are not frequently used these days.
Intentionally keeps _init as-is because we could theoretically support re-init, so add the missing exp->dir there.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 — Subject line**
Record: [netfilter: nf_conntrack_expect] [zero] — zero expectation objects at allocation time to avoid leaking uninitialized slab data.
**Step 1.2 — Tags**
Record:
- Signed-off-by: Florian Westphal \<[email protected]\>
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Link:, or Cc: stable tags
Notable: no formal bug report or syzbot link; author cites “occasional LLM hints” about ctnetlink leaks.
**Step 1.3 — Body analysis**
Record:
- Bug: nf_ct_expect_alloc() uses non-zeroing kmem_cache_alloc(); fields not explicitly initialized can retain stale slab contents and be exposed to userspace via ctnetlink expectation dumps.
- Symptom: spurious or stale data in netlink expectation dumps (especially NAT-related attributes).
- Root cause: per-field initialization is incomplete across allocation paths; centralized zeroing at alloc is safer.
- Author notes expectations are rarely used today; keeps nf_ct_expect_init() behavior but adds missing exp->dir initialization there.
**Step 1.4 — Hidden bug fix?**
Record: Yes. Despite the soft wording, this is a kernel heap information-leak fix, not a style change. The kmem_cache_alloc → kmem_cache_zalloc change and exp->dir = 0 addition address uninitialized memory exposure.
---
## Phase 2: Diff Analysis
**Step 2.1 — Inventory**
Record:
- net/netfilter/nf_conntrack_expect.c: +2 / -1 (3 lines touched)
- net/netfilter/nf_conntrack_netlink.c: +1 / -10 (11 lines removed)
- Functions: nf_ct_expect_alloc(), nf_ct_expect_init(), ctnetlink_alloc_expect()
- Scope: small, two-file, surgical fix
**Step 2.2 — Code flow per hunk**
Record:
1. nf_ct_expect_alloc(): kmem_cache_alloc → kmem_cache_zalloc — all struct fields start zeroed.
2. nf_ct_expect_init(): adds exp->dir = 0 under CONFIG_NF_NAT alongside existing saved_addr/saved_proto zeroing.
3. ctnetlink_alloc_expect(): removes redundant else branches that zeroed flags, expectfn, and NAT fields — now handled by zalloc.
**Step 2.3 — Bug mechanism**
Record: **Uninitialized data / information leak (category 8)**. Slab reuse leaves stale kernel data in struct nf_conntrack_expect fields. ctnetlink_exp_dump_expect() reads exp->flags, and under CONFIG_NF_NAT emits CTA_EXPECT_NAT when saved_addr/saved_proto look non-zero, leaking stale addresses/ports/direction to userspace.
**Step 2.4 — Fix quality**
Record: Fix is obviously correct and minimal. kmem_cache_zalloc is the standard pattern for objects with many partially-initialized fields. Regression risk is very low; expectations are infrequent and zeroing cost is negligible.
---
## Phase 3: Git History Investigation
**Step 3.1 — Blame**
Record: kmem_cache_alloc(nf_ct_expect_cachep, GFP_ATOMIC) dates to Patrick McHardy (2007). Bug has existed since expectations used a non- zeroing slab allocator. nf_ct_expect_init() has zeroed saved_addr/saved_proto since NAT support was added, but never exp->dir.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag in this commit.
**Step 3.3 — Related file history**
Record: Related commit already in this tree:
- 929f7a9a7aad9 — “netfilter: ctnetlink: zero expect NAT fields when CTA_EXPECT_NAT absent” — targeted partial fix for the ctnetlink userspace creation path only, with a concrete reproduction (kernel test robot).
This commit generalizes the fix to all allocation paths and removes the now-redundant ctnetlink else branches.
**Step 3.4 — Author context**
Record: Florian Westphal is an active netfilter contributor/maintainer. Similar leak fix 7e23965d44f06 (“nft_meta_bridge: fix NFT_META_BRI_IIFPVID stack leak”) is already in this 6.18.y tree.
**Step 3.5 — Dependencies**
Record: Standalone; no series prerequisites. git apply --check on commit 241ccd2fed905 succeeds cleanly against HEAD.
---
## Phase 4: Mailing List and External Research
**Step 4.1 — Original discussion**
Record: b4 dig -c 241ccd2fed905 found v1 only at
https://patch.msgid.link/[email protected]. Lore fetch blocked by bot protection; no reviewer replies retrieved.
**Step 4.2 — Reviewers**
Record: b4 dig -w shows recipients: Florian Westphal, netfilter- [email protected]. No explicit maintainer Acked-by in commit.
**Step 4.3 — Bug report**
Record: No formal Reported-by in this commit. Related bug in 929f7a9a7aad9 was Reported-by: kernel test robot with demonstrated stale CTA_EXPECT_NAT emission.
**Step 4.4 — Series context**
Record: Single-patch series (v1 only). Not part of a multi-patch dependency chain.
**Step 4.5 — Stable list**
Record: Not searched (lore blocked). Similar Westphal leak fix already accepted into this stable tree.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 — Key functions**
Record: nf_ct_expect_alloc(), nf_ct_expect_init(), ctnetlink_alloc_expect(), ctnetlink_exp_dump_expect().
**Step 5.2 — Callers**
Record: nf_ct_expect_alloc() called from ~15 sites: protocol helpers (FTP, SIP, H.323, PPTP, TFTP, IRC, etc.), nf_conntrack_broadcast.c, ctnetlink_alloc_expect(), nft_ct.c, IPVS. Most call nf_ct_expect_init() afterward; broadcast manually sets fields without nf_ct_expect_init().
**Step 5.3 — Callees**
Record: kmem_cache_zalloc/kmem_cache_alloc, refcount_set, slab free via RCU. Dump path reads struct fields into netlink skb.
**Step 5.4 — Reachability**
Record: Leak is reachable when a privileged user dumps expectations via ctnetlink (ctnetlink_exp_dump_expect()). Creating expectations via broadcast helper (no NAT field init) and then dumping can expose stale NAT data — path exists in this tree.
**Step 5.5 — Similar patterns**
Record: 929f7a9a7aad9 fixed the same class of bug narrowly in ctnetlink. nf_ct_expect_init() already zeroes most fields on the packet path but omitted dir. Centralized zalloc is the comprehensive fix.
---
## Phase 6: Cross-Reference Against Local Tree (v6.18.44)
**Step 6.1 — Buggy code present?**
Record: Yes. HEAD is v6.18.44 on stable/linux-6.18.y. Current code still uses kmem_cache_alloc at line 307 of nf_conntrack_expect.c. Commit 241ccd2fed905 is **not** in this tree.
**Step 6.2 — Backport complications**
Record: Clean apply verified. Removes code added by in-tree 929f7a9a7aad9; no structural conflicts.
**Step 6.3 — Related fixes already present**
Record: 929f7a9a7aad9 partially fixes ctnetlink NAT-field leak only. Does **not** cover nf_conntrack_broadcast.c and other paths that allocate without fully initializing NAT fields. This commit still adds value.
---
## Phase 7: Subsystem Context
**Step 7.1 — Subsystem**
Record: netfilter / nf_conntrack / ctnetlink. Criticality: **IMPORTANT** (networking core subsystem, widely deployed).
**Step 7.2 — Activity**
Record: Actively maintained; multiple recent expectation/ctnetlink fixes in this tree’s history.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 — Who is affected**
Record: Systems with CONFIG_NF_CONNTRACK and ctnetlink users (firewall managers, conntrack tools). Affects administrators/privileged tooling, not unprivileged users directly.
**Step 8.2 — Trigger conditions**
Record: Allocate expectation without full field initialization (slab reuse), then dump via ctnetlink. Moderately rare but reproducible (demonstrated for ctnetlink path in 929f7a9a7aad9). Requires CAP_NET_ADMIN for dump.
**Step 8.3 — Failure mode**
Record: Kernel heap memory leaked to userspace via netlink attributes.
Severity: **MEDIUM** (security information disclosure, not crash/corruption).
**Step 8.4 — Risk/benefit**
Record:
- Benefit: Closes remaining leak paths beyond the partial ctnetlink fix; defense-in-depth at the central allocator.
- Risk: Very low — 14-line change, standard zalloc pattern, infrequent code path.
- Ratio: Favorable for stable inclusion.
---
## Phase 9: Final Synthesis
**Step 9.1 — Evidence summary**
FOR:
- Real kernel memory info leak via ctnetlink
- Partial fix (929f7a9a7aad9) already in tree leaves gaps (e.g., nf_conntrack_broadcast.c never initializes NAT fields)
- Tiny, obviously correct, applies cleanly
- Same author’s similar leak fixes already in 6.18.y
- Adds missing exp->dir init in nf_ct_expect_init()
AGAINST:
- Requires privileged access to observe leak
- Expectations are uncommon
- Primary reported case partially addressed by existing stable commit
- No syzbot/formal CVE; “LLM hints” only in this commit message
UNRESOLVED:
- Full lore review thread (bot-blocked)
- No independent Tested-by on this specific commit
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — zalloc is standard; related leak class already reproduced in-tree via 929f7a9a7aad9.
2. Fixes a real bug affecting users? **PASS** — verified stale-data leak path; broadcast path still vulnerable without this fix.
3. Important issue? **PASS** — security information leak (medium severity).
4. Small and contained? **PASS** — 14 lines, 2 files.
5. No new features/APIs? **PASS**.
6. Can apply to local tree? **PASS** — git apply --check succeeded.
**Step 9.3 — Exception category**
Record: N/A (not device ID, quirk, DT, build, or docs fix — standard bug fix).
**Step 9.4 — Decision rationale**
This tree (6.18.44) still has the underlying allocator bug. While 929f7a9a7aad9 patched one ctnetlink-specific leak, kmem_cache_zalloc in nf_ct_expect_alloc() fixes all allocation paths comprehensively, including nf_conntrack_broadcast.c which never calls nf_ct_expect_init() and does not initialize NAT-related fields. The change is minimal, low-risk, and consistent with other netfilter leak fixes already accepted into this stable series.
---
## Verification
- [Phase 1] Parsed commit 241ccd2fed905: subject, body, only SOB from Florian Westphal
- [Phase 2] Diff analysis: 2 files, kmem_cache_zalloc, exp->dir = 0, removed ctnetlink else branches
- [Phase 3] git describe HEAD: v6.18.44; tree is stable/linux-6.18.y
- [Phase 3] git blame: kmem_cache_alloc since 2007
- [Phase 3] 929f7a9a7aad9 confirmed in tree via git merge-base --is- ancestor
- [Phase 3] 241ccd2fed905 confirmed NOT in tree
- [Phase 3] git apply --check on patch: clean apply
- [Phase 4] b4 dig -c 241ccd2fed905: found v1 at patch.msgid.link/[email protected]
- [Phase 4] b4 dig -w: netfilter-devel CC'd
- [Phase 4] b4 dig -a: v1 only
- [Phase 4] Lore thread fetch: blocked by Anubis (UNVERIFIED: reviewer comments)
- [Phase 5] grep nf_ct_expect_alloc: 15+ call sites; broadcast path does not call nf_ct_expect_init()
- [Phase 5] Read ctnetlink_exp_dump_expect(): dumps flags always; NAT block when saved_addr/saved_proto non-zero
- [Phase 5] Read nf_conntrack_broadcast.c: does not init saved_addr/saved_proto/dir
- [Phase 6] Current code at line 307: still kmem_cache_alloc
- [Phase 6] 7e23965d44f06 similar Westphal leak fix present in tree
- [Phase 8] Trigger requires CAP_NET_ADMIN for ctnetlink dump (standard nfnetlink permission model)
**YES**
net/netfilter/nf_conntrack_expect.c | 3 ++- net/netfilter/nf_conntrack_netlink.c | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-)
net/netfilter/nf_conntrack_expect.c +2 -1
@@ -304,7 +304,7 @@ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me) {struct nf_conntrack_expect *new; - new =kmem_cache_alloc (nf_ct_expect_cachep,GFP_ATOMIC ); + new =kmem_cache_zalloc (nf_ct_expect_cachep,GFP_ATOMIC );if (!new)return NULL ;
@@ -386,6 +386,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,#if IS_ENABLED (CONFIG_NF_NAT )memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr));memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); + exp->dir =0 ;#endif }EXPORT_SYMBOL_GPL (nf_ct_expect_init);
net/netfilter/nf_conntrack_netlink.c +1 -10
@@ -3559,8 +3559,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct,if (cda[CTA_EXPECT_FLAGS ]) { exp->flags =ntohl (nla_get_be32 (cda[CTA_EXPECT_FLAGS ])); exp->flags &= ~NF_CT_EXPECT_USERSPACE ; - }else { - exp->flags =0 ; }if (cda[CTA_EXPECT_FN ]) {const char *name =nla_data (cda[CTA_EXPECT_FN ]);
@@ -3572,8 +3570,7 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, goto err_out; } exp->expectfn = expfn->expectfn; - }else - exp->expectfn =NULL ; + } exp->class = class; exp->master = ct;
@@ -3592,12 +3589,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, exp, nf_ct_l3num(ct));if (err <0 ) goto err_out; -#if IS_ENABLED (CONFIG_NF_NAT ) - } else { -memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr)); -memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); - exp->dir =0 ; -#endif }return exp; err_out:
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ACPI: scan: Honor _DEP for ACPI0016 PCI/CXL host bridge
In reply to Sasha LevinFrom: Chen Pei <[email protected]>
[ Upstream commit bf5418a5fe63f35da35941ae896d5df121d95ffc ]
CXL root devices (ACPI0017) declare _DEP on their parent ACPI0016 PCI/CXL host bridge so that cxl_acpi probes only after acpi_pci_root has attached the PCI root and registered it for acpi_pci_find_root(). However, acpi_dev_ready_for_enumeration() only consults dep_unmet when the supplier's HID is on acpi_honor_dep_ids[]; otherwise the dependency is silently ignored.
Without honoring the dependency, cxl_acpi can probe before the PCI root is ready. The resulting CXL topology is broken: decoder targets read as 0 and no port/endpoint devices appear under /sys/bus/cxl/devices/.
Add ACPI0016 to acpi_honor_dep_ids[] so the _DEP declared by ACPI0017 is enforced. This relies on the preceding patch ("ACPI: PCI: clear _DEP dependencies after PCI root bridge attach"), which releases the dependency once the PCI root is fully enumerated; the two patches must be applied together.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ACPI: scan: Honor _DEP for ACPI0016 PCI/CXL host bridge
**Local tree:** v6.18.44 (stable/linux-6.18.y, make kernelversion = 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [ACPI: scan] [Honor] — Enforce ACPI _DEP dependency for ACPI0016 (CXL/PCIe host bridge) so ACPI0017 (CXL root) consumers wait for PCI root attach.
### Step 1.2: Tags
**Record:**
| Tag | Value | |-----|-------| | Fixes: | None | | Reported-by: | None | | Tested-by: | Alison Schofield \<[email protected]\> | | Reviewed-by: | Alison Schofield \<[email protected]\> | | Link: |
https://patch.msgid.link/[email protected]
|
| Signed-off-by: | Chen Pei, Rafael J. Wysocki |
**Notable:** Intel CXL maintainer tested and reviewed. No syzbot. No explicit Cc: stable.
### Step 1.3: Body analysis
**Record:**
- **Bug:** ACPI0017 (CXL root) declares _DEP on parent ACPI0016, but acpi_dev_ready_for_enumeration() ignores it because ACPI0016 is not in acpi_honor_dep_ids[].
- **Symptom:** cxl_acpi probes before acpi_pci_root registers the PCI root → acpi_pci_find_root() returns NULL → broken CXL topology (decoder targets = 0, no devices under /sys/bus/cxl/devices/).
- **Root cause:** _DEP silently ignored for ACPI0016 suppliers.
- **Dependency:** Must be applied with preceding patch "ACPI: PCI: clear _DEP dependencies after PCI root bridge attach" (upstream 3a59c3b772e5d).
- **Version info:** None explicit; cover letter says x86 is usually masked by link order; RISC-V is affected.
### Step 1.4: Hidden bug fix?
**Record:** No — this is an explicit, well-described functional bug fix disguised as a one-line allowlist addition.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** drivers/acpi/scan.c (+1 line)
- **Functions:** None modified; only acpi_honor_dep_ids[] data changed
- **Scope:** Single-file, surgical (1 insertion)
### Step 2.2: Code flow change
**Record:**
- **Before:** When ACPI0017 declares _DEP on ACPI0016, acpi_scan_add_dep() sets dep->honor_dep = false (ACPI0016 not in list) → acpi_dev_ready_for_enumeration() never blocks on dep_unmet → CXL root probes early.
- **After:** ACPI0016 in honor list → honor_dep = true → consumer ACPI0017 blocked until supplier clears dependency.
- **Path affected:** ACPI device enumeration / attach path in acpi_bus_check_add() via acpi_dev_ready_for_enumeration().
### Step 2.3: Bug mechanism
**Record:**
- **Category:** Logic / correctness — probe ordering / dependency enforcement
- **Mechanism:** ACPI _DEP declared in firmware is parsed but not enforced unless supplier HID is on acpi_honor_dep_ids[]. Early cxl_acpi_probe() calls to_cxl_host_bridge() → acpi_pci_find_root() fails → host bridges skipped silently.
### Step 2.4: Fix quality
**Record:**
- **Quality:** Obviously correct; mirrors existing entries (PNP0C0F, RSCV*, INTC*).
- **Regression risk:** Applying **this patch alone** without the prerequisite would permanently block ACPI0017 enumeration (confirmed in lore review by Alison Schofield). Both patches must ship together.
- **Risk of combined series:** Very low — follows pci_link.c / ec.c pattern already in tree.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** acpi_honor_dep_ids[] introduced by 9d9bcae47fd5a (2021, INT3472 camera PMIC deps). PNP0C0F added by 2cb9155d116c4 (2024, pci_link dep series). ACPI0016 handling in pci_root.c since 241d26bc26add (2022). CXL ACPI root since 4812be97c015b. Bug has been latent since honor-list mechanism existed without ACPI0016 entry.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related file history
**Record:** Related pending stable commits on autosel branch:
- b52e0117014b6 — ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach (prerequisite)
- 82dbacca5220e — this commit (upstream bf5418a5fe63f)
Neither is in current HEAD (6.18.44). Part of a 2-patch series (v1, May 26 2026).
### Step 3.4: Author context
**Record:** Chen Pei (Alibaba). Series reviewed/tested by Alison Schofield (Intel CXL maintainer) and Reviewed-by Dave Jiang on lore thread.
### Step 3.5: Dependencies
**Record:** **Hard dependency** on patch 1 (acpi_dev_clear_dependencies() in acpi_pci_root_add()). Prerequisite not in tree. Both patches apply cleanly (git apply --check passed). Standalone application of this commit alone is harmful.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- b4 dig -c bf5418a5fe63f → https://patch.msgid.link/20260526025118.38
[email protected]
- Series v1, 2 patches, May 26 2026
- Cover letter explains twofold root cause and mandatory pairing
### Step 4.2: Reviewers
**Record:** CC'd: [email protected], [email protected], [email protected], linux-cxl@, linux-acpi@, linux-pci@. Alison Schofield:
Tested-by + Reviewed-by for series. Dave Jiang: Reviewed-by.
### Step 4.3: Bug report
**Record:** No external bugzilla/syzbot. Cover letter documents reproducible failure: decoder targets = 0, empty /sys/bus/cxl/devices/. Trigger on RISC-V where acpi_pci_root vs cxl_acpi link order is not guaranteed.
### Step 4.4: Series context
**Record:** 2-patch series; both required. Applying only patch 2 "would prevent cxl_acpi from ever probing on ACPI0016 systems" (Alison Schofield review in mbox).
### Step 4.5: Stable list history
**Record:** No stable@ discussion found in mbox thread. Not a negative signal per instructions.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** acpi_honor_dep_ids[] (data), consumed by acpi_scan_add_dep(), acpi_scan_dep_init(), acpi_dev_ready_for_enumeration().
### Step 5.2: Callers
**Record:**
- acpi_dev_ready_for_enumeration() called from acpi_bus_check_add() (scan.c:2288) — core ACPI enumeration path; also i2c-core-acpi.c.
- cxl_acpi_probe() (drivers/cxl/acpi.c) depends on acpi_pci_find_root() via to_cxl_host_bridge() and add_host_bridge_dport().
### Step 5.3: Callees
**Record:** Honor flag flows to dep->honor_dep → adev->flags.honor_deps → checked in acpi_dev_ready_for_enumeration(). Clearing via acpi_dev_clear_dependencies() (prerequisite patch).
### Step 5.4: Reachability
**Record:** Triggered at boot during ACPI enumeration on systems with ACPI0016 + ACPI0017 in DSDT. Affects CONFIG_CXL_BUS platforms. Userspace cannot directly trigger; firmware-defined topology. Common on CXL-capable servers, especially RISC-V.
### Step 5.5: Similar patterns
**Record:** Identical pattern to PNP0C0F (2cb9155d116c4): honor supplier in list + acpi_dev_clear_dependencies() after probe. Precedent already in 6.18.44.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **YES.** drivers/acpi/scan.c lines 857–868 — acpi_honor_dep_ids[] lacks ACPI0016. drivers/cxl/acpi.c has ACPI0017 probe path. drivers/acpi/pci_root.c handles ACPI0016 but does not call acpi_dev_clear_dependencies(). Full buggy state confirmed in 6.18.44.
### Step 6.2: Backport complications
**Record:** Clean apply for both patches (git apply --check exit 0). No conflicts expected. Minor context: line after PNP0C0F entry.
### Step 6.3: Related fixes already present?
**Record:** Prerequisite infrastructure exists (acpi_dev_clear_dependencies, honor_dep mechanism, pci_link clear_deps). Neither fix from this series is in HEAD. No duplicate fix found.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** **IMPORTANT** — ACPI core enumeration + CXL driver. Not universal, but critical for CXL memory users on affected platforms.
### Step 7.2: Activity
**Record:** ACPI scan and CXL actively maintained in 6.18.y (recent
commits: 19b3691ec9402, 7f0a53c2b94ca on scan.c; multiple CXL commits).
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** CXL-capable systems with ACPI0016 host bridges and ACPI0017 root devices — primarily non-x86 (RISC-V called out), but any platform where probe order differs from x86 link order.
### Step 8.2: Trigger conditions
**Record:** Boot-time ACPI enumeration when ACPI0017 _DEP points to ACPI0016 and cxl_acpi probes before acpi_pci_root completes. Non- deterministic on RISC-V; masked on typical x86 by built-in link order.
### Step 8.3: Failure mode severity
**Record:** Complete CXL enumeration failure — no port/endpoint devices, decoder targets = 0. **Severity: HIGH** for affected CXL users (hardware non-functional); **MEDIUM** overall (platform-specific, x86 often unaffected). Not a crash/oops, but total loss of CXL functionality.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for affected CXL platforms — restores working CXL topology
- **Risk:** VERY LOW for combined 2-patch series (5 lines total, established pattern)
- **Ratio:** Strongly favorable when both patches applied together
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Fixes real, reproducible hardware enablement bug on CXL/ACPI platforms
- Intel CXL maintainer tested and reviewed
- Minimal, obviously correct change (1 line)
- All infrastructure present in 6.18.44
- Applies cleanly; direct precedent (PNP0C0F/pci_link series in tree)
- Prerequisite patch equally small and follows existing ec.c/pci_link.c pattern
**AGAINST backport:**
- Requires paired prerequisite commit (cannot apply alone)
- Bug masked on most x86 systems
- Very new (upstream June 2026, not yet in 6.18.44)
- Niche hardware population (CXL + ACPI0016/0017)
**Unresolved:** No production deployment data beyond Intel testing.
### Step 9.2: Stable rules checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — 1-line allowlist; Tested-by/Reviewed-by Intel CXL maintainer | | 2. Fixes real bug affecting users? | **PASS** — CXL devices missing on affected platforms | | 3. Important issue? | **PASS** — complete CXL enumeration failure (HIGH for affected users) | | 4. Small and contained? | **PASS** — 1 line (+ 4 lines prerequisite) | | 5. No new features/APIs? | **PASS** — enforcement of existing ACPI `_DEP` mechanism | | 6. Can apply to local tree? | **PASS** — both patches apply cleanly; prerequisite must accompany |
### Step 9.3: Exception categories
**Record:** Hardware enablement / probe-order fix for existing CXL ACPI driver — analogous to USB/PCI quirks and prior PNP0C0F _DEP fix.
### Step 9.4: Decision rationale
This commit fixes a genuine ACPI probe-ordering bug that leaves CXL hardware completely non-functional on platforms (notably RISC-V) where cxl_acpi can run before acpi_pci_root finishes. The change is minimal, follows an established in-tree pattern, and has maintainer review and testing.
**Critical operational note:** This commit MUST be backported together with its prerequisite (ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach, upstream 3a59c3b772e5d). Applying this patch alone would block cxl_acpi from ever probing on ACPI0016 systems, as explicitly warned in the lore review.
For the 6.18.44 tree, where the buggy code is present and CXL ACPI support is fully integrated, backporting both patches of this series is appropriate.
---
## Verification
- [Phase 1] Parsed subject, tags; found Tested-by/Reviewed-by Alison Schofield, Link to patch series
- [Phase 1] Cover letter describes broken CXL topology, decoder targets = 0
- [Phase 2] Diff: +1 line to acpi_honor_dep_ids[] in drivers/acpi/scan.c
- [Phase 2] Read acpi_dev_ready_for_enumeration() at scan.c:2470–2476 — honors dep_unmet only when honor_deps set
- [Phase 2] Read acpi_scan_add_dep() at scan.c:2035–2036 — sets honor_dep from list
- [Phase 2] Read to_cxl_host_bridge() at cxl/acpi.c:523–533 — requires acpi_pci_find_root()
- [Phase 3] git describe HEAD → v6.18.44
- [Phase 3] acpi_honor_dep_ids mechanism from 9d9bcae47fd5a, in tree
- [Phase 3] ACPI0016 in pci_root.c from 241d26bc26add, in tree
- [Phase 3] CXL ACPI0017 driver from 4812be97c015b, in tree
- [Phase 3] Commit bf5418a5fe63f NOT in HEAD; prerequisite 3a59c3b772e5d NOT in HEAD
- [Phase 3] Both on autosel branch as 82dbacca5220e and b52e0117014b6
- [Phase 4] b4 dig -c bf5418a5fe63f → lore URL; v1 2-patch series
- [Phase 4] b4 dig -w → CC'd rafael, bhelgaas, djbw, linux-cxl, linux- acpi, linux-pci
- [Phase 4] mbox: Alison Schofield Tested-by/Reviewed-by; warns patch 2 alone blocks cxl_acpi
- [Phase 4] mbox: RISC-V probe-order issue documented; x86 usually masked
- [Phase 5] acpi_dev_ready_for_enumeration callers: scan.c:2288, i2c-core-acpi.c:155
- [Phase 5] pci_link.c:751 has acpi_dev_clear_dependencies() — precedent confirmed
- [Phase 6] Read scan.c:857–868 — ACPI0016 absent from honor list in 6.18.44
- [Phase 6] Read pci_root.c:760–762 — no acpi_dev_clear_dependencies() call
- [Phase 6] git apply --check for both patches → exit 0 (clean apply)
- [Phase 7] CXL Kconfig exists at drivers/cxl/Kconfig (CONFIG_CXL_BUS)
- [Phase 8] Failure mode: complete CXL enumeration failure, not kernel crash
**YES**The background searches finished and line up with the earlier analysis:
- **Git history grep** for ACPI0016-related commits in drivers/acpi/ only turned up the older CXL host-bridge work (241d26bc26add — CXL _OSC handling). Neither of the two _DEP fixes showed up in that narrow search because they aren’t in the current 6.18.44 HEAD yet.
- **autosel branch search** found both patches from the series:
- b52e0117014b6 — ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach (prerequisite)
- 82dbacca5220e — ACPI: scan: Honor _DEP for ACPI0016 PCI/CXL host bridge (the commit under review)
That confirms the verdict: **YES**, but only as a pair — the prerequisite must be backported together with this one-patch change to acpi_honor_dep_ids[].
drivers/acpi/scan.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/scan.c +1 -0
@@ -865,6 +865,7 @@ static const char * const acpi_honor_dep_ids[] = {"RSCV0005" ,/* RISC-V SBI MPXY MBOX */ "RSCV0006" ,/* RISC-V RPMI SYSMSI */ "PNP0C0F" ,/* PCI Link Device */ +"ACPI0016" ,/* CXL/PCIe host bridge: CXL root (ACPI0017) depends on PCI root attach */ NULL };
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 net: sfp: extend SMBus support
In reply to Sasha LevinFrom: Jonas Jelonek <[email protected]>
[ Upstream commit 58b29bdf6186a8c3f2d725619c0b17cf602ac4e0 ]
Commit 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access") added SMBus access for SFP modules, but limited it to single-byte transfers. As a side effect, hwmon is disabled (16-bit reads cannot be guaranteed atomic) and a warning is printed.
Many SMBus-only I2C controllers in the wild support more than just byte access, and SFP cages are often wired to such controllers rather than to a full-featured I2C controller -- e.g. the SMBus controllers in the Realtek longan and mango SoCs, which advertise word access and I2C block reads. Today, they cannot drive an SFP at all without falling back to the byte-only path.
Extend sfp_smbus_read()/sfp_smbus_write() so that, in addition to the existing byte access, they also use SMBus word access and SMBus I2C block access whenever the adapter advertises them. Both directions are handled in a single read and a single write helper that pick the largest supported transfer per chunk and fall back as needed.
I2C-block is preferred unconditionally when available: the protocol carries any length 1..32, so it can serve every chunk -- including the 1- and 2-byte tails -- without help from word or byte access. Note that this requires I2C_FUNC_SMBUS_I2C_BLOCK, which reads a caller-specified number of bytes. This deviates from the official SMBus Block Read (length is supplied by the slave) but is widely supported by Linux I2C controllers/drivers.
Capability matrix this implementation supports:
- BYTE only: works (unchanged behaviour); 1-byte
xfers, hwmon disabled.
- BYTE + WORD: word for >=2-byte chunks, byte for
trailing odd byte.
- I2C_BLOCK present (with or
without BYTE/WORD): block as the universal transport for
every chunk.
- WORD only (no BYTE/BLOCK): accepted with WARN_ONCE. Even-length transfers work; odd-length transfers (e.g. the 3-byte cotsworks fixup write) hit the BYTE branch which the adapter does not implement, so the xfer returns an error and the operation is aborted. No mainline I2C driver was found to advertise WORD without BYTE; the warning lets us learn about it if it ever shows up.
Adapters with asymmetric R/W capabilities (e.g. only READ_I2C_BLOCK but not WRITE_I2C_BLOCK) remain functionally correct -- the per-iteration fallback uses the direction-specific bits -- but the shared i2c_max_block_size is sized by the all-bits-set check, so a transfer in the better-supported direction is not upgraded. None of the mainline I2C bus drivers surveyed during review advertise such asymmetry; promoting i2c_max_block_size to per-direction sizes can be revisited if needed.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: net: sfp: extend SMBus support (58b29bdf6186a)
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject Line
**Record:** [net: sfp] [extend] — Extend existing SMBus SFP access beyond single-byte transfers.
### Step 1.2: Tags
**Record:**
| Tag | Value | |-----|-------| | Fixes: | None | | Reported-by: | None | | Tested-by: | None | | Reviewed-by: | Maxime Chevallier \<[email protected]\> (original SMBus author) | | Acked-by: | None | | Link: | https://patch.msgid.link/20260614133418.2068201-3- [email protected] | | Cc: stable | None (expected for manual review) | | Signed-off-by: | Jonas Jelonek, Jakub Kicinski |
Notable: Reviewed by the author of commit 7662abf4db94 that introduced SMBus support. No syzbot or user bug reports.
### Step 1.3: Body Analysis
**Record:**
- **Bug:** Commit 7662abf4db94 limited SMBus to single-byte transfers. Adapters advertising word or I2C-block SMBus (e.g. Realtek longan/mango SoCs) cannot drive SFP cages; they fail sfp_i2c_configure() or are stuck on byte-only path with hwmon disabled.
- **Symptom:** SFP probe/configure failure (-EINVAL) on I2C-block-only adapters; degraded operation (no hwmon, warning spam) on byte-capable but word/block-capable adapters.
- **Root cause:** sfp_i2c_configure() only accepts I2C_FUNC_SMBUS_BYTE_DATA; read/write helpers only use I2C_SMBUS_BYTE_DATA.
### Step 1.4: Hidden Bug Fix?
**Record:** Yes. Despite “extend” wording, this completes broken/incomplete SMBus support introduced by 7662abf4db94. Adapters with I2C_FUNC_SMBUS_I2C_BLOCK but no BYTE_DATA currently get -EINVAL and the SFP driver fails probe entirely.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/net/phy/sfp.c (+111 / -28 on mainline; +120 / -29 with quirks prerequisite)
- **Functions:** sfp_smbus_byte_read → sfp_smbus_read, sfp_smbus_byte_write → sfp_smbus_write, sfp_i2c_configure
- **Scope:** Single-file, moderate surgical change
### Step 2.2: Code Flow Changes
**Record:**
| Hunk | Before | After | |------|--------|-------| | Read helper | Byte-only loop | Per-chunk: I2C-block → word (≥2 bytes) → byte fallback | | Write helper | Byte-only loop | Per-chunk: I2C-block → word (≥2 bytes) → byte fallback | | `sfp_i2c_configure` | Requires `BYTE_DATA` only; `max_block_size = 1` | Accepts `BYTE_DATA` OR `I2C_BLOCK`; sets block size 16/2/1; word-only path with `WARN_ONCE` |
### Step 2.3: Bug Mechanism
**Record:** **Logic / hardware correctness fix (category g/h).** Incomplete protocol selection left certain SMBus-only adapters unusable and forced i2c_max_block_size = 1, which disables hwmon (sfp_hwmon_probe() requires i2c_block_size >= 2).
### Step 2.4: Fix Quality
**Record:** Well-structured capability matrix in commit message; BYTE- only path preserved unchanged. Low regression risk for existing byte- only setups. i2c_get_functionality() called once per read/write call (minor inefficiency, not a stability concern). Reviewed by subsystem expert.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** Buggy byte-only SMBus code introduced in **7662abf4db94** (2025-03-25, Maxime Chevallier). Present in this 6.18.44 tree. Related fix **bef389a210e7d** (i2c_block_size init, infinite-loop fix) already backported to stable by Greg K-H.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag. Referenced commit 7662abf4db94 is an ancestor of HEAD.
### Step 3.3: Related Commits
**Record:** Part of v11 series (2 patches):
1. **f2a138abfb719** — net: sfp: apply I2C adapter quirks to limit block size (prerequisite on mainline)
2. **58b29bdf6186a** — this commit
bef389a210e7d (i2c_block_size init) already in 6.18.44. Neither quirks nor extend SMBus are in 6.18.44 yet.
### Step 3.4: Author Context
**Record:** Jonas Jelonek authored bef389a210e7d (already in stable 6.18.y). Same SFP SMBus series.
### Step 3.5: Dependencies
**Record:** On mainline, extend SMBus builds atop quirks patch (refactors sfp_i2c_configure to use local max_block_size). **f2a138abfb719 applies cleanly to 6.18.44**; **both patches apply cleanly in sequence**. Extend SMBus alone conflicts (verified via cherry-pick).
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original Discussion
**Record:** b4 dig -c 58b29bdf6186a → https://patch.msgid.link/2026061
[email protected] (v11 2/2). Series evolved v5→v11 since 2026-01-16.
### Step 4.2: Reviewers
**Record:** b4 dig -w CC'd Russell King, Andrew Lunn, netdev maintainers, Maxime Chevallier.
### Step 4.3: Bug Reports
**Record:** No external bug report links. Hardware impact described for Realtek longan/mango SoCs in commit message only.
### Step 4.4: Series Context
**Record:** Standalone functional value, but clean backport to 6.18.44 needs **f2a138abfb719** first.
### Step 4.5: Stable List
**Record:** Could not fetch lore thread (bot protection). Related **bef389a210e7d** had Cc: [email protected] and was backported; this commit does not carry that tag.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key Functions
**Record:** sfp_smbus_read, sfp_smbus_write, sfp_i2c_configure
### Step 5.2: Callers
**Record:** sfp_i2c_configure() ← sfp_i2c_get() ← sfp_probe(). SMBus read/write used via sfp->read/sfp->write function pointers through sfp_read()/sfp_write() for EEPROM access, module detection, hwmon, ethtool -m, quirks/fixups.
### Step 5.3: Callees
**Record:** i2c_get_functionality(), i2c_smbus_xfer(), i2c_check_functionality(), unaligned accessors.
### Step 5.4: Reachability
**Record:** Triggered at platform device probe when SFP cage uses SMBus- only I2C adapter. Affects all SFP operations on that hardware — module insert, link bring-up, diagnostics.
### Step 5.5: Similar Patterns
**Record:** Original SMBus byte support (7662abf4db94) is the incomplete pattern this fixes.
---
## PHASE 6: CROSS-REFERENCE WITH LOCAL TREE (6.18.44)
### Step 6.1: Buggy Code Present?
**Record:** **Yes.** Current tree has byte-only sfp_smbus_byte_read/write and sfp_i2c_configure() requiring I2C_FUNC_SMBUS_BYTE_DATA only (lines 757–824). SMBus support commit 7662abf4db94 is an ancestor.
### Step 6.2: Backport Complications
**Record:** Extend SMBus alone → merge conflict in sfp_i2c_configure. **f2a138abfb719 + 58b29bdf6186a apply cleanly in sequence** (verified). Minor adaptation possible without quirks, but quirks patch is small and should accompany this.
### Step 6.3: Related Fixes Already Present?
**Record:** bef389a210e7d (i2c_block_size init / ethtool spin fix) present. Quirks and extend SMBus **not** present.
---
## PHASE 7: SUBSYSTEM CONTEXT
### Step 7.1: Subsystem
**Record:** drivers/net/phy/sfp.c — network SFP cage driver. **IMPORTANT** for networking/embedded platforms with SFP ports.
### Step 7.2: Activity
**Record:** Active — multiple SFP quirk/fix commits in recent history on this tree.
---
## PHASE 8: IMPACT AND RISK
### Step 8.1: Who Is Affected
**Record:** Platform-specific — systems with SFP cages on SMBus-only I2C controllers that advertise word or I2C-block (documented: Realtek longan/mango). Not universal, but total failure for affected hardware.
### Step 8.2: Trigger Conditions
**Record:** SFP platform probe with non-I2C SMBus adapter lacking I2C_FUNC_I2C and/or I2C_FUNC_SMBUS_BYTE_DATA. Deterministic at boot — not a race.
### Step 8.3: Failure Mode Severity
**Record:**
- I2C-block-only, no byte: **probe failure** (-EINVAL) → SFP cage completely non-functional — **HIGH**
- Byte-only capable: works but hwmon disabled, warning printed, potentially unreliable — **MEDIUM**
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for affected embedded/networking platforms; MEDIUM overall (niche hardware)
- **Risk:** LOW — byte-only behavior unchanged; new paths gated on adapter capabilities; reviewed; applies cleanly with quirks prerequisite
- **Ratio:** Favorable for 6.18.y where incomplete SMBus support (7662abf4db94) is already present
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence Summary
**FOR:**
- Fixes complete SFP failure on SMBus I2C-block adapters (probe -EINVAL)
- Completes incomplete SMBus support already in 6.18.44 (7662abf4db94)
- Restores hwmon on word/block-capable SMBus adapters
- Reviewed by original SMBus author
- Same author's related fix (bef389a) already in stable 6.18.y
- Applies cleanly with small quirks prerequisite
- BYTE-only path unchanged — low regression risk
- Fits hardware workaround / enablement stable exception
**AGAINST:**
- Not a crash, corruption, deadlock, or security issue
- Platform-specific (Realtek SoCs cited)
- Arguably “feature completion” rather than regression fix
- Requires 2-patch series for clean backport
- No syzbot/fuzzer or explicit user bug report
### Step 9.2: Stable Rules Checklist
| Criterion | Result | |-----------|--------| | 1. Obviously correct and tested? | **PASS** — reviewed, clear capability matrix, preserves byte-only behavior | | 2. Fixes real bug affecting users? | **PASS** — SFP probe failure / non-functional hardware on specific platforms | | 3. Important issue? | **PASS** — complete hardware failure on affected platforms (HIGH for them) | | 4. Small and contained? | **PASS** — ~120 lines, one file (with quirks prerequisite) | | 5. No new features/APIs? | **PASS** — extends existing SMBus path; no userspace API changes | | 6. Can apply to local tree? | **PASS** — applies cleanly with f2a138abfb719 first |
### Step 9.3: Exception Category
**Record:** Hardware workaround / enablement — enables SFP on SMBus controllers that the current byte-only implementation cannot use.
### Step 9.4: Decision Rationale
6.18.44 already carries incomplete SMBus SFP support from 7662abf4db94. On adapters advertising I2C-block SMBus without byte access, sfp_i2c_configure() returns -EINVAL and the SFP cage fails probe entirely. This commit fixes that real hardware failure with a contained, reviewed change. Backport **f2a138abfb719** (I2C quirks) alongside it for a clean apply.
---
## Verification
- [Phase 1] git show 58b29bdf6186a --format=fuller: parsed subject, tags, body
- [Phase 2] git show 58b29bdf6186a: full diff analyzed; 111 lines changed on mainline
- [Phase 3] git describe HEAD: v6.18.44-1-g2736c32da98b9 / kernelversion 6.18.44
- [Phase 3] git merge-base --is-ancestor 7662abf4db94 HEAD: SMBus commit confirmed in tree
- [Phase 3] git blame -L 806,825 drivers/net/phy/sfp.c: byte-only code from 7662abf4db94
- [Phase 3] git log HEAD --grep="extend SMBus": not in 6.18.44
- [Phase 3] git log HEAD --grep="apply I2C adapter quirks": quirks not in 6.18.44
- [Phase 3] git show bef389a210e7d: related stable backport already present
- [Phase 4] b4 dig -c 58b29bdf6186a: lore URL found
- [Phase 4] b4 dig -c 58b29bdf6186a -a: v5–v11 series revisions listed
- [Phase 4] b4 dig -c 58b29bdf6186a -w: maintainers CC list retrieved
- [Phase 4] WebFetch lore URL: **FAILED** (bot protection)
- [Phase 5] grep sfp_i2c_configure/sfp_read in sfp.c: probe and EEPROM paths traced
- [Phase 5] Read sfp_hwmon_probe() lines 1711–1723: hwmon requires i2c_block_size >= 2
- [Phase 5] Read probe warning lines 3239–3246: SMBus byte-only warning path
- [Phase 6] Read current sfp_smbus_byte_read/write and sfp_i2c_configure: buggy code confirmed present
- [Phase 6] git cherry-pick --no-commit 58b29bdf6186a: **CONFLICT**
- [Phase 6] git cherry-pick --no-commit f2a138abfb719: **clean apply**
- [Phase 6] Both patches in sequence: **clean apply**, +120/-29 lines
- [Phase 6] grep i2c->quirks in sfp.c: no quirks handling in current tree
- [Phase 8] sfp_i2c_get() error path: configure failure prevents SFP probe
**Recommendation:** Backport **f2a138abfb719** first, then **58b29bdf6186a**.
**YES**
drivers/net/phy/sfp.c | 139 +++++++++++++++++++++++++++++++++--------- 1 file changed, 111 insertions(+), 28 deletions(-)
drivers/net/phy/sfp.c +111 -28
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/rtnetlink.h> #include <linux/slab.h> +#include <linux/unaligned.h> #include <linux/workqueue.h> #include "sfp.h"
@@ -774,50 +775,113 @@ static int sfp_i2c_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,return ret ==ARRAY_SIZE (msgs) ? len :0 ; } -static int sfp_smbus_byte_read (struct sfp *sfp,bool a2,u8 dev_addr, -void *buf,size_t len) +static int sfp_smbus_read (struct sfp *sfp,bool a2,u8 dev_addr,void *buf, +size_t len) { -union i2c_smbus_data smbus_data; +union i2c_smbus_data smbus_data = {0 };u8 bus_addr = a2 ?0x51 :0x50 ; +size_t this_len, transferred; +u32 functionality;u8 *data = buf;int ret; -while (len) { - ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , -I2C_SMBUS_READ , dev_addr, -I2C_SMBUS_BYTE_DATA , &smbus_data); -if (ret <0 ) -return ret; + functionality =i2c_get_functionality (sfp->i2c); - *data = smbus_data.byte; +while (len) { + this_len =min (len, sfp->i2c_block_size); + +if (functionality &I2C_FUNC_SMBUS_READ_I2C_BLOCK ) { + smbus_data.block[0 ] = this_len; + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_READ , dev_addr, +I2C_SMBUS_I2C_BLOCK_DATA , &smbus_data); +if (ret <0 ) +return ret; + + transferred =min_t (size_t, smbus_data.block[0 ], this_len); +if (!transferred) +return -EIO ; + +memcpy (data, &smbus_data.block[1 ], transferred); + }else if (this_len >=2 && + (functionality &I2C_FUNC_SMBUS_READ_WORD_DATA )) { + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_READ , dev_addr, +I2C_SMBUS_WORD_DATA , &smbus_data); +if (ret <0 ) +return ret; + +put_unaligned_le16 (smbus_data.word, data); + transferred =2 ; + }else { + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_READ , dev_addr, +I2C_SMBUS_BYTE_DATA , &smbus_data); +if (ret <0 ) +return ret; + + *data = smbus_data.byte; + transferred =1 ; + } - len--; - data++; - dev_addr++; + data += transferred; + len -= transferred; + dev_addr += transferred; }return data - (u8 *)buf; } -static int sfp_smbus_byte_write (struct sfp *sfp,bool a2,u8 dev_addr, -void *buf,size_t len) +static int sfp_smbus_write (struct sfp *sfp,bool a2,u8 dev_addr,void *buf, +size_t len) {union i2c_smbus_data smbus_data;u8 bus_addr = a2 ?0x51 :0x50 ; +size_t this_len, transferred; +u32 functionality;u8 *data = buf;int ret; + functionality =i2c_get_functionality (sfp->i2c); +while (len) { - smbus_data.byte = *data; - ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , -I2C_SMBUS_WRITE , dev_addr, -I2C_SMBUS_BYTE_DATA , &smbus_data); -if (ret) -return ret; + this_len =min (len, sfp->i2c_block_size); + +if (functionality &I2C_FUNC_SMBUS_WRITE_I2C_BLOCK ) { + smbus_data.block[0 ] = this_len; +memcpy (&smbus_data.block[1 ], data, this_len); + + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_WRITE , dev_addr, +I2C_SMBUS_I2C_BLOCK_DATA , &smbus_data); +if (ret <0 ) +return ret; + + transferred = this_len; + }else if (this_len >=2 && + (functionality &I2C_FUNC_SMBUS_WRITE_WORD_DATA )) { + smbus_data.word =get_unaligned_le16 (data); + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_WRITE , dev_addr, +I2C_SMBUS_WORD_DATA , &smbus_data); +if (ret <0 ) +return ret; + + transferred =2 ; + }else { + smbus_data.byte = *data; + ret =i2c_smbus_xfer (sfp->i2c, bus_addr,0 , +I2C_SMBUS_WRITE , dev_addr, +I2C_SMBUS_BYTE_DATA , &smbus_data); +if (ret <0 ) +return ret; + + transferred =1 ; + } - len--; - data++; - dev_addr++; + data += transferred; + len -= transferred; + dev_addr += transferred; }return data - (u8 *)buf;
@@ -833,10 +897,29 @@ static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c) sfp->read = sfp_i2c_read; sfp->write = sfp_i2c_write; max_block_size =SFP_EEPROM_BLOCK_SIZE ; - }else if (i2c_check_functionality (i2c,I2C_FUNC_SMBUS_BYTE_DATA )) { - sfp->read = sfp_smbus_byte_read; - sfp->write = sfp_smbus_byte_write; - max_block_size =1 ; + }else if (i2c_check_functionality (i2c,I2C_FUNC_SMBUS_BYTE_DATA ) || +i2c_check_functionality (i2c,I2C_FUNC_SMBUS_I2C_BLOCK )) { +/* Either protocol alone covers any length: I2C-block carries +* 1..32 bytes per xfer, byte iterates one byte at a time. +*/ + sfp->read = sfp_smbus_read; + sfp->write = sfp_smbus_write; + +if (i2c_check_functionality (i2c,I2C_FUNC_SMBUS_I2C_BLOCK )) + max_block_size =SFP_EEPROM_BLOCK_SIZE ; +else if (i2c_check_functionality (i2c,I2C_FUNC_SMBUS_WORD_DATA )) + max_block_size =2 ; +else + max_block_size =1 ; + }else if (WARN_ONCE (i2c_check_functionality (i2c,I2C_FUNC_SMBUS_WORD_DATA ), +"SMBus word-only adapter; odd-length transfers will fail\n" )) { +/* Word-only: even-length xfers work; odd-length xfers fall +* to BYTE, which the adapter does not advertise and will +* likely fail. +*/ + sfp->read = sfp_smbus_read; + sfp->write = sfp_smbus_write; + max_block_size =2 ; }else { sfp->i2c =NULL ;return -EINVAL ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: iwlwifi: mvm: d3: validate D3 resume notification payloads
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit c1a1dc162870a5447cb0fbcf81983473744772d2 ]
D3 resume notification handlers read firmware notification fields before validating that the payload contains the complete fixed structure. This causes buffer underread on malformed or truncated notifications.
Move payload length validation to occur before any field access in:
- iwl_mvm_parse_wowlan_info_notif: validate before reading num_mlo_link_keys
- iwl_mvm_wait_d3_notif D3_END handler: validate before reading flags
---
LLM Generated explanations, may be completely bogus:
The branch check finished: the fix commit 23939b1d1be is only on the autosel branch, not on current HEAD (v6.18.44-1-g2736c32da98b9). The ancestry-path from that commit to HEAD is empty, so the buggy code is still present in the checked-out tree.
That matches the earlier analysis: this is a prepared backport candidate that hasn’t been applied to 6.18.y yet, and the **YES** recommendation still stands.
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +9 -4
@@ -2141,16 +2141,16 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, struct iwl_wowlan_status_data *status, u32 len) { - if (IWL_FW_CHECK(mvm, data->num_mlo_link_keys, - "MLO is not supported, shouldn't receive MLO keys\n")) -return ; -if (len <sizeof (*data)) {IWL_ERR (mvm,"Invalid WoWLAN info notification!\n" ); status =NULL ;return ; } +if (IWL_FW_CHECK (mvm, data->num_mlo_link_keys, +"MLO is not supported, shouldn't receive MLO keys\n" )) +return ; +if (mvm->fast_resume)return ;
@@ -2970,6 +2970,11 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,case WIDE_ID (PROT_OFFLOAD_GROUP ,D3_END_NOTIFICATION ): {struct iwl_d3_end_notif *notif = (void *)pkt->data; +if (len <sizeof (*notif)) { +IWL_ERR (mvm,"Invalid D3 end notification size\n" ); +break ; + } + d3_data->d3_end_flags =__le32_to_cpu (notif->flags); d3_data->notif_received |=IWL_D3_NOTIF_D3_END_NOTIF ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 media: qcom: camss: avoid format string warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 797c1cbf672f372d6a464df0dcedf476fc715969 ]
clang-22 warns about csiphy_match_clock_name() taking a variable format string that is not checked against the 'int index' argument:
drivers/media/platform/qcom/camss/camss-csiphy.c:566:44: error: diagnostic behavior may be improved by
adding the 'format(printf, 2, 3)' attribute to the declaration of 'csiphy_match_clock_name' [-Werror,-Wmissing-format-attribute]
561 | static bool csiphy_match_clock_name(const char *clock_name, const char *format,
| __attribute__((format(printf, 2, 3)))
562 | int index)
563 | {
564 | char name[16]; /* csiphyXXX_timer\0 */
565 |
566 | snprintf(name, sizeof(name), format, index);
| ^drivers/media/platform/qcom/camss/camss-csiphy.c:561:13: note: 'csiphy_match_clock_name' declared here
561 | static bool csiphy_match_clock_name(const char *clock_name, const char *format,
| ^
Change the function to use a snprintf() style format string that allows this to be checked at the call site.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
**Step 1.1 Record:** Subsystem media: qcom: camss; action verb avoid; claimed intent is to silence/fix a clang-22 -Wmissing-format- attribute diagnostic in csiphy_match_clock_name().
**Step 1.2 Record:** Tags present in the submission (verified via lore):
- Fixes: 0727615fb975 ("media: qcom: camss: Functionally decompose CSIPHY clock lookups")
- Signed-off-by: Arnd Bergmann <[email protected]>
- Reviewed-by: Bryan O'Donoghue <[email protected]>
- Signed-off-by: Bryan O'Donoghue <[email protected]>
- No Reported-by, Tested-by, Cc: stable, or bug-report Link tags.
**Step 1.3 Record:** Bug is a **build failure**, not a runtime defect. With clang-22 and -Werror,-Wmissing-format-attribute, csiphy_match_clock_name() passes a variable format to snprintf() without a printf-style attribute, so the compiler errors out. Symptom:
kernel build fails when CONFIG_VIDEO_QCOM_CAMSS is enabled under those compiler flags. Root cause: helper takes const char *format, int index and uses snprintf(name, ..., format, index) without __printf(2, 3).
**Step 1.4 Record:** Not a hidden runtime bug fix. This is an explicit compiler-warning/build fix disguised as "avoid warning," but it does prevent real build breakage in clang-22 + Werror configurations.
---
## Phase 2: Diff Analysis
**Step 2.1 Record:** One file changed:drivers/media/platform/qcom/camss/camss-csiphy.c (+7/-3). Function
modified: csiphy_match_clock_name(). Scope: single-file, surgical.
**Step 2.2 Record:**
- **Before:** csiphy_match_clock_name(clock_name, format, index) calls snprintf(name, sizeof(name), format, index).
- **After:** Function becomes __printf(2, 3) csiphy_match_clock_name(clock_name, format, ...) using va_list + vsnprintf(). Call sites are unchanged and still pass literal format strings plus csiphy->id.
**Step 2.3 Record:** Bug category: **build fix / compiler diagnostic fix**. Mechanism: adding __printf(2, 3) lets clang verify format strings at call sites; variadic args preserve existing behavior.
**Step 2.4 Record:** Fix is obviously correct and minimal. Call sites at lines 678–692 still pass "csiphy%d_timer", "csi%d_phy", and "csiphy%d" with csiphy->id — compatible with variadic calling. Regression risk is very low; behavior is equivalent to the old snprintf() path. linux/kernel.h (already included) provides va_list support, matching the pattern used in the already-backported clk: qoriq fix in this tree.
---
## Phase 3: Git History Investigation
**Step 3.1 Record:** Current tree at camss-csiphy.c:561–567 still has the pre-fix code. git blame attributes those lines to merge commit 5d324e5159d9e. The csiphy_match_clock_name() helper pattern dates to commit 0727615fb975 (Oct 2023, "Functionally decompose CSIPHY clock lookups").
**Step 3.2 Record:** Fixes: 0727615fb975 exists in the object database and introduced the helper. The buggy pattern is present in the checked- out 6.18.43 tree. The fix commit itself is **not** yet in this tree.
**Step 3.3 Record:** Related recent camss commits in this tree are runtime fixes (RDI streaming, VFE lite clocks). No duplicate fix for this warning. **Precedent:** 558b2eb623f2f (clk: qoriq: avoid format string warning) — same author, same clang-22 issue, same variadic/__printf pattern — was already backported to this 6.18.y tree by Greg Kroah-Hartman.
**Step 3.4 Record:** Arnd Bergmann is a frequent contributor of clang build-warning fixes across the kernel. Bryan O'Donoghue is the camss subsystem author/maintainer and reviewed the patch.
**Step 3.5 Record:** No series dependencies. Standalone, self-contained. Call sites require no changes.
---
## Phase 4: Mailing List and External Research
**Step 4.1 Record:** Original submission at [lore.kernel.org patch thread](https://lkml.iu.edu/2603.2/11306.html) (2026-03-20). Bryan O'Donoghue replied with Reviewed-by ([spinics thread](https://www.spinics.net/lists/kernel/msg6110456.html)). No NAKs found. No explicit stable nomination in the thread. b4 dig -c <hash> failed (commit not present locally); lore fetch used instead.
**Step 4.2 Record:** CC list included linux-media, linux-arm-msm, llvm@, and subsystem maintainers (Hans Verkuil, Bryan O'Donoghue, etc.). Appropriate reviewers were involved.
**Step 4.3 Record:** No user bug report or syzbot report. Failure mode documented only via clang compiler output in the commit message.
**Step 4.4 Record:** Standalone patch, not part of a multi-patch series. Autosel pipeline has nominated a variant for 6.12.y (seen in web search), indicating automated stable consideration of this class of fix.
**Step 4.5 Record:** No stable-list discussion found beyond autosel nomination. Not applicable otherwise.
---
## Phase 5: Code Semantic Analysis
**Step 5.1 Record:** Modified function: csiphy_match_clock_name(). Caller context: msm_csiphy_subdev_init() clock-setup loop.
**Step 5.2 Record:** Three call sites in msm_csiphy_subdev_init() (lines 678, 685, 692), all during CSIPHY probe/initialization when CONFIG_VIDEO_QCOM_CAMSS is enabled on Qualcomm platforms.
**Step 5.3 Record:** Callees: va_start, vsnprintf, va_end, strcmp. No allocation, no locking.
**Step 5.4 Record:** Reachable during device probe for Qualcomm camera hardware. Not syscall-reachable directly, but affects kernel buildability for that driver — not a runtime user-triggerable crash.
**Step 5.5 Record:** Identical pattern fixed in drivers/clk/clk- qoriq.c in this same tree (558b2eb623f2f). Part of a broader clang-22 -Wmissing-format-attribute cleanup effort by Arnd Bergmann.
---
## Phase 6: Cross-Referencing Against the Local Tree
**Step 6.1 Record:** Local tree is **Linux 6.18.43** (git describe HEAD → v6.18.43-1-gc7f0dac02d232, Makefile VERSION 6.18.43). Buggy code **is present** at camss-csiphy.c:561–567. Fix is **not** yet applied.
**Step 6.2 Record:** Expected backport difficulty: **clean apply**. File structure matches the upstream diff index (62623393f414 parent in lore matches current content pattern).
**Step 6.3 Record:** No equivalent fix already in tree. Sibling fix clk: qoriq: avoid format string warning is present; camss variant is not.
---
## Phase 7: Subsystem and Maintainer Context
**Step 7.1 Record:** Subsystem: drivers/media/platform/qcom/camss — media platform driver for Qualcomm camera ISP. Criticality:
**PERIPHERAL** (hardware-specific, CONFIG_VIDEO_QCOM_CAMSS, ARM QCOM + IOMMU).
**Step 7.2 Record:** camss is actively maintained in stable with recent runtime fixes (RDI streaming, VFE lite). This patch is orthogonal to those.
---
## Phase 8: Impact and Risk Assessment
**Step 8.1 Record:** Affected population: kernel **builders** compiling CONFIG_VIDEO_QCOM_CAMSS=y/m with clang-22 and extra warnings (W=1 enables -Wmissing-format-attribute per scripts/Makefile.extrawarn:115; W=e or CONFIG_WERROR promotes warnings to errors per scripts/Makefile.extrawarn:217–219). Not universal end-user runtime impact.
**Step 8.2 Record:** Trigger: build with clang-22 + -Wmissing-format- attribute as error (e.g. make W=1 or W=e, or CONFIG_WERROR=y). Default builds without extra warnings are unaffected. Unprivileged users cannot trigger this at runtime.
**Step 8.3 Record:** Failure mode: **compile-time error** — build abort.
Severity: **LOW** for deployed systems (no runtime crash/corruption); **MEDIUM** for developers/distributions using clang CI with Werror.
**Step 8.4 Record:** Benefit: restores buildability under clang-22 Werror CI; aligns with already-accepted precedent in this tree. Risk:
very low (7-line localized change, maintainer-reviewed, no behavior change). Risk-benefit: favorable for stable given build-fix policy and existing qoriq backport.
---
## Phase 9: Final Synthesis
**Evidence FOR backport:**
- Qualifies as a **build fix** under stable-kernel-rules exceptions.
- Buggy code exists in this 6.18.43 tree; fix not yet applied.
- Small, surgical, maintainer-reviewed (Reviewed-by: Bryan O'Donoghue).
- **Direct precedent in this tree:** 558b2eb623f2f clk: qoriq: avoid format string warning — identical issue class, same author, already backported to 6.18.y.
- Prevents llvm/clang allmodconfig or W=1/W=e build failures.
**Evidence AGAINST backport:**
- Zero runtime user impact.
- Only affects non-default build configurations (extra warnings/Werror).
- Narrow scope: one optional driver on Qualcomm platforms.
**Stable rules checklist:**
1. Obviously correct and tested? **PASS** — straightforward variadic/__printf pattern; reviewed by subsystem maintainer.
2. Fixes a real bug affecting users? **PASS** — real build failure for clang-22 + Werror builders (not theoretical).
3. Important issue? **PASS (low severity)** — build breakage, not crash/corruption/security.
4. Small and contained? **PASS** — 1 file, ~10 lines.
5. No new features or APIs? **PASS** — internal static helper only.
6. Can apply to local tree? **PASS** — code present, clean apply expected.
**Exception category:** Build fix.
**Decision rationale for Linux 6.18.y:** The tree already accepts this exact class of clang-22 format-attribute build fix (qoriq clk driver). The camss variant is the same technical issue, same fix pattern, same author, and the pre-fix code is present here. While runtime impact is nil, stable policy explicitly includes build fixes, and this tree has established precedent for backporting them.
---
## Verification
- [Phase 1] Parsed commit message and lore submission; tags recorded; no syzbot/user reports.
- [Phase 2] Read camss-csiphy.c:561–692; confirmed diff changes only csiphy_match_clock_name(); call sites unchanged.
- [Phase 3] git describe HEAD → v6.18.43; git blame -L 561,570 → pre-fix code present; git show 0727615fb975 → introduced helper Oct 2023; git show 558b2eb623f2f → sibling fix already in tree.
- [Phase 3] git log --grep="avoid format string warning" → only qoriq fix present, not camss.
- [Phase 4] WebFetch lore submission and Bryan O'Donoghue review; b4 dig -c failed (commit not in local repo).
- [Phase 5] grep csiphy_match_clock_name → 3 call sites in msm_csiphy_subdev_init().
- [Phase 6] Confirmed tree version 6.18.43; buggy code at lines 561–567; fix absent.
- [Phase 6] Read scripts/Makefile.extrawarn:113–115,217–219 → -Wmissing-format-attribute requires W=1; Werror requires W=e or CONFIG_WERROR.
- [Phase 6] Read drivers/media/platform/qcom/camss/Kconfig → CONFIG_VIDEO_QCOM_CAMSS depends on ARCH_QCOM && IOMMU_DMA.
- [Phase 7] git log --oneline -5 -- drivers/media/platform/qcom/camss/ → active subsystem maintenance.
- [Phase 8] Assessed severity as compile-time only, LOW runtime / MEDIUM for clang CI builders.
**YES**
drivers/media/platform/qcom/camss/camss-csiphy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/camss/camss-csiphy.c +7 -3
@@ -558,12 +558,16 @@ static int csiphy_init_formats(struct v4l2_subdev *sd,return csiphy_set_format (sd, fh ? fh->state :NULL , &format); } -static bool csiphy_match_clock_name (const char *clock_name,const char *format, -int index) +static bool __printf(2, 3) +csiphy_match_clock_name(const char *clock_name, const char *format, ...) {char name[16 ];/* csiphyXXX_timer\0 */ +va_list args; + +va_start (args, format); +vsnprintf (name,sizeof (name), format, args); +va_end (args); -snprintf (name,sizeof (name), format, index);return !strcmp (clock_name, name); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: add first record offset check
In reply to Sasha LevinFrom: Gangliang Xie <[email protected]>
[ Upstream commit 4073cdf6713b7c170e35bf055354580cc52085d6 ]
check the upper and lower limits of first record offset
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: drm/amdgpu: add first record offset check
**Local tree:** v6.18.44 (stable/linux-6.18.y, VERSION = 6, PATCHLEVEL = 18, SUBLEVEL = 44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [drm/amdgpu] [add] — validate first_rec_offset bounds in RAS EEPROM header parsing during init.
### Step 1.2: Tags
**Record:**
- Signed-off-by: Gangliang Xie <[email protected]> — author
- Reviewed-by: Tao Zhou <[email protected]> — AMD reviewer
- Signed-off-by: Alex Deucher <[email protected]> — amdgpu maintainer
- No Fixes:, Reported-by:, Link:, Cc: stable, or Tested-by: tags
- Notable: maintainer sign-off and internal AMD review, but no external bug report
### Step 1.3: Body analysis
**Record:**
- **Bug described:** first_rec_offset from the RAS EEPROM header is not bounds-checked.
- **Symptom/failure mode:** Not spelled out in the message; code analysis shows invalid first_rec_offset yields an invalid ras_fri (first record index), breaking circular-buffer read logic.
- **Version info:** None in message.
- **Root cause (from code):** RAS_OFFSET_TO_INDEX() does unsigned arithmetic; a first_rec_offset below ras_record_offset wraps to a huge index, and values above the record region produce ras_fri >= ras_max_record_count.
### Step 1.4: Hidden bug fix detection
**Record:** Yes — despite the neutral “add check” wording, this is a defensive bug fix completing RAS header validation started by 5df0d6addb7e9 (“Add basic validation for RAS header”). Invalid ras_fri can cause out-of-bounds EEPROM reads and bad arithmetic in amdgpu_ras_eeprom_read().
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **File:** drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c (+8 lines)
- **Function:** amdgpu_ras_eeprom_init()
- **Scope:** Single-file, surgical validation on an error path
### Step 2.2: Code flow change
**Record:**
- **Before:** After validating ras_num_recs, code unconditionally sets control->ras_fri = RAS_OFFSET_TO_INDEX(control, hdr->first_rec_offset) and returns success.
- **After:** Rejects headers where first_rec_offset < ras_record_offset or ras_fri >= ras_max_record_count, logging an error and returning -EINVAL.
- **Path affected:** GPU probe / RAS EEPROM init (error-handling path for corrupt EEPROM data).
### Step 2.3: Bug mechanism
**Record:** **Memory safety / logic correctness fix**
- RAS_OFFSET_TO_INDEX is ((offset - ras_record_offset) / 24) using unsigned math.
- Corrupt first_rec_offset below ras_record_offset (e.g. 0 when minimum is 20) wraps to a huge ras_fri.
- ras_fri drives circular-buffer indexing in amdgpu_ras_eeprom_read(); with invalid ras_fri, g0/g1 arithmetic can produce read counts far larger than the allocated buffer (e.g. buffer sized for ras_num_recs but __amdgpu_ras_eeprom_read() asked to read underflow-derived huge counts).
- No validation existed for this field; only ras_num_recs was checked (since 5df0d6addb7e9).
### Step 2.4: Fix quality
**Record:**
- **Quality:** Obviously correct — mirrors existing header validation style.
- **Minimal:** 8 lines, no API changes.
- **Regression risk:** Very low; only rejects already-invalid headers. On failure, amdgpu_ras_init_badpage_info() already sets is_eeprom_valid = false and skips EEPROM loading.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:**
- ras_fri assignment and ras_num_recs check introduced together in 5df0d6addb7e9 (Lijo Lazar, 2025-03-26) — “Add basic validation for RAS header”.
- That commit validated record count but not first_rec_offset.
- Bug present since 5df0d6addb7e9 in this tree; ras_fri usage is much older.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag. Natural follow-up to 5df0d6addb7e9, which is already in this tree.
### Step 3.3: Related file history
**Record:**
- 5df0d6addb7e9 — basic RAS header validation (in tree)
- 660261df61fb7 — checksum validation on unload (in tree)
- 89232d0db3ca9 — return on checksum error (in tree)
- 4073cdf6713b7 — this fix (on master, **not** in 6.18.y)
- c83e4a45ff9a0 — tbl_size validation (on master, not in tree; separate issue)
- Standalone one-commit fix, not part of a multi-patch series.
### Step 3.4: Author context
**Record:** Gangliang Xie is an active amdgpu contributor (RAS EEPROM
work: checksum checks, bad-page loading, threshold handling). Alex Deucher is amdgpu maintainer.
### Step 3.5: Dependencies
**Record:**
- Depends on amdgpu_ras_eeprom_init() and fields from 5df0d6addb7e9 — all present in 6.18.y.
- git apply --check on 4073cdf6713b7 succeeds cleanly against current tree.
- Applies standalone.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:** b4 dig -c 4073cdf6713b7 returned no match. Lore search blocked (Anubis bot protection). Commit is on master as 4073cdf6713b7 (committed 2026-05-19).
### Step 4.2: Reviewers
**Record:** b4 dig -w also failed. From commit metadata: Reviewed-by Tao Zhou (AMD), Signed-off-by Alex Deucher (maintainer).
### Step 4.3: Bug reports
**Record:** No Reported-by: or Link: tags. No syzbot/fuzzer report. Bug inferred from code path and prior validation commit rationale (“corrupted EEPROM header”).
### Step 4.4: Related patches
**Record:** Related mainline follow-up c83e4a45ff9a0 (tbl_size guard) is separate; not required for this patch.
### Step 4.5: Stable list discussion
**Record:** Could not search lore stable list (bot protection). No evidence found that this was explicitly rejected for stable.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** amdgpu_ras_eeprom_init() (modified); downstream consumers of ras_fri: amdgpu_ras_eeprom_read(), __amdgpu_ras_eeprom_read(), EEPROM write paths.
### Step 5.2: Callers
**Record:**
- amdgpu_ras_eeprom_init() ← amdgpu_ras_init_badpage_info() ← amdgpu_ras_recovery_init() / amdgpu_xgmi.c
- Called during GPU probe/RAS init on AMD hardware with RAS EEPROM support (not VF, not SR-IOV guest).
### Step 5.3: Callees
**Record:** amdgpu_eeprom_read(), __decode_table_header_from_buf(), RAS_OFFSET_TO_INDEX macro.
### Step 5.4: Reachability
**Record:**
- Triggered at boot/probe when reading physical GPU EEPROM over I2C.
- Not directly userspace-triggerable, but affects every boot on affected AMD GPUs with corrupted EEPROM.
- Corruption can arise from hardware wear, firmware bugs, or prior bad writes.
### Step 5.5: Similar patterns
**Record:** Same validation pattern as ras_num_recs > ras_max_record_count check added in 5df0d6addb7e9. Part of a series of RAS EEPROM hardening commits already present in 6.18.y.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE
### Step 6.1: Buggy code in tree?
**Record:** **Yes.** At line 1441 in amdgpu_ras_eeprom.c, ras_fri is set without bounds checking. Fix commit 4073cdf6713b7 is not an ancestor of HEAD (git merge-base --is-ancestor exit 1). Gap introduced when 5df0d6addb7e9 landed in this tree (2025-03).
### Step 6.2: Backport complications
**Record:** Clean apply confirmed (git apply --check passes). No conflicts expected.
### Step 6.3: Related fixes already present?
**Record:** Prior validation (5df0d6addb7e9, 660261df61fb7, 89232d0db3ca9) is in tree, but not this first_rec_offset check. No duplicate fix found (git log --grep="first record offset" HEAD empty).
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/gpu/drm/amd/amdgpu — **IMPORTANT** (AMD GPU driver, RAS reliability/memory-error tracking). Not core-kernel-wide, but affects production AMD GPU deployments (datacenter, workstation).
### Step 7.2: Subsystem activity
**Record:** Actively maintained; multiple RAS EEPROM validation commits in 2025–2026 in this file.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** AMD GPUs with RAS EEPROM support and corrupted/invalid first_rec_offset in EEPROM header. Config/driver-specific, not universal.
### Step 8.2: Trigger conditions
**Record:** Corrupt EEPROM header on boot/RAS init. Uncommon but realistic (EEPROM corruption is exactly why 5df0d6addb7e9 was added). Not userspace-exploitable in the usual sense.
### Step 8.3: Failure mode severity
**Record:** Invalid ras_fri breaks circular-buffer arithmetic in amdgpu_ras_eeprom_read():
- Unsigned underflow when ras_fri > ras_max_record_count → g0 = ras_max_record_count - ras_fri wraps to a huge value
- __amdgpu_ras_eeprom_read() may attempt reads far exceeding the kcalloc(num, ...) buffer
- **Severity: HIGH** — potential buffer overrun, I2C read errors, driver malfunction; graceful -EINVAL path exists with the fix
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** HIGH for affected hardware — prevents invalid EEPROM parsing and dangerous downstream reads
- **Risk:** VERY LOW — 8-line bounds check, same style as existing validation
- **Ratio:** Strongly favors backport
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Fixes real gap in RAS EEPROM header validation left by 5df0d6addb7e9
- Invalid ras_fri can cause dangerous read arithmetic / buffer sizing mismatch
- Small, surgical, maintainer-reviewed
- Applies cleanly to 6.18.y
- Prerequisites already in tree
- Consistent with other RAS EEPROM hardening already backported to this tree
**AGAINST backport:**
- Commit message lacks explicit crash/reproducer description
- Requires corrupted EEPROM (hardware-specific edge case)
- No syzbot or user bug report
**Unresolved:** Lore discussion and stable-list nomination could not be verified (b4/lore unavailable).
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — straightforward bounds check; AMD-reviewed, maintainer-acked (no runtime test cited).
2. Fixes a real bug? **PASS** — unvalidated first_rec_offset yields invalid ras_fri.
3. Important issue? **PASS** — HIGH severity: potential buffer overrun / driver malfunction on corrupt EEPROM.
4. Small and contained? **PASS** — 8 lines, one function.
5. No new features/APIs? **PASS** — validation only.
6. Can apply to local tree? **PASS** — clean apply, prerequisites present.
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs). Standard bug fix.
### Step 9.4: Decision rationale
This completes RAS EEPROM header validation already started in this 6.18.y tree. Without it, a corrupt first_rec_offset can slip past existing checks and produce an invalid ras_fri, leading to broken circular-buffer read logic and potential memory safety issues during bad-page loading. The fix is minimal, obviously correct, low-risk, and directly addresses a real failure mode on AMD RAS-capable hardware.
---
## Verification
- **[Phase 1]** Parsed commit message and tags from user-provided diff and git show 4073cdf6713b7
- **[Phase 2]** Read amdgpu_ras_eeprom_init() at lines 1373–1444; analyzed RAS_OFFSET_TO_INDEX macro (lines 135–136) and amdgpu_ras_eeprom_read() (lines 962–1028)
- **[Phase 2]** Traced buffer overflow scenario: invalid ras_fri → bad g0/g1 in amdgpu_ras_eeprom_read()
- **[Phase 3]** git blame -L 1434,1444: 5df0d6addb7e9 introduced unchecked ras_fri assignment
- **[Phase 3]** git show 5df0d6addb7e9: prior validation commit rationale (corrupt EEPROM → huge allocation)
- **[Phase 3]** git merge-base --is-ancestor 4073cdf6713b7 HEAD → exit 1 (fix not in tree)
- **[Phase 3]** git merge-base --is-ancestor 5df0d6addb7e9 HEAD → in tree; 660261df61fb7 → in tree
- **[Phase 3]** git apply --check on 4073cdf6713b7 → applies cleanly
- **[Phase 4]** b4 dig -c 4073cdf6713b7 → no result (exit 1)
- **[Phase 4]** Lore.kernel.org fetch → blocked by Anubis
- **[Phase 5]** grep amdgpu_ras_eeprom_init: callers in amdgpu_ras.c:3590, amdgpu_xgmi.c:1674
- **[Phase 5]** amdgpu_ras_init_badpage_info() sets is_eeprom_valid = !ret on init failure (line 3591)
- **[Phase 6]** git describe HEAD → v6.18.44; tree is stable/linux-6.18.y
- **[Phase 6]** Buggy code confirmed at line 1441 without bounds check
- **[Phase 6]** git log --grep="first record offset" HEAD → empty (fix absent)
- **[Phase 8]** Constants verified: RAS_TABLE_HEADER_SIZE=20, RAS_RECORD_START=20, RAS_TABLE_RECORD_SIZE=24, RAS_MAX_RECORD_COUNT≈10922
---
**YES**The background check on stable/linux-6.18.y confirmed:
- **Related validation is present:** 5df0d6addb7e9 ("Add basic validation for RAS header") is in the tree.
- **This fix is not:** no commit matching "first record offset" was found on the stable branch.
That matches the earlier analysis: the gap remains in 6.18.y, the patch applies cleanly, and the backport recommendation stands at **YES**.
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +8 -0
@@ -1439,6 +1439,14 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control) } control->ras_fri =RAS_OFFSET_TO_INDEX (control, hdr->first_rec_offset); +if (hdr->first_rec_offset < control->ras_record_offset || + control->ras_fri >= control->ras_max_record_count) { +dev_err (adev->dev, +"RAS header invalid, ras_fri: %u, first_rec_offset:0x%x" , + control->ras_fri, hdr->first_rec_offset); +return -EINVAL ; + } + control->ras_num_mca_recs =0 ; control->ras_num_pa_recs =0 ;return 0 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 wifi: rtw89: mlo: rearrange MLSR link decision flow
In reply to Sasha LevinFrom: Kuan-Chung Chen <[email protected]>
[ Upstream commit 7284f5be5d298c901be1fc9fda6a2476f5ffdbaf ]
The original MLSR link decision refers to RSSI, but it should be based on the premise of an existing link. Otherwise, make a link decision to select a new link from any available band.
---
LLM Generated explanations, may be completely bogus:
Two background git history lookups were interrupted (one had used git log --all, which is too slow in this repo).
The follow-up without --all completed: rtw89_core_mlo_track first appears in this 6.18.43 tree at 5d324e5159d9e (v6.18-rc8 era), so the MLSR code the patch fixes is present here. That matches the earlier analysis — **YES** for backport.
drivers/net/wireless/realtek/rtw89/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +7 -7
@@ -4276,13 +4276,19 @@ static void rtw89_core_mlsr_link_decision(struct rtw89_dev *rtwdev, {unsigned int sel_link_id =IEEE80211_MLD_MAX_NUM_LINKS ;struct ieee80211_vif *vif =rtwvif_to_vif (rtwvif); +u8 decided_bands =BIT (RTW89_BAND_NUM ) -1 ;struct rtw89_vif_link *rtwvif_link;const struct rtw89_chan *chan;unsigned long usable_links;unsigned int link_id; -u8 decided_bands;u8 rssi; + usable_links =ieee80211_vif_usable_links (vif); + + rtwvif_link =rtw89_get_designated_link (rtwvif); +if (unlikely (!rtwvif_link)) + goto select; + rssi =ewma_rssi_read (&rtwdev->phystat.bcn_rssi);if (unlikely (!rssi))return ;
@@ -4294,12 +4300,6 @@ static void rtw89_core_mlsr_link_decision(struct rtw89_dev *rtwdev,else return ; - usable_links =ieee80211_vif_usable_links (vif); - - rtwvif_link =rtw89_get_designated_link (rtwvif); -if (unlikely (!rtwvif_link)) - goto select; - chan =rtw89_chan_get (rtwdev, rtwvif_link->chanctx_idx);if (decided_bands &BIT (chan->band_type))return ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 ASoC: rockchip: spdif: Restore regcache cache-only mode on sync failure
In reply to Sasha LevinFrom: bui duc phuc <[email protected]>
[ Upstream commit 3546e9aa691ac981e4734fedd1646d0180784893 ]
If regcache_sync() fails during runtime resume, the driver disables the clocks and returns an error. However, the regmap cache-only mode is left disabled.
Restore cache-only mode in the error path so subsequent register accesses continue to use the cache while the device is inactive.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [ASoC: rockchip: spdif] [Restore] Restore regcache cache- only mode on sync failure during runtime resume error path
### Step 1.2: Commit Tags
**Record:**
- **Reported-by:** Sashiko AI Review <[email protected]> — automated review bot, not a user crash report
- **Closes:** https://lore.kernel.org/all/20260522103713.6C09D1F000E9@sm
tp.kernel.org/ — Sashiko review thread
- **Signed-off-by:** bui duc phuc <[email protected]> — author
- **Link:**
https://patch.msgid.link/[email protected]
— patch 5 of a series (message-id suffix)
- **Signed-off-by:** Mark Brown <[email protected]> — ASoC subsystem maintainer
- **No Fixes:** tag (expected for manual review pipeline)
- **No Cc: [email protected]** (expected; not a negative signal)
- **No Tested-by / Reviewed-by / Acked-by**
Notable: maintainer sign-off from Mark Brown; same author (phucduc.bui) recently landed an analogous regcache_cache_only error-path fix for gpio-pca953x with Cc: [email protected].
### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** On regcache_sync() failure in rk_spdif_runtime_resume(), clocks are disabled and an error is returned, but regcache_cache_only(false) is never reverted.
- **Symptom:** After a failed resume, regmap leaves cache-only mode while the device is inactive; subsequent register accesses attempt hardware I/O instead of using the cache.
- **Root cause:** Incomplete error-path state restoration — suspend sets cache_only(true), resume sets cache_only(false) before sync, but the sync-failure path omits restoring cache_only(true).
- **Version info:** None stated in the commit message.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Not disguised — this is an explicit error-path state-machine bug fix, though the subject uses "Restore" rather than "fix".
---
## Phase 2: Diff Analysis
### Step 2.1: Change Inventory
**Record:**
- **Files:** sound/soc/rockchip/rockchip_spdif.c — 1 line added (+1 net in the shown hunk)
- **Function modified:** rk_spdif_runtime_resume()
- **Scope:** Single-file, surgical fix
Note: upstream diff shows hclk enabled before mclk; this tree enables mclk then hclk. The added line placement (inside the regcache_sync() failure block, before clock disable) is identical in intent.
### Step 2.2: Code Flow Change
**Record:**
- **Hunk (regcache_sync error path):**
- **Before:** On sync failure → disable clocks → return error, leaving
`cache_only == false`
- **After:** On sync failure → regcache_cache_only(map, true) → disable clocks → return error
- **Affected path:** Runtime PM resume error path only (not the success path)
### Step 2.3: Bug Mechanism
**Record:**
- **Category:** Error-path / state consistency bug (regmap cache-mode invariant violation)
- **Mechanism:** rk_spdif_runtime_suspend() sets cache-only; resume clears it before sync; failed sync leaves the map in "live hardware" mode while clocks are off and the device is inactive. The fix restores the suspended-state invariant.
### Step 2.4: Fix Quality
**Record:**
- **Quality:** Obviously correct — mirrors the established pattern in sgtl5000.c and the recently backported pca953x fix by the same author.
- **Regression risk:** Very low — one line on an already-rare error path.
- **Red flags:** None.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:**
- Buggy regcache_sync() error path introduced by **3628c6987fb45** (2016-09-07): "ASoC: rockchip: spdif: restore register during runtime_suspend/resume cycle"
- Related prior fix: **6d94d0090527b** (2022-12-08) added missing clk_disable_unprepare() on hclk failure — same function, same class of incomplete error handling
- PM runtime integration: **f50d67f9eff62** (2020-07-13)
### Step 3.2: Fixes: Tag
**Record:** Not applicable — no Fixes: tag in the commit message.
### Step 3.3: Related File History
**Record:**
- Recent changes to this file are cleanups (RUNTIME_PM_OPS, remove callback, DAI merge) — no overlapping fix for this bug.
- Fix commit message not found in this tree — **fix is not yet applied locally**.
- Patch appears standalone (single line, one file); message-id -5 suggests a series, but no series dependency is evident from the diff.
### Step 3.4: Author Context
**Record:**
- Author phucduc.bui has no other commits under sound/soc/rockchip/ in this tree.
- Same author authored **2e4bc8422cdee** (gpio: pca953x: fix cache_only ... on restore_context() failure), which was backported to this stable tree with Cc: [email protected].
### Step 3.5: Dependencies
**Record:** No prerequisites — self-contained one-line addition. Applies cleanly to this tree (clock order differs cosmetically, hunk location unchanged).
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Patch Discussion
**Record:** b4 dig -m "Restore regcache cache-only mode on sync failure" returned no match. b4 dig -m "[email protected]" returned no match. Lore/patch.msgid.link URLs blocked by Anubis bot protection — **could not read review thread content**.
### Step 4.2: Reviewers
**Record:** b4 dig -w not usable (no thread match). Mark Brown (maintainer) Signed-off-by confirms maintainer acceptance.
### Step 4.3: Bug Report
**Record:** Reported by Sashiko AI Review (automated static analysis), not syzbot or a user crash report. Underlying issue is code-review- identified state inconsistency, not a filed oops trace.
### Step 4.4: Related Patches
**Record:** Same author/class of fix in gpio-pca953x (already in this tree at 2e4bc8422cdee). sgtl5000.c already implements the correct pattern at lines 1135–1139.
### Step 4.5: Stable List History
**Record:** Could not search lore stable list (Anubis blocking). The analogous pca953x fix from this author explicitly carried `Cc:
[email protected]` and was merged here by Greg K-H.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** rk_spdif_runtime_resume() modified; related:rk_spdif_runtime_suspend(), rk_spdif_hw_params(), rk_spdif_trigger()
### Step 5.2: Callers
**Record:**
- rk_spdif_runtime_resume() registered via RUNTIME_PM_OPS() at line 377 — invoked by PM core on runtime resume
- Direct call from rk_spdif_probe() when PM runtime is disabled (lines 338–341)
- Regmap users: rk_spdif_hw_params(), rk_spdif_trigger() — ASoC PCM/DAI paths during active audio
### Step 5.3: Callees
**Record:** clk_prepare_enable(), regcache_cache_only(), regcache_mark_dirty(), regcache_sync(), clk_disable_unprepare()
### Step 5.4: Reachability
**Record:**
- Resume path reachable on every runtime PM resume (suspend/resume cycles, audio start on Rockchip boards)
- Bug triggers only when regcache_sync() returns error (uncommon but real — bus/clock/hardware failure during sync)
- After bug triggers, any regmap access while device is inactive hits hardware path instead of cache — reachable from subsequent resume retries or regmap ops if PM state is inconsistent
### Step 5.5: Similar Patterns
**Record:**
- **Correct pattern:** sound/soc/codecs/sgtl5000.c:1135-1139 restores cache_only(true) on sync failure
- **Same bug class, same author:** drivers/gpio/gpio-pca953x.c pca953x_restore_context() err path
- **Same bug present:** sound/soc/rockchip/rockchip_sai.c:251-277 — also lacks cache-only restore on sync failure (out of scope for this commit)
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy Code Present?
**Record:** **YES.** Local tree is **v6.18.44** (6.18.44). Buggy code at:
```98:102:sound/soc/rockchip/rockchip_spdif.c
ret = regcache_sync(spdif->regmap);
if (ret) {
clk_disable_unprepare(spdif->mclk);
clk_disable_unprepare(spdif->hclk);
}
```Missing regcache_cache_only(spdif->regmap, true). Bug present since 3628c6987fb45 (2016).
### Step 6.2: Backport Complications
**Record:** Clean apply expected — add one line inside existing if (ret) block. Clock enable order differs from upstream diff but hunk location is unchanged.
### Step 6.3: Related Fixes Already Present?
**Record:** No equivalent fix in this tree. Prior related fix 6d94d0090527b (missing clk disable) is present. Fix commit not found via grep or git log.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem and Criticality
**Record:** **ASoC / Rockchip SPDIF driver** — **PERIPHERAL** (Rockchip embedded SoC audio output). Affects boards using the in-SoC SPDIF controller (RK3288, RK3399, RK3568, etc.).
### Step 7.2: Subsystem Activity
**Record:** Moderate recent activity (SAI driver additions, cleanups); SPDIF driver itself is mature with infrequent changes.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** Users of Rockchip platforms with CONFIG_SND_SOC_ROCKCHIP_SPDIF and the built-in SPDIF DAI — embedded/ARM boards, not universal x86 users.
### Step 8.2: Trigger Conditions
**Record:**
- **Trigger:** regcache_sync() failure during runtime resume
- **Likelihood:** Uncommon (requires hardware/bus/clock issue during sync)
- **Unprivileged trigger:** No — requires device access and a resume failure condition
### Step 8.3: Failure Mode Severity
**Record:**
- **Failure mode:** Regmap attempts live MMIO (devm_regmap_init_mmio_clk uses hclk) while driver considers device suspended; register state may be inconsistent; subsequent resume/audio operations may fail, hang, or produce silent corruption
- **Severity:** **MEDIUM** — real functional bug on an error path, not a common crash, but can leave driver in an unrecoverable inconsistent state without the fix
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Restores correct PM/regmap state invariant; prevents post-failure regmap/hardware mismatch on Rockchip SPDIF; aligns with established kernel patterns
- **Risk:** Very low — one line, error path only
- **Ratio:** Favorable for backport
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real bug — incomplete error-path state restoration since 2016
- Bug confirmed present in v6.18.44 tree
- One-line, obviously correct fix matching sgtl5000 and backported pca953x precedent
- ASoC maintainer (Mark Brown) Signed-off-by
- Same author successfully got analogous fix into this stable tree
- Low regression risk
**AGAINST backport:**
- Rare trigger (regcache_sync() failure)
- Driver-specific, embedded Rockchip only
- No user crash report or syzbot — flagged by AI review bot
- Medium not critical severity
**UNRESOLVED:**
- Full lore review thread content (Anubis blocked)
- Whether reviewers explicitly nominated for stable
- Whether patch 5/N series has other dependencies (diff appears standalone)
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — pattern proven elsewhere; maintainer SOB; no Tested-by
2. Fixes a real bug affecting users? **PASS** — state-machine bug on resume error path for Rockchip SPDIF users
3. Important issue? **PASS (MEDIUM)** — can cause driver malfunction/hang on error path, not security/data-corruption in common case
4. Small and contained? **PASS** — 1 line, 1 file
5. No new features or APIs? **PASS**
6. Can apply to local tree? **PASS** — buggy code present, clean apply
### Step 9.3: Exception Categories
**Record:** Not applicable — standard bug fix, not device ID/quirk/build/doc exception.
### Step 9.4: Decision Rationale
This is a well-understood error-path invariant fix: when runtime resume fails after disabling cache-only mode, the driver must restore cache- only mode before turning clocks off — exactly what suspend established. The bug has existed since the regcache resume logic was added in 2016 and is present in this 6.18.y tree. While the trigger is uncommon and impact is driver-specific, the fix is trivial, low-risk, maintainer- approved, and follows a pattern already accepted for stable (pca953x, sgtl5000). Conservative stable policy favors such surgical error-path fixes that prevent leaving hardware drivers in inconsistent states.
---
## Verification
- **[Phase 1]** Parsed commit message and all tags from user-provided commit text
- **[Phase 2]** Diff analysis: 1 line added in rk_spdif_runtime_resume() error path
- **[Phase 3]** git describe HEAD: v6.18.44-1-g2736c32da98b9 / kernel 6.18.44
- **[Phase 3]** git blame -L 77,105: regcache error path from 3628c6987fb45 (2016)
- **[Phase 3]** git show 3628c6987fb45: confirmed introduction of regcache_sync without cache-only restore on error
- **[Phase 3]** git show 6d94d0090527b: related prior error-path fix in same function
- **[Phase 3]** git log --grep="Restore regcache": no fix commit in tree
- **[Phase 3]** git show 2e4bc8422cdee: same author's analogous pca953x fix backported here with Cc: stable
- **[Phase 4]** b4 dig -m "Restore regcache...": no match
- **[Phase 4]** WebFetch lore/patch.msgid.link URLs: blocked by Anubis — **UNVERIFIED** review thread content
- **[Phase 5]** Read rockchip_spdif.c: confirmed regmap users and PM ops registration
- **[Phase 5]** Read sgtl5000.c:1135-1139: confirmed correct reference pattern
- **[Phase 5]** Read rockchip_sai.c:251-277: same missing pattern (separate issue)
- **[Phase 5]** Read drivers/base/regmap/regcache.c:551-570: confirmed cache_only semantics
- **[Phase 6]** Read current rockchip_spdif.c:66-105: confirmed buggy code without fix
- **[Phase 6]** git log --oneline -20 -- sound/soc/rockchip/rockchip_spdif.c: no conflicting fix present
**YES****Verdict: YES** — backport to this tree (v6.18.44).
The Rockchip SPDIF driver leaves regcache_cache_only disabled when regcache_sync() fails during runtime resume, so later register accesses can hit hardware while the device is still inactive. The fix is a one-line restore of cache-only mode on that error path — same pattern as sgtl5000 and the author’s backported pca953x fix. The bug has been present since 2016 and is still in this checkout; it’s a small, low-risk, maintainer-signed error-path fix.
sound/soc/rockchip/rockchip_spdif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_spdif.c +1 -0
@@ -97,6 +97,7 @@ static int rk_spdif_runtime_resume(struct device *dev) ret =regcache_sync (spdif->regmap);if (ret) { +regcache_cache_only (spdif->regmap, true);clk_disable_unprepare (spdif->mclk);clk_disable_unprepare (spdif->hclk); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 platform/x86/amd/hsmp: Clamp ioctl/send_message indices (Spectre v1)
In reply to Sasha LevinFrom: Muralidhara M K <[email protected]>
[ Upstream commit d20457b46eca76b9bb716dd31af591cad21607b5 ]
Although validate_message() checks msg_id, a mispredicted branch can still allow speculative indexing into hsmp_msg_desc_table[]. Clamp msg.msg_id with array_index_nospec() at entry to hsmp_ioctl_msg() so downstream dereferences (including via is_get_msg() and hsmp_send_message()) see a bounded index.
Similarly, hsmp_send_message() bounds-checks msg->sock_ind before indexing hsmp_pdev.sock[], but a mispredicted branch can still speculatively use the raw index (Spectre v1, CVE-2017-5753). Apply array_index_nospec() after the check so every caller that reaches hsmp_pdev.sock[] through this helper sees a clamped socket index—including hsmp_ioctl_msg() and any other path that hands a user-derived struct hsmp_message to hsmp_send_message().
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: platform/x86/amd/hsmp: Clamp ioctl/send_message indices (Spectre v1)
**Local tree:** Linux **6.18.44** (v6.18.44-1-g2736c32da98b9) **Commit under review:** d5be735237be5 (upstream: d20457b46eca) — present on autosel branch, **not** in current HEAD
---
## PHASE 1: COMMIT MESSAGE FORENSICS
**Step 1.1 — Subject parse**
Record: [platform/x86/amd/hsmp] [Clamp] — Spectre v1 mitigation for user-controlled array indices in HSMP ioctl/send_message paths.
**Step 1.2 — Tags**
Record:
- Reviewed-by: Muthusamy Ramalingam <[email protected]> (AMD)
- Reviewed-by: Ilpo Järvinen <[email protected]> (platform-drivers-x86 maintainer)
- Signed-off-by: Muralidhara M K <[email protected]> (author)
- `Link: https://patch.msgid.link/20260612042610.1629037-7-
[email protected]`
- No Fixes:, Reported-by:, Cc: [email protected], or syzbot tags
- [Upstream commit d20457b46eca...] marker present (pipeline artifact — ignored per instructions)
**Step 1.3 — Body analysis**
Record:
- **Bug:** After bounds checks on msg_id and sock_ind, a mispredicted branch (Spectre v1 / CVE-2017-5753) can still cause speculative indexing into hsmp_msg_desc_table[] and hsmp_pdev.sock[], leaking kernel memory into cache.
- **Symptom:** Side-channel information disclosure (not a direct crash).
- **Root cause:** Missing array_index_nospec() after bounds checks on user-controlled indices.
- **Fix:** Clamp msg.msg_id in hsmp_ioctl() before downstream use; clamp sock_ind in hsmp_send_message() before socket array access.
- Note: commit message refers to hsmp_ioctl_msg() but the actual function is hsmp_ioctl() (verified in source).
**Step 1.4 — Hidden bug fix?**
Record: No — this is an explicit Spectre v1 security fix, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
**Step 2.1 — Inventory**
Record:
- **Files:** drivers/platform/x86/amd/hsmp/hsmp.c (+23 / -1)
- **Functions:** hsmp_send_message(), hsmp_ioctl()
- **Scope:** Single-file, surgical security fix
**Step 2.2 — Code flow changes**
| Hunk | Before | After | |------|--------|-------| | `hsmp_send_message()` | Bounds-check `sock_ind`, then directly index `hsmp_pdev.sock[msg->sock_ind]` | After bounds check, `sock_ind = array_index_nospec(msg->sock_ind, hsmp_pdev.num_sockets)` then index with clamped value | | `hsmp_ioctl()` | Bounds-check `msg_id`, then call `is_get_msg()` / `hsmp_send_message()` with raw `msg_id` | After bounds check,
msg.msg_id = array_index_nospec(msg.msg_id, HSMP_MSG_ID_MAX) before any table dereference |
Record: Both hunks affect the userspace ioctl hot path and the shared hsmp_send_message() helper used by ioctl.
**Step 2.3 — Bug mechanism**
Record: **Memory safety / Spectre v1 speculative out-of-bounds read.** User-supplied msg_id and sock_ind pass explicit bounds checks, but CPU speculation can bypass those checks and index past array ends into adjacent kernel memory. array_index_nospec() masks the index so speculative execution cannot use out-of-range values.
**Step 2.4 — Fix quality**
Record: Fix is minimal, follows the established kernel Spectre- mitigation pattern (array_index_nospec after bounds check). No new locking or API changes. Regression risk is very low. Compiles successfully in this tree without additional includes (verified).
---
## PHASE 3: GIT HISTORY INVESTIGATION
**Step 3.1 — Blame**
Record: Vulnerable ioctl/send_message logic dates to 91f410aa679a03 ("platform/x86: Add AMD system management interface", Feb 2022, first in **v6.0**). Bounds checks on sock_ind added in 8e75dff56e003 (Oct 2024 refactor). Bug has been present since driver introduction.
**Step 3.2 — Fixes: tag**
Record: N/A — no Fixes: tag present.
**Step 3.3 — Related file history**
Record: Recent hsmp.c changes in this tree include timeout/semaphore fixes (784e48a82976e, f8afb12a2d750) and 2c78fb287e1f4 (NULL check for metric_tbl_addr). No prior Spectre/nospec fix for HSMP in HEAD.
**Step 3.4 — Author context**
Record: Muralidhara M K (AMD). Patch is part of v6 series "Family 1Ah Model 50h-5Fh HSMP and metrics" but this specific commit only touches existing ioctl/send paths — no dependency on new message IDs from other series patches.
**Step 3.5 — Dependencies**
Record: **Standalone.** Applies cleanly (git apply --check passed). No prerequisite commits required. array_index_nospec and include/linux/nospec.h exist in this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
**Step 4.1 — Original discussion**
Record: b4 dig -c d5be735237be5 found thread at
https://patch.msgid.link/[email protected]
— [PATCH v6 6/8]. Series revisions: v5 and v6 exist; committed version matches v6. Full lore thread fetch blocked by Anubis bot protection (could not read inline review text).
**Step 4.2 — Reviewers**
Record: b4 dig -w shows CC to [email protected], [email protected], AMD reviewer, and Ilpo Järvinen.
**Step 4.3 — Bug report**
Record: N/A — no external bug report or syzbot link. Security issue identified by code review in patch series context.
**Step 4.4 — Series context**
Record: Patch 6/8 in Family 1Ah HSMP series. The Spectre fix is independent of patches 1–5 and 7–8 (new hardware messages/metrics). Safe to backport alone.
**Step 4.5 — Stable list**
Record: Not searched on lore stable list (thread content unavailable). No evidence against backport found.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
**Step 5.1 — Key functions**
Record: hsmp_ioctl(), hsmp_send_message(), validate_message(), is_get_msg()
**Step 5.2 — Callers**
Record:
- hsmp_ioctl() — registered as .unlocked_ioctl / .compat_ioctl in hsmp_fops, exposed via misc device /dev/hsmp (mode **0644**)
- hsmp_send_message() — called from hsmp_ioctl(), hsmp_msg_get_nargs(), hsmp_test(), internal metric/proto paths, and hwmon.c (kernel-constructed messages with trusted indices)
**Step 5.3 — Callees**
Record: copy_struct_from_user(), is_get_msg() → hsmp_msg_desc_table[], validate_message() → hsmp_msg_desc_table[], down_interruptible(), __hsmp_send_message()
**Step 5.4 — Reachability**
Record: **Userspace-reachable.** Any local user can open /dev/hsmp (world-readable/writable) and issue ioctl with crafted msg_id/sock_ind. This is the primary attack surface. hsmp_send_message() is also exported (EXPORT_SYMBOL_NS_GPL) for other kernel modules.
**Step 5.5 — Similar patterns**
Record: Kernel has extensive precedent for array_index_nospec Spectre fixes (e.g., c2178ff1c70eb ipv4/icmp, f0e441be08a2e drm/ioc32, 1f5f94c6c6b2e vhost/vdpa). No similar fix yet in drivers/platform/x86/.
---
## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE
**Step 6.1 — Buggy code present?**
Record: **YES.** Current HEAD at drivers/platform/x86/amd/hsmp/hsmp.c lines 213–215 and 308–338 contain bounds checks without array_index_nospec. Driver present since v6.0; fully present in 6.18.44.
**Step 6.2 — Backport complications**
Record: **Clean apply.** git apply --check succeeded. Patch compiles (make drivers/platform/x86/amd/hsmp/hsmp.o succeeded). No conflicts with recent hsmp changes in this tree.
**Step 6.3 — Fix already present?**
Record: **NO.** grep array_index_nospec drivers/platform/x86/amd/hsmp/ returns nothing on HEAD. Fix exists only on autosel branch (d5be735237be5), not merged into current HEAD.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
**Step 7.1 — Subsystem**
Record: drivers/platform/x86/amd/hsmp — AMD HSMP platform driver. **Criticality: IMPORTANT** (peripheral driver, but security-sensitive when CONFIG_AMD_HSMP is enabled on AMD EPYC/MI300A servers).
**Step 7.2 — Activity**
Record: Actively maintained — recent commits for protocol v7 messages, telemetry sysfs, semaphore/timeout fixes in 6.16–6.18 timeframe.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
**Step 8.1 — Who is affected**
Record: Systems with CONFIG_AMD_HSMP / CONFIG_AMD_HSMP_ACPI / CONFIG_AMD_HSMP_PLAT on AMD EPYC and MI300A platforms. Not universal, but real production server hardware.
**Step 8.2 — Trigger conditions**
Record: Local user opens /dev/hsmp and issues ioctl with out-of-range msg_id or sock_ind crafted to exploit branch misprediction. **Unprivileged local users can trigger** (device mode 0644). Trigger requires Spectre v1 exploitation techniques but the vulnerable code pattern is confirmed present.
**Step 8.3 — Failure mode severity**
Record: **Speculative kernel memory disclosure** (Spectre v1 side channel). Severity: **HIGH** from security perspective (CVE-2017-5753 class). No direct crash or data corruption, but information leak from kernel to userspace.
**Step 8.4 — Risk-benefit**
Record:
- **Benefit:** Closes a known Spectre v1 gadget on a world-accessible device node; aligns with established kernel security policy.
- **Risk:** Very low — 23 lines, standard array_index_nospec pattern, compiles and applies cleanly.
- **Ratio:** Strong benefit, minimal risk → backport warranted.
---
## PHASE 9: FINAL SYNTHESIS
**Step 9.1 — Evidence summary**
**FOR backport:**
- Real Spectre v1 security vulnerability (CVE-2017-5753)
- User-controlled indices via ioctl on world-accessible /dev/hsmp
- Standard, obviously-correct mitigation pattern
- Small, single-file, standalone fix
- Reviewed by AMD engineer and platform-x86 maintainer
- Applies and compiles cleanly on 6.18.44
- Bug present since driver introduction (v6.0)
- Strong kernel precedent for identical fixes in stable
**AGAINST backport:**
- Limited to AMD HSMP-enabled systems (not all kernels/users)
- No syzbot report or user crash report (side-channel, hard to observe)
- Part of larger patch series (but this commit is self-contained)
**Unresolved:** Full lore review thread content unavailable (bot protection). Does not affect technical assessment.
**Step 9.2 — Stable rules checklist**
1. Obviously correct and tested? **PASS** — standard array_index_nospec; compiles in this tree; reviewed by AMD + maintainer.
2. Fixes a real bug? **PASS** — Spectre v1 speculative OOB read on user- controlled indices.
3. Important issue? **PASS** — security vulnerability (information disclosure).
4. Small and contained? **PASS** — 23 lines, 1 file, 2 functions.
5. No new features/APIs? **PASS** — pure hardening, no behavior change for valid inputs.
6. Can apply to local tree? **PASS** — clean apply, successful compile on 6.18.44.
**Step 9.3 — Exception categories**
Record: N/A (security hardening, not device ID/quirk/build/doc exception).
**Step 9.4 — Decision rationale**
This fix closes a Spectre v1 gadget in the AMD HSMP driver where local users can pass crafted indices through a world-accessible ioctl interface. The vulnerable code exists in Linux 6.18.44, the patch is minimal and self-contained, and it follows the same pattern routinely accepted for stable backports. The limited hardware scope does not outweigh the security nature of the fix.
---
## Verification
- [Phase 1] Parsed commit d5be735237be5 / upstream d20457b46eca:
subject, tags, body; noted hsmp_ioctl_msg vs hsmp_ioctl naming discrepancy
- [Phase 2] Diff: +23/-1 in hsmp.c; two hunks in hsmp_send_message() and hsmp_ioctl()
- [Phase 3] git describe HEAD: v6.18.44; git blame: vulnerable code from 91f410aa679a03 (v6.0)
- [Phase 3] git log -20 -- drivers/platform/x86/amd/hsmp/hsmp.c: no prior nospec fix in HEAD
- [Phase 3] git merge-base --is-ancestor d5be735 HEAD: commit NOT in HEAD; on autosel branch
- [Phase 4] b4 dig -c d5be735237be5: lore URL found, patch 6/8 of v6 series
- [Phase 4] b4 dig -a: v5 and v6 revisions exist
- [Phase 4] b4 dig -w: platform-driver-x86@, AMD reviewer CC'd
- [Phase 4] WebFetch lore thread: blocked by Anubis (UNVERIFIED: inline reviewer stable nominations)
- [Phase 5] grep hsmp_send_message: ioctl path + kernel-internal callers identified
- [Phase 5] Read hsmp.c:439-446: misc device mode 0644 confirmed
- [Phase 5] Read arch/x86/include/uapi/asm/amd_hsmp.h: HSMP_TEST=1, HSMP_MSG_ID_MAX, hsmp_msg_desc_table[] confirmed
- [Phase 6] grep array_index_nospec drivers/platform/x86/amd/hsmp/: no matches on HEAD (bug present)
- [Phase 6] git apply --check: patch applies cleanly
- [Phase 6] make drivers/platform/x86/amd/hsmp/hsmp.o with patch:
compile succeeded
- [Phase 7] Read drivers/platform/x86/amd/hsmp/Kconfig: AMD_HSMP targets EPYC/MI300A
- [Phase 8] Device mode 0644: unprivileged local access confirmed
**YES**The background lookups are done and match what we already used in the review:
- **Commit hash:** d5be735237be5 — platform/x86/amd/hsmp: Clamp ioctl/send_message indices (Spectre v1)
- **hsmp.c history:** ioctl/send paths go back to the original HSMP driver (91f410aa679a03, v6.0); recent churn is mostly refactors, protocol v7, and timeout/semaphore fixes
- **Fix in tree:** not in current HEAD (6.18.44); only on autosel
Verdict for this tree is still **YES** — small Spectre v1 hardening on /dev/hsmp, applies and builds cleanly.
drivers/platform/x86/amd/hsmp/hsmp.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/hsmp/hsmp.c +23 -1
@@ -202,6 +202,7 @@ static int validate_message(struct hsmp_message *msg)int hsmp_send_message (struct hsmp_message *msg) {struct hsmp_socket *sock; +unsigned int sock_ind;int ret;if (!msg)
@@ -212,7 +213,15 @@ int hsmp_send_message(struct hsmp_message *msg)if (!hsmp_pdev.sock || msg->sock_ind >= hsmp_pdev.num_sockets)return -ENODEV ; - sock = &hsmp_pdev.sock[msg->sock_ind]; + +/* +* Sanitize sock_ind after the bounds check. A mispredicted branch can +* still let the CPU speculatively use msg->sock_ind as an index into +* hsmp_pdev.sock[] (Spectre v1, CVE-2017-5753), including for callers +* other than hsmp_ioctl_msg() that pass a user-derived socket index. +*/ + sock_ind =array_index_nospec (msg->sock_ind, hsmp_pdev.num_sockets); + sock = &hsmp_pdev.sock[sock_ind]; ret =down_interruptible (&sock->hsmp_sem);if (ret <0 )
@@ -308,6 +317,19 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)if (msg.msg_id <HSMP_TEST || msg.msg_id >=HSMP_MSG_ID_MAX )return -ENOMSG ; +/* +* Sanitize the user-controlled msg_id against speculative +* execution. The bounds check above retires the out-of-range +* case with -ENOMSG, but a mispredicted branch can still let the +* CPU speculatively use msg_id as an index into +* hsmp_msg_desc_table[] (here and in validate_message() / +* is_get_msg() called downstream via hsmp_send_message()), and +* pull arbitrary kernel memory into the cache (Spectre v1, +* CVE-2017-5753). Clamp once into msg.msg_id so every downstream +* dereference sees the sanitized value. +*/ + msg.msg_id =array_index_nospec (msg.msg_id,HSMP_MSG_ID_MAX ); +switch (fp->f_mode & (FMODE_WRITE |FMODE_READ )) {case FMODE_WRITE :/*
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 PCI/sysfs: Use kstrtobool() to parse the ROM attribute input
In reply to Sasha LevinFrom: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 92742802ecbf215a2b60dcfd326d2213595010f1 ]
pci_write_rom() controls access to the ROM content through the corresponding sysfs attribute, and treats the input as a request to disable only when it matches the string "0\n" exactly:
if ((off == 0) && (*buf == '0') && (count == 2))
The count == 2 condition encodes the trailing newline that echo(1) appends. This was found when userspace wrote "0" without a trailing newline aiming to disable access, which failed to match the condition above and enabled access instead. For example:
$ echo 0 > rom # "0\n", count 2, access disabled $ echo -n 0 > rom # "0", count 1, access enabled $ echo > rom # "", count 1, access enabled (likely not desirable)
Parse the input with kstrtobool(), which handles common boolean inputs such as "0", "1", "n", "y" or "off", "on", with or without a trailing newline, so both of the above disable access, and update the now stale comment.
As a side effect, input that does not parse as a boolean is rejected with -EINVAL rather than enabling access. The documented "0" and "1" continue to work as before, and rejecting malformed input brings the attribute in line with how sysfs attributes typically handle it.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject line
**Record:** [PCI/sysfs] [use] Use kstrtobool() to parse the ROM attribute input — sysfs input-parsing fix in the PCI ROM bin_attribute write path.
### Step 1.2: Tags
**Record:**
- **Link:** https://patch.msgid.link/20260612182448.552406-1- [email protected]
- **Signed-off-by:** Krzysztof Wilczyński, Bjorn Helgaas (PCI maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable
Notable: maintainer sign-off (Bjorn Helgaas), no fuzzer/user bug report tags.
### Step 1.3: Body analysis
**Record:**
- **Bug:** pci_write_rom() only disables ROM sysfs access when input is exactly "0\n" (count == 2). "0" without newline (count == 1) is treated as enable.
- **Symptom:** echo -n 0 > rom enables access instead of disabling; empty write also enables.
- **Root cause:** Manual parsing tied disable to count == 2 (echo’s trailing newline), not to boolean "0".
- **Fix:** Use kstrtobool(); reject invalid input with -EINVAL.
### Step 1.4: Hidden bug fix?
**Record:** Yes — described as parsing improvement, but it fixes inverted enable/disable semantics and undocumented dependence on a trailing newline.
---
## Phase 2: Diff Analysis
### Step 2.1: Inventory
**Record:**
- **File:** drivers/pci/pci-sysfs.c (~+4/-3 net)
- **Function:** pci_write_rom()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code flow
**Record:**
- **Before:** Disable only if off==0 && *buf=='0' && count==2; everything else enables.
- **After:** Parse with kstrtobool(); on failure return -EINVAL; otherwise set pdev->rom_attr_enabled = enable.
- **Path:** sysfs write to PCI rom bin_attribute (root-only, mode 0600).
### Step 2.3: Bug mechanism
**Record:** **Logic/correctness fix** — fragile string/count check instead of boolean parsing; violates documented “write 0 to disable” semantics for writes without \n.
### Step 2.4: Fix quality
**Record:** Obviously correct, minimal, matches PCI sysfs patterns (author’s 2021 kstrtobool series for other attrs). Low regression risk; kstrtobool() only inspects s[0] (and s[1] for on/off), so it is safe on sysfs buffers that may lack a trailing NUL.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** Buggy count == 2 logic dates to 1da177e4c3f41 (2005, Linux 2.6.12-rc2). Present in this tree at lines 1319–1322.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related history
**Record:** Related PCI sysfs work by same author merged earlier (36f354ec7bf92 EINVAL consistency, 95e83e219d689 CAP_SYS_ADMIN checks). A 2021 series ([spinics msg110641](https://www.spinics.net/lists/linux-pci/msg110641.html)) included this pci_write_rom() change but the ROM hunk was not merged then; this 2026 commit is standalone.
### Step 3.4: Author context
**Record:** Krzysztof Wilczyński is an active PCI sysfs contributor; Bjorn Helgaas signed off.
### Step 3.5: Dependencies
**Record:** None. kstrtobool() exists in lib/kstrtox.c; bool and rom_attr_enabled exist in this tree. Applies standalone.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original discussion
**Record:** b4 dig -c <sha> failed (commit not in this checkout). WebFetch of patch.msgid.link blocked (bot protection). Spinics 2021 series confirms intent and prior ROM fix that was not merged. No stable nomination found in available threads.
### Step 4.2: Reviewers
**Record:** Bjorn Helgaas sign-off verified from commit message; 2021 series CC’d linux-pci@.
### Step 4.3: Bug report
**Record:** No external bug report or syzbot link; author discovered via echo -n 0 testing.
### Step 4.4: Series context
**Record:** Standalone 2026 commit; not part of an unmerged multi-patch dependency chain.
### Step 4.5: Stable list
**Record:** No stable-list discussion found (WebSearch + blocked lore fetch).
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key functions
**Record:** pci_write_rom(), pci_read_rom() (read path checks rom_attr_enabled).
### Step 5.2: Callers
**Record:** pci_write_rom registered via BIN_ATTR(rom, 0600, pci_read_rom, pci_write_rom, 0); invoked from sysfs_kf_bin_write() on root write to /sys/bus/pci/devices/.../rom.
### Step 5.3: Callees
**Record:** kstrtobool(), to_pci_dev(), setspdev->rom_attr_enabled.
### Step 5.4: Reachability
**Record:** Reachable by root (CAP_SYS_ADMIN) writing sysfs; documented
workflow: write 1 to enable ROM read, 0 to disable ([PCI sysfs docs](https://www.kernel.org/doc/html/latest/PCI/sysfs-pci.html)).
### Step 5.5: Similar patterns
**Record:** kstrtobool(buf, ...) is standard in sysfs store handlers across the tree; PCI sysfs already uses it elsewhere after the 2021 series.
---
## Phase 6: Cross-Reference Against Local Tree
### Step 6.1: Buggy code present?
**Record:** **Yes.** Local tree is **6.18.44** (git describe:v6.18.44-1-g2736c32da98b9). Buggy code at drivers/pci/pci- sysfs.c:1319-1322. Fix not present (git log -S 'kstrtobool(buf, &enable)' -- drivers/pci/pci-sysfs.c returned nothing).
### Step 6.2: Backport complications
**Record:** Clean apply expected — small hunk, no structural conflicts observed.
### Step 6.3: Related fixes already present?
**Record:** No equivalent fix in this tree; EINVAL consistency work exists but not for pci_write_rom().
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem
**Record:** drivers/pci sysfs — **IMPORTANT** (core hardware enumeration; affects all PCI platforms).
### Step 7.2: Activity
**Record:** Actively maintained; recent PCI sysfs commits in file history.
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who is affected
**Record:** Root/admin or tools writing to PCI rom sysfs without a trailing newline (e.g. echo -n 0, write(fd, "0", 1)).
### Step 8.2: Trigger conditions
**Record:** Uncommon vs plain echo 0, but valid per kernel docs and normal for programmatic sysfs clients. Root-only.
### Step 8.3: Failure mode severity
**Record:** **MEDIUM** — no crash/corruption, but inverted access- control semantics: disable request enables ROM reads. Documented API behavior is wrong for "0" without \n.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** Correct boolean parsing; aligns with docs and other PCI sysfs attrs; rejects garbage with -EINVAL.
- **Risk:** Very low (~5 lines, established API).
- **Ratio:** Favorable for stable despite modest severity.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence summary
**FOR:**
- Real, reproducible logic bug (echo -n 0 inverts intent)
- Violates documented “write 0 to disable” semantics
- Present since 2005 in this tree
- Tiny, maintainer-reviewed fix
- kstrtobool() already in tree
- Consistent with prior PCI sysfs input-validation work
**AGAINST:**
- No crash, deadlock, or data corruption
- Root-only sysfs (0600)
- Common echo 0 path works
- No syzbot/user reports
- Borderline on stable “important issue” bar
**Unresolved:** Full lore thread for 20260612 patch (fetch blocked); no explicit stable nomination found.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — straightforward; maintainer SOB; no Tested-by.
2. Fixes a real bug? **PASS** — inverted enable/disable on valid input.
3. Important issue? **PASS (borderline)** — access-control semantics + documented API violation; not a crash fix.
4. Small and contained? **PASS**
5. No new features/APIs? **PASS** — behavior extension to y/n/on/off is minor and consistent with kstrtobool() elsewhere.
6. Can apply to local tree? **PASS**
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs-only).
### Step 9.4: Decision rationale
For **Linux 6.18.y**, the buggy code exists and the fix is absent. The bug causes the opposite of the documented disable operation when "0" is written without a newline — a longstanding sysfs correctness issue with very low backport risk. That meets stable criteria, albeit at modest severity.
---
## Verification
- [Phase 1] Parsed subject, tags, body from user-provided commit message
- [Phase 2] Read diff and current pci_write_rom() at drivers/pci/pci- sysfs.c:1313-1325
- [Phase 2] Read pci_read_rom() gate at lines 1347-1348
- [Phase 3] git describe HEAD → v6.18.44-1-g2736c32da98b9; Makefile → 6.18.44
- [Phase 3] git blame -L 1302,1325 drivers/pci/pci-sysfs.c → buggy logic from 1da177e4c3f41 (2005)
- [Phase 3] git show 1da177e4c3f41:... confirmed original count == 2 logic
- [Phase 3] git log -S 'kstrtobool(buf, &enable)' -- drivers/pci/pci- sysfs.c → empty (fix not in tree)
- [Phase 3] git log --author='Krzysztof Wilczyński' -- drivers/pci/pci- sysfs.c → related EINVAL/CAP_SYS_ADMIN commits
- [Phase 4] b4 dig by commit hash → failed (commit not in checkout)
- [Phase 4] WebFetch patch.msgid.link → blocked by bot protection
- [Phase 4] WebFetch spinics msg110641 → 2021 series with same ROM fix (not merged then)
- [Phase 4] WebSearch → confirmed commit subject and merge context
- [Phase 5] Traced sysfs path via fs/sysfs/file.c:150-168 (sysfs_kf_bin_write)
- [Phase 5] Read kstrtobool() at lib/kstrtox.c:348-392 — only reads first 1–2 bytes
- [Phase 5] grep kstrtobool(buf in drivers → widespread sysfs pattern
- [Phase 6] Confirmed buggy code present, fix absent in 6.18.44 checkout
- [Phase 6] grep rom_attr_enabled → only pci-sysfs.c and include/linux/pci.h
- [Phase 8] Kernel PCI sysfs docs confirm write "0" to disable ROM access
- [Phase 8] BIN_ATTR(rom, 0600, ...) at line 1366 → root read/write only
**YES****Result:** For the checked-out **6.18.44** tree, this commit should be backported.
pci_write_rom() only disables ROM sysfs access when the write is exactly "0\n" (count == 2). Writing "0" without a newline (e.g. echo -n 0) incorrectly **enables** access instead of disabling it, which contradicts the documented “write 0 to disable” behavior. The fix is small (switch to kstrtobool()), low risk, and the buggy code is still present in this tree — the fix is not merged here yet.
drivers/pci/pci-sysfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/pci-sysfs.c +6 -5
@@ -1308,18 +1308,19 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }* @off: file offset * @count: number of byte in input * -* writing anything except 0 enables it +* Writing a boolean value enables or disables the ROM display. */ static ssize_t pci_write_rom (struct file *filp,struct kobject *kobj,const struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count) {struct pci_dev *pdev =to_pci_dev (kobj_to_dev (kobj)); +bool enable; -if ((off ==0 ) && (*buf =='0' ) && (count ==2 )) - pdev->rom_attr_enabled =0 ; -else - pdev->rom_attr_enabled =1 ; +if (kstrtobool (buf, &enable)) +return -EINVAL ; + + pdev->rom_attr_enabled = enable;return count; }
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.10] PCI/sysfs: Use kstrtobool() to parse the ROM attribute input
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unlocked read-modify-write of the rom_attr_enabled bitfield in struct pci_dev exposes a data race. --
commit ede1ff2652bff89ab4ad252e8e7e79bb533b4702
Author: Krzysztof Wilczyński <[email protected]> PCI/sysfs: Use kstrtobool() to parse the ROM attribute input
This patch modifies pci_write_rom() to parse sysfs input using kstrtobool(). It ensures that the ROM attribute is properly disabled even when a trailing newline is missing from the input, and it rejects invalid inputs with -EINVAL.
Quoted 4 lines
drivers/pci/pci-sysfs.c +0
-0@@ -1336,18 +1336,19 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
[ ... ]
Quoted 5 lines
static
ssize_tpci_write_rom(struct file *filp, struct kobject *kobj,drivers/pci/pci-sysfs.c +0
-0const struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
drivers/pci/pci-sysfs.c void __weak pci_remove_resource_files(struct pci_dev *dev) { return; } · line 1323
Quoted 10 lines
drivers/pci/pci-sysfs.c +5
-4+bool enable; -if ((off ==0 ) && (*buf =='0' ) && (count ==2 )) - pdev->rom_attr_enabled =0 ; -else - pdev->rom_attr_enabled =1 ; +if (kstrtobool (buf, &enable)) +return -EINVAL ; + + pdev->rom_attr_enabled = enable;
[Severity: High]
This is a pre-existing issue, but does this unlocked assignment expose a data race?
In include/linux/pci.h, rom_attr_enabled is declared as a bitfield:
struct pci_dev {
...
unsigned int rom_attr_enabled:1;
...
};This bitfield shares a 32-bit machine word with other dynamically updated fields like is_probed and irq_managed.
Since C bitfield assignments compile to non-atomic read-modify-write operations on the underlying machine word, could a concurrent write to the rom sysfs attribute race with updates to these other bitfields?
If a privileged user writes to the rom sysfs attribute concurrently with the device being probed (where is_probed is toggled) or its IRQs being configured, could this silently corrupt the word and result in deadlocks in VF probing or IRQ resource leaks?
Quoted 3 lines
return count;
}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 ALSA: usb-audio: Add quirk for Novation Mininova
In reply to Sasha LevinFrom: Uwe Küchler <[email protected]>
[ Upstream commit b2e9d2cbbb71b00faf3e27fb741a27b9ad455edd ]
Add a device-specific quirk for the Novation Mininova synthesizer (USB ID 1235:001e) to enable proper recognition and functionality as a MIDI device.
---
LLM Generated explanations, may be completely bogus:
# Stable Backport Analysis: ALSA: usb-audio: Add quirk for Novation Mininova
**Local tree:** v6.18.44 (Linux 6.18.44)
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Parse the Subject Line
**Record:** [ALSA: usb-audio] [add] [quirk for Novation Mininova synthesizer USB ID 1235:001e]
### Step 1.2: Parse All Commit Message Tags
**Record:**
- **Signed-off-by:** Uwe Küchler <[email protected]> (author)
- **Link:** https://patch.msgid.link/[email protected]
- **Signed-off-by:** Takashi Iwai <[email protected]> (ALSA maintainer, applied the patch)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, or Cc:
stable tags
- Notable: maintainer SOB indicates the patch was accepted and applied
### Step 1.3: Analyze the Commit Body Text
**Record:**
- **Bug description:** The Novation Mininova (USB 1235:001e) is not properly recognized or functional as a MIDI device without a device- specific quirk.
- **Symptom/failure mode:** MIDI functionality does not work when the device is plugged in; the generic USB audio driver path cannot handle this device's non-standard interface correctly.
- **Version information:** None stated.
- **Root cause (author):** Device needs QUIRK_MIDI_RAW_BYTES handling on interface 0, same family as other Novation devices (Nocturn, Launchpad).
### Step 1.4: Detect Hidden Bug Fixes
**Record:** Not a hidden bug fix disguised as cleanup. This is an explicit hardware quirk / device-enablement entry. It fixes a real functional defect (MIDI non-operation) for a specific USB device, falling under the hardware-quirk exception category for stable.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory the Changes
**Record:**
- **Files changed:** sound/usb/quirks-table.h (+8 lines)
- **Functions modified:** None (data table entry only)
- **Scope classification:** Single-file, surgical quirk table addition
### Step 2.2: Understand the Code Flow Change
**Record:**
- **Hunk (before):** After the Novation Twitch (0x1235:0x0018) entry, the table jumps directly to ReMOTE25 (0x1235:0x4661). Mininova (0x1235:0x001e) has no entry.
- **Hunk (after):** New entry inserted:
```c
{
USB_DEVICE(0x1235, 0x001e),
QUIRK_DRIVER_INFO {
QUIRK_DATA_RAW_BYTES(0)
}
},
```- **Execution path affected:** USB device probe → usb_audio_ids[] match → usb_audio_probe() → snd_usb_create_quirk() → create_any_midi_quirk() → snd_usb_midi_v2_create() with QUIRK_MIDI_RAW_BYTES ops on interface 0.
- **Path type:** Device initialization / probe path (plug-in time).
### Step 2.3: Identify the Bug Mechanism
**Record:**
- **Bug category:** Hardware workaround / device-specific quirk
- **Mechanism:** Without the quirk entry, the Mininova either fails to match the quirks table with the correct MIDI handler, or falls through to generic audio-class parsing that cannot handle its raw-bytes MIDI interface. QUIRK_DATA_RAW_BYTES(0) expands to .ifnum = 0, .type = QUIRK_MIDI_RAW_BYTES, which selects snd_usbmidi_raw_ops and snd_usbmidi_detect_per_port_endpoints() — the same pattern used for Novation Nocturn (0x000a) and Launchpad (0x000e).
### Step 2.4: Assess the Fix Quality
**Record:**
- **Fix quality:** Obviously correct; follows the exact established pattern of sibling Novation entries in the same file region.
- **Minimal/surgical:** Yes, 8 lines, one table entry.
- **Regression risk:** Very low — adds a new device ID match only; does not alter existing entries or code paths.
- **Red flags:** None.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame the Changed Lines
**Record:** Insertion point is between Twitch (line 2133) and ReMOTE25 (line 2135) in quirks-table.h. Adjacent Novation Nocturn/Launchpad QUIRK_DATA_RAW_BYTES(0) entries have been present in this tree's quirks table. The Mininova device ID is absent — the "bug" is simply the missing quirk entry for hardware that has existed since ~2012.
### Step 3.2: Follow the Fixes: Tag
**Record:** No Fixes: tag present. N/A.
### Step 3.3: Check File History for Related Changes **Record:** This stable tree has limited per-file history (squashed import). The Novation quirk section with Nocturn (0x000a), Launchpad (0x000e), and Twitch (0x0018) is present. The Mininova entry is missing. Standalone patch — not part of a series (v1→v3 were revisions of the same single patch per lore thread).
### Step 3.4: Check the Author's Other Commits
**Record:** No commits by Uwe Küchler found in this tree. Author appears to be an end-user/contributor, not a subsystem maintainer. Patch was reviewed and applied by Takashi Iwai (ALSA/usb-audio maintainer).
### Step 3.5: Check for Dependent/Prerequisite Commits **Record:** No dependencies. QUIRK_DATA_RAW_BYTES macro (line 68–69), QUIRK_MIDI_RAW_BYTES enum, create_any_midi_quirk(), and snd_usbmidi_raw_ops all exist in this 6.18.44 tree. Applies standalone.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Find the Original Patch Discussion **Record:**
- **Lore URL:** https://lore.kernel.org/linux- sound/[email protected]
- **Series revisions:** v1 (20260526133517), v2 (20260526155606), v3/final (20260526162033) — v3 incorporated maintainer feedback
- **Key reviewer feedback:** Takashi Iwai suggested using QUIRK_DATA_RAW_BYTES(0) instead of explicit fields, and omitting vendor/product names (author complied in final version)
- **Maintainer response:** "Applied to for-next branch now. Thanks."
- **Stable nominations:** None in thread
- **NAKs/concerns:** None
### Step 4.2: Check Who Reviewed the Patch
**Record:** CC'd: [email protected] (Jaroslav Kysela, ALSA co- maintainer), [email protected] (Takashi Iwai). Takashi Iwai reviewed and applied. Appropriate maintainers involved.
### Step 4.3: Search for the Bug Report
**Record:** No external bug report, syzbot, or user crash report. Bug is
functional: device MIDI doesn't work without the quirk. Severity from reporter's perspective: hardware unusable for MIDI on Linux.
### Step 4.4: Check for Related Patches and Series **Record:** Standalone single-patch submission. No series dependencies.
### Step 4.5: Check Stable Mailing List History
**Record:** No prior stable-list discussion found for Novation Mininova.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Identify Key Functions in the Diff **Record:** No functions modified. Affected infrastructure:
- usb_audio_probe() in card.c
- snd_usb_create_quirk() in quirks.c
- create_any_midi_quirk() → snd_usb_midi_v2_create()
- QUIRK_MIDI_RAW_BYTES case in midi.c
### Step 5.2: Trace Callers
**Record:**
- usb_audio_probe() — USB core hotplug probe path, called on device plug-in
- snd_usb_create_quirk() — called from usb_audio_probe() at line 1023
- create_any_midi_quirk() — quirk dispatch table entry for QUIRK_MIDI_RAW_BYTES
- **Impact surface:** Any user plugging in a Novation Mininova; common desktop/music-production scenario
### Step 5.3: Trace Callees
**Record:** create_any_midi_quirk() → snd_usb_midi_v2_create() → sets snd_usbmidi_raw_ops, detects per-port endpoints. No allocations or locks beyond normal MIDI device setup.
### Step 5.4: Follow the Call Chain
**Record:** USB hotplug → usb_audio_probe() → quirk table match on USB_DEVICE(0x1235, 0x001e) → MIDI quirk creation. Reachable by any user plugging in the device (no special privileges needed for device recognition).
### Step 5.5: Search for Similar Patterns
**Record:** Identical QUIRK_DATA_RAW_BYTES(0) pattern at lines 2026–2039 for Novation Nocturn (0x000a) and Launchpad (0x000e). Mininova is the same vendor (0x1235), same quirk type, same interface number.
---
## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE
### Step 6.1: Does the Buggy Code Exist in This Tree? **Record:** **Yes.** The quirks table in 6.18.44 has the Novation section with Nocturn, Launchpad, Twitch, and ReMOTE25, but **no entry for 0x1235:0x001e (Mininova)**. All supporting quirk infrastructure is present. The device has never been supported in this tree.
### Step 6.2: Check for Backport Complications **Record:** **Clean apply expected.** Insertion point between Twitch (0x0018) and ReMOTE25 (0x4661) matches the upstream diff context exactly. No conflicting changes in this region.
### Step 6.3: Check if Related Fixes Are Already Here **Record:** No existing Mininova quirk or alternate fix found (grep for "Mininova", "0x001e", "mininova" returned no matches in sound/usb/).
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Identify the Subsystem and Criticality **Record:** **Subsystem:** sound/usb (ALSA USB audio driver). **Criticality:** IMPORTANT — widely used driver for USB audio/MIDI devices, but fix affects only Novation Mininova owners.
### Step 7.2: Assess Subsystem Activity
**Record:** Actively maintained; quirks table is routinely updated with new device entries. USB audio quirk additions are a well-established stable backport pattern.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Determine Who Is Affected
**Record:** **Driver-specific** — users of the Novation Mininova USB synthesizer. Requires CONFIG_SND_USB_AUDIO (common on desktop distributions).
### Step 8.2: Determine the Trigger Conditions
**Record:** Plugging in a Novation Mininova (USB 1235:001e). Trigger is deterministic on device connect. Any user with physical access to the USB port can trigger it. Very common for musicians using this hardware.
### Step 8.3: Determine the Failure Mode Severity **Record:**
- **Without fix:** Device not properly recognized/functional as MIDI — hardware feature broken, no MIDI I/O
- **Severity:** MEDIUM — functional hardware failure, not a kernel crash, data corruption, or security issue
- **With fix:** MIDI works via raw-bytes quirk handler
### Step 8.4: Calculate Risk-Benefit Ratio
**Record:**
- **Benefit:** Enables MIDI functionality for Novation Mininova users on stable kernels; follows established quirk pattern
- **Risk:** Very low — 8-line table entry, no code logic changes, no API changes, cannot affect other devices
- **Ratio:** Favorable — minimal risk, real user benefit for affected hardware
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Compile the Evidence
**FOR backporting:**
- Hardware quirk exception category (explicitly allowed for stable)
- Identical pattern to existing Novation Nocturn/Launchpad entries already in 6.18.44
- Fixes real user-facing defect (MIDI non-functionality)
- Small (8 lines), surgical, obviously correct
- Reviewed and applied by ALSA maintainer Takashi Iwai
- All prerequisite infrastructure exists in this tree
- Clean apply expected
- Zero regression risk to other devices
**AGAINST backporting:**
- Not a crash, security, corruption, or deadlock fix
- Severity is functional hardware enablement (MEDIUM), not CRITICAL
- No syzbot/fuzzer report or widespread user reports
- Device has never worked in this tree — this is enablement, not fixing a regression introduced in stable
**UNRESOLVED:**
- None that affect the decision
### Step 9.2: Apply the Stable Rules Checklist
1. Obviously correct and tested? **PASS** — matches existing sibling entries; maintainer reviewed and applied
2. Fixes a real bug affecting users? **PASS** — MIDI doesn't work without the quirk
3. Important issue? **PASS (borderline)** — functional hardware failure for affected device; quirk exception category applies
4. Small and contained? **PASS** — 8 lines, one file
5. No new features or APIs? **PASS** — table entry only, no new APIs
6. Can apply to local tree? **PASS** — all prerequisites present, clean apply
### Step 9.3: Check for Exception Categories
**Record:** **Hardware quirk/workaround** — adds a USB device quirk entry to the existing snd-usb-audio driver, enabling MIDI on non- standard-interface hardware. Same exception category as Nocturn and Launchpad quirks already in the tree.
### Step 9.4: Decision Rationale
This commit adds a standard ALSA USB-audio quirk for the Novation Mininova, using the same QUIRK_DATA_RAW_BYTES(0) pattern as other Novation devices already supported in 6.18.44. While not a crash or security fix, hardware quirks for USB audio/MIDI devices are a well- established stable backport category with very low risk and clear user benefit. The patch is maintainer-reviewed, self-contained, and applies cleanly to this tree where the supporting infrastructure already exists but the device entry is missing.
---
## Verification
- [Phase 1] Parsed subject, tags; found Link and maintainer SOB; no Fixes/Reported-by
- [Phase 1] Commit body describes MIDI recognition/functionality failure for USB 1235:001e
- [Phase 2] Diff: +8 lines in sound/usb/quirks-table.h, one quirk table entry
- [Phase 2] QUIRK_DATA_RAW_BYTES(0) expands to .ifnum = 0, .type = QUIRK_MIDI_RAW_BYTES (verified lines 68–69)
- [Phase 2] QUIRK_MIDI_RAW_BYTES handled in quirks.c:528 and midi.c:2565-2578
- [Phase 3] git describe HEAD: v6.18.44; make kernelversion: 6.18.44
- [Phase 3] grep Mininova/0x001e in sound/usb/: no matches — entry absent from tree
- [Phase 3] Adjacent Novation entries (Nocturn 0x000a, Launchpad 0x000e) present at lines 2026–2039
- [Phase 4] Lore thread fetched via curl from lore.kernel.org/linux- sound/[email protected]/t.mbox.gz
- [Phase 4] Takashi Iwai review feedback and "Applied to for-next branch now. Thanks." confirmed
- [Phase 4] Three patch revisions (v1/v2/v3); final version matches committed diff
- [Phase 4] No stable@ nomination in thread; no NAKs
- [Phase 5] usb_audio_probe() at card.c:917; quirk dispatch at quirks.c:509-528
- [Phase 5] create_any_midi_quirk() calls snd_usb_midi_v2_create() at quirks.c:79-84
- [Phase 6] Buggy state confirmed: Mininova ID missing from quirks table in 6.18.44
- [Phase 6] Insertion context matches upstream diff (between 0x0018 and 0x4661 entries)
- [Phase 8] Failure mode: MIDI non-functional (MEDIUM severity); no crash/corruption
**YES**
sound/usb/quirks-table.h | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/quirks-table.h +8 -0
@@ -2131,6 +2131,14 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ +USB_DEVICE (0x1235 ,0x001e ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Novation", */ +/* .product_name = "Mininova", */ + QUIRK_DATA_RAW_BYTES(0) + } +}, {USB_DEVICE_VENDOR_SPEC (0x1235 ,0x4661 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 s390/cio: Purge based on the cdev's online status
In reply to Sasha LevinFrom: Vineeth Vijayan <[email protected]>
[ Upstream commit 58d50cad63e85daae032924ecc3d457fb1ec02fb ]
Ensure that all devices currently offline are purged correctly.
Previously, purging logic relied on the internal FSM state to determine whether a device was offline. However, devices with a target state of offline could be skipped if CIO internal processing was still ongoing during the purge operation.
Update the purge decision logic to rely on the online variable in the cdev structure instead of the internal FSM state, providing a more reliable indication of actual device availability.
---
LLM Generated explanations, may be completely bogus:
## Phase 1: Commit Message Forensics
### Step 1.1: Subject Line
**Record:** [s390/cio] [Purge] — Change purge eligibility to use the cdev's online flag instead of internal FSM state.
### Step 1.2: Commit Message Tags
**Record:**
- **Fixes:** — none
- **Reported-by:** — none
- **Tested-by:** — none
- **Reviewed-by:** Peter Oberparleiter <[email protected]> (s390/cio maintainer)
- **Acked-by:** — none
- **Link:** — none
- **Cc: stable:** — none (expected for this review pipeline)
- **Signed-off-by:** Vineeth Vijayan, Alexander Gordeev (ignore pipeline-added SOBs)
Notable: maintainer review, no fuzzer/user bug report.
### Step 1.3: Commit Body Analysis
**Record:**
- **Bug:** purge_fn() used cdev->private->state == DEV_STATE_OFFLINE to decide purge eligibility. Devices targeted for offline can still be in transitional FSM states during CIO processing, so purge skips them.
- **Symptom:** echo purge > /proc/cio_ignore does not remove all blacklisted, offline devices.
- **Root cause:** FSM state lags behind the user-visible offline state; cdev->online is cleared earlier and is the authoritative "in use" indicator.
- **Version info:** none in message.
### Step 1.4: Hidden Bug Fix Detection
**Record:** Yes — described as a purge correctness fix, not cosmetic cleanup. It fixes incorrect device-unregistration behavior in an admin path.
---
## Phase 2: Diff Analysis
### Step 2.1: Change Inventory
**Record:**
- **Files:** drivers/s390/cio/device.c (+1/−1 effective logic line)
- **Function:** purge_fn()
- **Scope:** Single-file, surgical fix
### Step 2.2: Code Flow Change
**Record:**
- **Before:** If cdev exists and state != DEV_STATE_OFFLINE, skip purge (goto unlock).
- **After:** If cdev exists and cdev->online, skip purge.
- **Path affected:** /proc/cio_ignore purge via ccw_purge_blacklisted() → purge_fn().
### Step 2.3: Bug Mechanism
**Record:** **Logic/correctness fix.** Purge used internal FSM state instead of the user-visible online flag.
In ccw_device_set_offline(), cdev->online = 0 is set at line 289 before FSM reaches DEV_STATE_OFFLINE. During that window, old logic incorrectly skips purge. The same applies to other non-OFFLINE FSM states (e.g. DEV_STATE_BOXED, DEV_STATE_NOT_OPER) where online == 0 but state ≠ DEV_STATE_OFFLINE.
### Step 2.4: Fix Quality
**Record:** Obviously correct and minimal. Aligns with kernel docs and sch_get_action() (line 1443), which also keys off cdev->online. Protected by existing onoff atomic during online/offline sysfs ops. Very low regression risk.
---
## Phase 3: Git History Investigation
### Step 3.1: Blame
**Record:** purge_fn() and the DEV_STATE_OFFLINE check are present in this tree (blame shows flattened history under 19eef1d98eeda). The purge refactor using for_each_subchannel_staged(purge_fn, ...) is present.
### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag.
### Step 3.3: Related File History
**Record:** Related stable backport exists for the Oct 2025 purge refactor ("Update purge function to unregister the unused subchannels", spinics stable list). That refactor introduced the DEV_STATE_OFFLINE check this commit corrects. This appears to be a standalone follow-up fix, not part of a multi-patch series.
### Step 3.4: Author Context
**Record:** Vineeth Vijayan has prior s390/cio purge work (e.g. subchannel unregister during purge, 2021). Peter Oberparleiter originally introduced purge in 2008 and reviewed this patch.
### Step 3.5: Dependencies
**Record:** Requires the refactored purge_fn() using for_each_subchannel_staged() — present in this 6.18.43 tree. Requires cdev->online in struct ccw_device — present in arch/s390/include/asm/ccwdev.h. Standalone, no other commits needed.
---
## Phase 4: Mailing List and External Research
### Step 4.1: Original Patch Discussion
**Record:** b4 dig -c <commit> could not be run — commit hash not in this checkout. Lore/spinics search for exact subject returned no match. Related Oct 2025 purge refactor discussion found on spinics stable list.
### Step 4.2: Reviewers
**Record:** Reviewed-by Peter Oberparleiter (subsystem maintainer). Full recipient list unverified (no commit hash for b4 dig -w).
### Step 4.3: Bug Report
**Record:** N/A — no Reported-by or Link tags.
### Step 4.4: Related Patches
**Record:** Follow-up to the Oct 2025 purge refactor that was backported to stable 6.17. Same functional area, same author/maintainer.
### Step 4.5: Stable List History
**Record:** Prior purge fix in this area was nominated/backported to stable (6.17 series). No stable-list discussion found for this specific commit.
---
## Phase 5: Code Semantic Analysis
### Step 5.1: Key Functions
**Record:** purge_fn(), ccw_purge_blacklisted(), blacklist_parse_proc_parameters() (purge trigger).
### Step 5.2: Callers
**Record:**
- ccw_purge_blacklisted() ← blacklist_parse_proc_parameters() on "purge" via /proc/cio_ignore
- Triggered by root/admin: echo purge > /proc/cio_ignore
### Step 5.3: Callees
**Record:** sch_get_cdev(), atomic_cmpxchg(&onoff), ccw_device_sched_todo(CDEV_TODO_UNREG), css_sched_sch_todo(SCH_TODO_UNREG).
### Step 5.4: Reachability
**Record:** Reachable from procfs by privileged users during device management. Documented admin workflow on IBM Z/s390.
### Step 5.5: Similar Patterns
**Record:** sch_get_action() at line 1443 uses if (cdev->online) for the same semantic distinction. ccw_device_notify() checks !cdev->online before notifying drivers.
---
## Phase 6: Cross-Reference Against Local Tree (6.18.43)
### Step 6.1: Buggy Code Present?
**Record:** **Yes.** At line 1332:
```1331:1333:drivers/s390/cio/device.c
if (cdev) {
if (cdev->private->state != DEV_STATE_OFFLINE)
goto unlock;
```purge_fn() with for_each_subchannel_staged() is present. Bug is reachable in this tree.
### Step 6.2: Backport Complications
**Record:** **Clean apply.** Verified with git apply --check — hunk applies with 1-line offset only.
### Step 6.3: Related Fixes Already Present?
**Record:** Oct 2025 purge refactor is present; this specific online- status fix is **not** yet applied.
---
## Phase 7: Subsystem Context
### Step 7.1: Subsystem and Criticality
**Record:** drivers/s390/cio/ — s390 Channel I/O layer. **IMPORTANT** for s390/IBM Z platforms; **PERIPHERAL** globally.
### Step 7.2: Subsystem Activity
**Record:** Active — recent stable backports in this tree include 6715560527e34 (lifecycle fix) and 600ad63124dea (CHSC GFP_DMA).
---
## Phase 8: Impact and Risk Assessment
### Step 8.1: Who Is Affected
**Record:** s390/IBM Z administrators using cio_ignore purge to remove blacklisted offline devices. Config/platform-specific, not universal.
### Step 8.2: Trigger Conditions
**Record:** Running echo purge > /proc/cio_ignore while blacklisted devices are offline (online == 0) but FSM state is not yet DEV_STATE_OFFLINE (during offline transition, or in states like BOXED/NOT_OPER). Requires root. Moderately common in dynamic device management workflows.
### Step 8.3: Failure Mode Severity
**Record:** **MEDIUM** — documented admin operation silently fails to deregister some devices. No crash, corruption, deadlock, or security issue. Leaves stale device/subchannel registrations; workaround is to re-run purge after FSM settles.
### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** Restores documented purge semantics ("not online" devices removed); aligns with maintainer intent and prior stable precedent for purge fixes.
- **Risk:** Very low — one-line logic change, maintainer-reviewed, protected by onoff atomic.
- **Ratio:** Moderate benefit for s390 admins, very low risk.
---
## Phase 9: Final Synthesis
### Step 9.1: Evidence Summary
**FOR backport:**
- Real functional bug in documented admin interface
- Maintainer-reviewed (Peter Oberparleiter)
- Minimal, obviously correct, applies cleanly to 6.18.43
- Buggy code confirmed present in this tree
- Aligns with cdev->online semantics used elsewhere in same file
- Prior purge fix in same area was backported to stable
**AGAINST backport:**
- No crash, security, corruption, or deadlock
- No user/fuzzer reports
- s390-specific, narrow audience
- Workaround exists (retry purge after offline completes)
- Does not meet strictest interpretation of "important issue"
**Unresolved:** Original lore thread and mainline commit hash not found; no explicit stable nomination found.
### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — logic verified against ccw_device_set_offline() and sch_get_action(); maintainer reviewed; no runtime test tag.
2. Fixes a real bug affecting users? **PASS** — breaks documented cio_ignore purge behavior on s390.
3. Important issue? **BORDERLINE PASS** — functional/admin correctness, not crash-level; prior purge fixes in this area were deemed stable- worthy.
4. Small and contained? **PASS** — 1-line logic change.
5. No new features or APIs? **PASS**.
6. Can apply to local tree? **PASS** — verified clean apply.
### Step 9.3: Exception Categories
**Record:** None (not device ID, quirk, DT, build, or docs fix).
### Step 9.4: Decision Rationale
This is a small, maintainer-reviewed correctness fix for a long-standing s390 admin feature (cio_ignore purge). The bug is present in 6.18.43, the fix applies cleanly, and it restores behavior explicitly documented since 2008: remove blacklisted devices that are "not online." While not crash-level, the s390 maintainers have previously backported purge fixes to stable, and this is a direct follow-up correcting the same feature. The low risk and clear correctness outweigh the moderate (non-critical) severity.
---
## Verification
- **[Phase 1]** Parsed subject, tags, body; no Reported-by/syzbot; Reviewed-by Peter Oberparleiter confirmed.
- **[Phase 2]** Diff: 1-line change in purge_fn() from FSM state check to cdev->online check.
- **[Phase 3]** git describe HEAD: v6.18.43; buggy code at line 1332 confirmed; for_each_subchannel_staged(purge_fn) present.
- **[Phase 3]** git blame -L 1319,1350: purge_fn with DEV_STATE_OFFLINE check present.
- **[Phase 4]** b4 dig -c: failed — no commit hash in tree. Spinics
search: related Oct 2025 purge backport found; exact patch thread not found.
- **[Phase 4]** Spinics stable msg884366: prior purge refactor backport documented.
- **[Phase 5]** grep ccw_purge_blacklisted: called from blacklist.c on "purge" proc command.
- **[Phase 5]** Read ccw_device_set_offline(): cdev->online = 0 at line 289 before FSM final state.
- **[Phase 5]** Read sch_get_action(): uses cdev->online at line 1443 for same semantic.
- **[Phase 6]** git describe HEAD: 6.18.43 tree; buggy code present.
- **[Phase 6]** git apply --check: patch applies cleanly.
- **[Phase 6]** struct ccw_device.online confirmed in arch/s390/include/asm/ccwdev.h line 96.
- **[Phase 8]** Failure mode: silent purge failure, severity MEDIUM (not CRITICAL).
- **UNVERIFIED:** Mainline commit hash; full lore review thread; explicit stable nomination for this specific commit.
**YES**
drivers/s390/cio/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/device.c +1 -1
@@ -1329,7 +1329,7 @@ static int purge_fn(struct subchannel *sch, void *data) cdev =sch_get_cdev (sch);if (cdev) { -if (cdev->private->state !=DEV_STATE_OFFLINE ) +if (cdev->online) goto unlock;if (atomic_cmpxchg (&cdev->private->onoff,0 ,1 ) !=0 )
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH AUTOSEL 6.18-5.15] s390/cio: Purge based on the cdev's online status
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Purging devices in intermediate FSM recognition states leads to a use-after-free when un-canceled…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Purging devices in intermediate FSM recognition states leads to a use-after-free when un-canceled FSM timers expire.
- [High] The cdev->online check in purge_fn() introduces a race condition with active device offlining, leading to a NULL pointer dereference. --
commit 78ddd0e46a2cf7d853e46c6adaa8bbe4677d971f
Author: Vineeth Vijayan <[email protected]>
s390/cio: Purge based on the cdev's online status
This commit updates the purging logic to rely on the online variable in the cdev structure rather than the internal FSM state, ensuring offline devices are purged correctly.
drivers/s390/cio/device.c static int purge_fn(struct subchannel *sch, void *data) · line 1332
Quoted 10 lines
drivers/s390/cio/device.c +1
-1@@ -1329,7 +1329,7 @@ static int purge_fn(struct subchannel *sch, void *data) cdev =sch_get_cdev (sch);if (cdev) { -if (cdev->private->state !=DEV_STATE_OFFLINE ) +if (cdev->online)
[Severity: High]
Can this change introduce a use-after-free for devices in intermediate recognition states?
If a device is in an intermediate state like DEV_STATE_SENSE_ID (where cdev->online == 0), is blacklisted, and a purge is triggered via /proc/cio_ignore, this new check allows the purge to proceed. Since sysfs is not holding the onoff atomic, purge schedules CDEV_TODO_UNREG.
This leads to the device memory being freed because it hasn't been added yet, bypassing device_del():
drivers/s390/cio/device.c:ccw_device_release() {
...
kfree(cdev->private);
kfree(cdev);
}However, the pending FSM timer is never canceled before freeing. When it later expires, can it dereference the freed memory?
drivers/s390/cio/device_fsm.c:ccw_device_timeout() {
struct ccw_device_private *priv = timer_container_of(priv, t, timer);
struct ccw_device *cdev = priv->cdev;
spin_lock_irq(cdev->ccwlock);
...
}[Severity: High]
Could this also introduce a race condition with active device offlining, leading to a NULL pointer dereference?
When a driver initiates ccw_device_set_offline(), it clears cdev->online early, drops locks, and waits for the FSM to transition to an offline state.
If a purge is concurrently triggered during this window, purge_fn() now sees cdev->online == 0, grabs the onoff atomic, and schedules unregistration. The workqueue then unlinks the device:
drivers/s390/cio/device.c:ccw_device_todo() {
...
sch_set_cdev(sch, NULL);
}When the offlining thread wakes up and calls io_subchannel_quiesce(), it fetches the now-NULL cdev and attempts to dereference its handler:
drivers/s390/cio/device.c:io_subchannel_quiesce() {
cdev = sch_get_cdev(sch);
...
if (cdev->handler)
cdev->handler(cdev, cdev->private->intparm, ERR_PTR(-EIO));
}Can this result in a kernel panic if the purge occurs during the offlining race window?
Quoted 4 lines
drivers/s390/cio/device.c +0
-0goto unlock;if (atomic_cmpxchg (&cdev->private->onoff,0 ,1 ) !=0 )goto unlock;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Sasha Levin
maintainerPATCH 1/1 RDMA/mlx5: Use QP port when decoding responder CQEs
In reply to Sasha LevinFrom: Chenguang Zhao <[email protected]>
[ Upstream commit 194762e6e436acde0f8f6aef44200b0058c36791 ]
The responder CQE path determines the link layer via rdma_port_get_link_layer(). Use qp->port instead of hardcoding port 1, which can mis-decode completions on multi-port devices.
---
LLM Generated explanations, may be completely bogus:
Connection lost, reconnecting to https://agentn.us.api5.cursor.sh
(attempt 1)...
Retry attempt 1...
# Stable Backport Analysis: RDMA/mlx5: Use QP port when decoding responder CQEs
**Local tree:** v6.18.43 (VERSION = 6, PATCHLEVEL = 18, SUBLEVEL = 43, git describe HEAD = v6.18.43-1-gc7f0dac02d232)
**Fix commit (mainline):** 194762e6e436a — not present in this checkout (git merge-base --is-ancestor returns false).
---
## PHASE 1: COMMIT MESSAGE FORENSICS
### Step 1.1: Subject line
**Record:** [RDMA/mlx5] [use] — use the QP's actual port instead of hardcoded port 1 when determining link layer for responder CQE decoding.
### Step 1.2: Tags
**Record:**
- Signed-off-by: Chenguang Zhao <[email protected]> (author)
- `Link: https://patch.msgid.link/20260410074046.2044595-1-
[email protected]`
- Signed-off-by: Leon Romanovsky <[email protected]> (RDMA maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, `Cc:
[email protected]`
- Notable: maintainer applied; no fuzzer or user bug report tags
### Step 1.3: Body analysis
**Record:**
- **Bug:** handle_responder() calls rdma_port_get_link_layer(qp->ibqp.device, 1) — always port 1.
- **Symptom:** Responder CQEs on multi-port mlx5 devices can be mis- decoded when the QP is bound to a port other than 1, or when ports differ in link layer.
- **Root cause:** Link-layer branch selection uses the wrong port number.
- **Versions:** Bug present from at least v4.8 through v6.18 in this repo (verified via tags).
### Step 1.4: Hidden bug fix?
**Record:** No — this is an explicit correctness fix, not disguised cleanup.
---
## PHASE 2: DIFF ANALYSIS
### Step 2.1: Inventory
**Record:**
- **Files:** drivers/infiniband/hw/mlx5/cq.c (+2 / -1)
- **Function:** handle_responder()
- **Scope:** Single-file, surgical one-line logic fix
### Step 2.2: Code flow change
**Record:**
- **Before:** ll = rdma_port_get_link_layer(qp->ibqp.device, 1)
- **After:** ll = rdma_port_get_link_layer(qp->ibqp.device, qp->port)
- **Path:** Responder CQE handling during CQ poll — normal hot path for incoming RDMA receives.
### Step 2.3: Bug mechanism
**Record:** **Logic / correctness fix.** ll controls which branch decodes completion metadata:
```242:270:drivers/infiniband/hw/mlx5/cq.c
if (ll != IB_LINK_LAYER_ETHERNET) {
wc->slid = be16_to_cpu(cqe->slid);
wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf;
return;
}
wc->slid = 0;
vlan_present = cqe->l4_l3_hdr_type & 0x1;
roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3;
// ... RoCE VLAN, network_hdr_type decoding ...
```Using port 1's link layer when the QP is on another port selects the wrong branch, populating ib_wc fields incorrectly (e.g., IB slid/sl vs RoCE vlan_id/network_hdr_type).
### Step 2.4: Fix quality
**Record:**
- Obviously correct — qp->port is already used in the same function for pkey lookup (line 236).
- mlx4 consistently uses qp->port for the same purpose (drivers/infiniband/hw/mlx4/qp.c:3050).
- Minimal change, no API changes, negligible regression risk.
---
## PHASE 3: GIT HISTORY INVESTIGATION
### Step 3.1: Blame
**Record:** In this checkout, blame points to import commit a112b91dd6349 (tree packaging artifact). Tag inspection shows the hardcoded 1 is present at v4.8, v4.9, v4.14, v4.19, v5.4, v5.10, v5.15, v6.1, v6.6, v6.12, v6.18 — a long-standing bug.
### Step 3.2: Fixes: tag
**Record:** N/A — no Fixes: tag in commit message.
### Step 3.3: Related file history
**Record:** Fix commit 194762e6e436a is on net-next and all-next. Current HEAD (6.18.43) does not contain it. cq.c has had other post-v6.18 changes on net-next (UMEM refactors) but this fix is independent.
### Step 3.4: Author context
**Record:** Chenguang Zhao (Kylinos). Leon Romanovsky (mlx5/RDMA maintainer) committed the fix. No other related commits from this author found in this tree.
### Step 3.5: Dependencies
**Record:** None. Standalone, self-contained one-hunk change. qp->port and struct mlx5_ib_qp exist in this tree.
---
## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH
### Step 4.1: Original discussion
**Record:**
- b4 dig -c 194762e6e436a → https://patch.msgid.link/20260410074046.20
[email protected]
- Single v1 revision; no v2/v3
- Leon Romanovsky: "Applied, thanks!" — no objections, no stable nomination
### Step 4.2: Reviewers
**Record:** b4 dig -w: CC'd to Leon Romanovsky, Jason Gunthorpe, [email protected]. Maintainer applied directly.
### Step 4.3: Bug reports
**Record:** No external bug report, syzbot, or Bugzilla link. Kylinos authorship suggests internal/production discovery on multi-port hardware.
### Step 4.4: Series context
**Record:** Standalone 1/1 patch, no series dependencies.
### Step 4.5: Stable list history
**Record:** No stable-list discussion found in thread mbox. No `Cc:
stable` in thread.
---
## PHASE 5: CODE SEMANTIC ANALYSIS
### Step 5.1: Key functions
**Record:** handle_responder(), called from CQE poll path.
### Step 5.2: Callers
**Record:**
- handle_responder() ← CQE opcode switch in poll path (line 518)
- mlx5_ib_poll_cq() (line 610) ← .poll_cq in main.c:4352
- Reachable from userspace via ibv_poll_cq() on mlx5 devices.
### Step 5.3: Callees
**Record:** rdma_port_get_link_layer(), ib_find_cached_pkey(), CQE field decoding.
### Step 5.4: Reachability
**Record:** **Userspace-reachable** on every responder completion poll. Trigger requires mlx5 HCA with num_ports > 1, QP on port ≠ 1, and (for functional impact) different link-layer types between port 1 and qp->port. Dual-port same-type configs (common IB or RoCE) are unaffected.
### Step 5.5: Similar patterns
**Record:** mlx4 uses qp->port in four places for rdma_port_get_link_layer(). mlx5 handle_responder() is the outlier; same function already uses qp->port at line 236.
---
## PHASE 6: CROSS-REFERENCE AGAINST LOCAL TREE
### Step 6.1: Buggy code present?
**Record:** **YES.** Current tree atdrivers/infiniband/hw/mlx5/cq.c:172:
```c enum rdma_link_layer ll = rdma_port_get_link_layer(qp->ibqp.device, 1); ```
### Step 6.2: Backport complications
**Record:** **Clean apply expected** — identical context in 6.18.43. No conflicts anticipated.
### Step 6.3: Related fixes already present? **Record:** None. git log --grep="QP port when decoding" returns nothing on current HEAD.
---
## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT
### Step 7.1: Subsystem criticality
**Record:** drivers/infiniband/hw/mlx5 — **IMPORTANT** (ConnectX RDMA, widely deployed in HPC/cloud/enterprise).
### Step 7.2: Subsystem activity
**Record:** Actively maintained; mlx5 is a primary production RDMA driver.
---
## PHASE 8: IMPACT AND RISK ASSESSMENT
### Step 8.1: Who is affected
**Record:** Users of multi-port mlx5 HCAs running QPs on port 2+ where port 1 and qp->port have different link layers. Subset of RDMA users, but includes serious production deployments (HPC clusters, cloud RDMA).
### Step 8.2: Trigger conditions
**Record:** Responder CQE poll on a QP not on port 1, with mismatched link-layer types between ports. Not every boot; requires specific multi- port configuration. Unprivileged users can trigger via normal RDMA CQ polling.
### Step 8.3: Failure mode severity
**Record:** Incorrect ib_wc metadata delivered to userspace (wrong slid/sl vs vlan_id/network_hdr_type). **Severity: MEDIUM** — no kernel oops/UAF, but wrong completion data can break RDMA applications silently. Fits stable rules' "oh, that's not good" category.
### Step 8.4: Risk-benefit
**Record:**
- **Benefit:** MEDIUM for affected configs; correctness fix for production RDMA
- **Risk:** VERY LOW (one-line, pattern-proven)
- **Ratio:** Favorable — trivial fix for a real, long-standing bug
---
## PHASE 9: FINAL SYNTHESIS
### Step 9.1: Evidence summary
**FOR backport:**
- Real, verified bug in this 6.18.43 tree
- Trivial, obviously correct fix (matches mlx4 and same-function qp->port usage)
- Userspace-reachable via CQ poll hot path
- Wrong ib_wc data to applications on affected multi-port configs
- Maintainer-applied, zero regression risk
- Present since at least v4.8 — long-lived latent bug
**AGAINST backport:**
- No crash, deadlock, security issue, or kernel memory corruption
- No Reported-by: or public bug report
- Practical impact limited to niche config (multi-port + different link layers + QP on port ≠ 1)
- Dual-port same-type HCAs (majority of deployments) unaffected
- No explicit stable nomination
**Unresolved:** No independent test report; exact production trigger case from Kylinos not documented in thread.
### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logically correct; no explicit test but maintainer-applied
2. Fixes real bug affecting users? **PASS** — wrong WC metadata on affected multi-port setups
3. Important issue? **PASS (borderline)** — not crash/security, but incorrect userspace API data on production RDMA path
4. Small and contained? **PASS** — 3 lines, one file
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — bug confirmed present, clean apply expected
### Step 9.3: Exception categories
**Record:** None (not device ID, quirk, DT, build, or docs).
### Step 9.4: Decision rationale
This is a clear oversight: handle_responder() hardcodes port 1 while the same function uses qp->port for pkey resolution, and mlx4 does the right thing throughout. On multi-port mlx5 devices where ports differ in link layer and QPs are bound to port 2+, userspace receives incorrectly decoded work completions. That is a real correctness bug on a hot userspace-facing path, fixable with a one-line change and essentially zero risk. It does not cause kernel crashes, but stable rules explicitly allow fixes for notable "oh, that's not good" issues, and delivering wrong RDMA completion metadata qualifies for RDMA production users.
---
## Verification
- [Phase 1] Parsed subject, tags, body from provided commit message and git show 194762e6e436a
- [Phase 1] No syzbot/Reported-by/Fixes: tags found
- [Phase 2] Diff: 1-line logic change in handle_responder(), cq.c:172
- [Phase 2] Read handle_responder() lines 169–271 — confirmed branch impact on ib_wc fields
- [Phase 3] git describe HEAD → v6.18.43; git merge-base --is- ancestor 194762e6e436a HEAD → fix NOT in tree
- [Phase 3] Tags v4.8–v6.18 checked — hardcoded port 1 present in all
- [Phase 3] git show 194762e6e436a — full diff confirmed
- [Phase 4] b4 dig -c 194762e6e436a — lore URL found
- [Phase 4] b4 dig -a — single v1 revision
- [Phase 4] b4 dig -w — Leon Romanovsky, Jason Gunthorpe CC'd
- [Phase 4] b4 dig -m /tmp/mlx5_cq_thread.mbox — Leon applied, no stable/CC discussion
- [Phase 5] grep handle_responder — called from CQE poll switch at line 518
- [Phase 5] mlx5_ib_poll_cq registered as .poll_cq in main.c:4352
- [Phase 5] mlx4 uses qp->port at mlx4/qp.c:3050 (and 3 other sites)
- [Phase 6] Buggy line confirmed at cq.c:172 in current checkout
- [Phase 6] qp->port field confirmed in mlx5_ib.h:526
- [Phase 8] Impact: wrong WC metadata, MEDIUM severity, niche multi-port trigger
- [UNVERIFIED] Exact hardware configuration Kylinos used to discover the bug
**YES**
drivers/infiniband/hw/mlx5/cq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cq.c +2 -1
@@ -169,7 +169,8 @@ enum {static void handle_responder (struct ib_wc *wc,struct mlx5_cqe64 *cqe,struct mlx5_ib_qp *qp) { -enum rdma_link_layer ll =rdma_port_get_link_layer (qp->ibqp.device,1 ); +enum rdma_link_layer ll = +rdma_port_get_link_layer (qp->ibqp.device, qp->port);struct mlx5_ib_dev *dev =to_mdev (qp->ibqp.device);struct mlx5_ib_srq *srq =NULL ;struct mlx5_ib_wq *wq;
Signature · 1 line
2.53.0