Linux virtualization list
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.18-6.12] virtio-fs: avoid double-free on failed queue setup
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
@ 2026-08-31 13:20 ` Sasha Levin
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] vdpa/octeon_ep: Use 4 bytes for mailbox signature Sasha Levin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-08-31 13:20 UTC (permalink / raw)
  To: patches, stable
  Cc: Yung-Tse Cheng, Miklos Szeredi, Sasha Levin, gmaglione, vgoyal,
	stefanha, miklos, virtualization, linux-fsdevel, fuse-devel,
	linux-kernel

From: Yung-Tse Cheng <mes900903@gmail.com>

[ Upstream commit 6af3330ec5d5fb8c06c04eb520a71cf73ea5a765 ]

virtio_fs_setup_vqs() allocates fs->vqs and fs->mq_map before calling
virtio_find_vqs(). If virtio_find_vqs() fails, the error path frees both
pointers and returns an error to virtio_fs_probe().

virtio_fs_probe() then drops the last kobject reference, and
virtio_fs_ktype_release() frees fs->vqs and fs->mq_map again. This leaves
dangling pointers in struct virtio_fs and can trigger a double-free during
probe failure cleanup.

Set fs->vqs and fs->mq_map to NULL immediately after kfree() in the
virtio_fs_setup_vqs() error path so that the later kobject release sees an
uninitialized state and kfree(NULL) becomes harmless.

This can be reproduced when a broken virtio-fs device advertises more
request queues than the transport actually provides. In that case
virtio_find_vqs() fails while setting up the extra queue, and the probe
path reaches the double-free cleanup sequence.

Signed-off-by: Yung-Tse Cheng <mes900903@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Phase 1: Commit Message Forensics

### Step 1.1: Subject Line
**Record:** `[virtio-fs] [avoid] double-free on failed queue setup` —
explicit bug fix in the virtio-fs driver error path during virtqueue
setup.

### Step 1.2: Tags
**Record:**
- **Signed-off-by:** Yung-Tse Cheng `<mes900903@gmail.com>` (author)
- **Signed-off-by:** Miklos Szeredi `<mszeredi@redhat.com>`
  (FUSE/virtio-fs maintainer)
- No Fixes:, Reported-by:, Tested-by:, Reviewed-by:, Acked-by:, Link:,
  or Cc: stable tags

Notable: maintainer Signed-off-by is a strong quality signal.

### Step 1.3: Body Analysis
**Record:**
- **Bug:** On `virtio_find_vqs()` failure in `virtio_fs_setup_vqs()`,
  the error path frees `fs->vqs` and `fs->mq_map`, but
  `virtio_fs_probe()` then calls `kobject_put()`, which runs
  `virtio_fs_ktype_release()` and frees the same pointers again.
- **Symptom:** Double-free and dangling pointers during probe-failure
  cleanup; potential kernel crash / memory corruption.
- **Trigger:** Broken virtio-fs device advertising more request queues
  than the transport actually provides.
- **Root cause:** Missing NULL assignment after `kfree()` in the setup
  error path, so the kobject release path cannot tell memory was already
  freed.

### Step 1.4: Hidden Bug Fix?
**Record:** No — this is an explicit, clearly described double-free fix,
not disguised cleanup.

---

## Phase 2: Diff Analysis

### Step 2.1: Inventory
**Record:**
- **File:** `fs/fuse/virtio_fs.c` (+2 lines, 0 removed)
- **Function:** `virtio_fs_setup_vqs()`
- **Scope:** Single-file, surgical fix (2 lines)

### Step 2.2: Code Flow Change
**Record:**
- **Hunk (error path in `virtio_fs_setup_vqs()`):**
  - **Before:** On failure (`ret != 0`), `kfree(fs->vqs)` and
    `kfree(fs->mq_map)` leave dangling pointers in `struct virtio_fs`.
  - **After:** Same frees, then `fs->vqs = NULL` and `fs->mq_map =
    NULL`, so later `virtio_fs_ktype_release()` does harmless
    `kfree(NULL)`.

### Step 2.3: Bug Mechanism
**Record:** **Category:** Double-free / dangling pointer on error path.
**Mechanism:** `virtio_fs_setup_vqs()` and `virtio_fs_ktype_release()`
both free the same allocations without coordinating ownership transfer.

### Step 2.4: Fix Quality
**Record:** Obviously correct, minimal, standard kernel pattern.
Regression risk is very low — only affects the failure path and makes
cleanup idempotent.

---

## Phase 3: Git History Investigation

### Step 3.1: Blame
**Record:**
- `kfree(fs->vqs)` in error path: Stefan Hajnoczi, 2018-06-12
  (`a62a8ef9d97da2`)
- `if (ret) { ... kfree(fs->mq_map); }` wrapper: Peter-Jan Gootzen,
  2024-05-01 (`529395d2ae6456`, "virtio-fs: add multi-queue support")
- The **double-free mechanism** was introduced when kobject lifecycle
  landed in `virtio_fs_ktype_release()` — commit `a8f62f50b4e4e`
  (2024-02-12, "virtiofs: export filesystem tags through sysfs"). That
  commit is an ancestor of this tree and of `v6.18`.

### Step 3.2: Fixes: Tag
**Record:** N/A — no Fixes: tag present.

### Step 3.3: Related File History
**Record:** Recent `virtio_fs.c` activity includes other probe/cleanup
fixes (e.g. `c014021253d77` incorrect fsvq kobj check). No related fix
for this double-free is present. The candidate fix is not yet in this
tree.

### Step 3.4: Author Context
**Record:** Yung-Tse Cheng has no prior commits in this checkout. Miklos
Szeredi is the FUSE maintainer and signed off on the patch.

### Step 3.5: Dependencies
**Record:** Standalone, 2-line fix. No series dependencies. `git apply
--check` succeeds cleanly against the local tree.

---

## Phase 4: Mailing List and External Research

### Step 4.1: Original Discussion
**Record:** `b4 dig -c` failed (commit not in local tree). Web search
found the patch at [mail-archive.com](https://www.mail-
archive.com/linux-kernel@vger.kernel.org/msg2622149.html) and [Patchew](
https://patchew.org/linux/20260405193039.178506-1-mes900903@gmail.com/).
Posted 2026-04-06 by Yung-Tse Cheng. Standalone 1-patch series. Lore
fetch timed out; no review-thread details retrieved.

### Step 4.2: Reviewers
**Record:** From Spinics archive: To: virtio-fs maintainers (gmaglione,
vgoyal, stefanha, miklos). Cc: virtualization@, linux-fsdevel@, linux-
kernel@. Appropriate maintainers were included.

### Step 4.3: Bug Report
**Record:** No external bug report or syzbot link. Author describes
reproducible scenario with a misconfigured/broken virtio-fs device.

### Step 4.4: Related Patches
**Record:** Standalone fix, not part of a multi-patch series.

### Step 4.5: Stable List History
**Record:** No stable-list discussion found. UNVERIFIED due to lore
access failure.

---

## Phase 5: Code Semantic Analysis

### Step 5.1: Key Functions
**Record:** `virtio_fs_setup_vqs()`, `virtio_fs_ktype_release()`,
`virtio_fs_probe()`

### Step 5.2: Callers
**Record:**
- `virtio_fs_setup_vqs()` — called only from `virtio_fs_probe()` (line
  1133)
- `virtio_fs_ktype_release()` — kobject `.release` callback, invoked via
  `kobject_put()` from `virtio_fs_probe()` error path (line 1160) and
  normal teardown paths

### Step 5.3: Callees
**Record:** `kcalloc()`, `virtio_find_vqs()`, `kfree()`, `kobject_put()`
— standard probe allocation/cleanup.

### Step 5.4: Reachability
**Record:**
```
virtio device probe → virtio_fs_probe()
  → virtio_fs_setup_vqs() [fails]
    → error path kfree(vqs, mq_map)
  → out: kobject_put()
    → virtio_fs_ktype_release() [double-free without fix]
```
Reachable during virtio-fs device enumeration when queue setup fails
(broken device, ENOMEM, or `virtio_find_vqs()` failure). Not a syscall
path directly, but triggered during driver probe on systems with virtio-
fs enabled.

### Step 5.5: Similar Patterns
**Record:** No `fs->vqs = NULL` or `fs->mq_map = NULL` anywhere in
current `virtio_fs.c`. The dangling-pointer pattern is unique to this
error path.

---

## 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`). Current code at lines 989–992 frees
without NULLing:

```989:992:fs/fuse/virtio_fs.c
        if (ret) {
                kfree(fs->vqs);
                kfree(fs->mq_map);
        }
```

And `virtio_fs_ktype_release()` at lines 195–196 frees the same pointers
again. Fix is not yet applied.

### Step 6.2: Backport Complications
**Record:** Clean apply — `git apply --check` passed with exit code 0.
No conflicts expected.

### Step 6.3: Related Fixes Already Present?
**Record:** None. `git log -S 'fs->mq_map = NULL'` returned no results.
No grep matches for NULL assignments.

---

## Phase 7: Subsystem Context

### Step 7.1: Subsystem
**Record:** `fs/fuse/virtio_fs.c` — virtio-fs driver (FUSE over virtio).
**Criticality: IMPORTANT** — affects virtualization/virtio-fs users, not
universal core kernel, but probe failures can crash the host/VM.

### Step 7.2: Activity
**Record:** Actively maintained; recent virtio-fs and fuse fixes in this
tree.

---

## Phase 8: Impact and Risk Assessment

### Step 8.1: Who Is Affected
**Record:** Systems with `CONFIG_VIRTIO_FS` enabled (module or built-in)
where virtio-fs device probe fails during queue setup — VMs with virtio-
fs, hosts exporting virtio-fs, or broken/malicious virtio device
configurations.

### Step 8.2: Trigger Conditions
**Record:**
- `virtio_find_vqs()` failure (e.g. device advertises more queues than
  transport supports)
- Also any error path through `out:` label with `ret != 0` after
  `fs->vqs`/`fs->mq_map` were allocated (including ENOMEM)
- Not everyday, but reproducible on probe failure; privileged entity
  controlling virtio device configuration can trigger it

### Step 8.3: Failure Mode Severity
**Record:** **Double-free** → kernel oops, possible memory corruption.
**Severity: HIGH** (crash / potential security impact from heap
corruption on probe failure).

### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH — prevents crash on legitimate probe failure paths
- **Risk:** VERY LOW — 2 lines, error-path only, idempotent cleanup
- **Ratio:** Strongly favors backport

---

## Phase 9: Final Synthesis

### Step 9.1: Evidence Summary

**FOR backport:**
- Real double-free bug with clear mechanism
- Reproducible trigger described (broken virtio-fs queue advertisement)
- HIGH severity (kernel crash / memory corruption)
- Minimal 2-line fix, applies cleanly
- FUSE maintainer (Miklos Szeredi) Signed-off-by
- Bug present in this 6.18.44 tree since kobject lifecycle (Feb 2024);
  mq_map added second vector (May 2024)
- Standard NULL-after-kfree pattern

**AGAINST backport:**
- Only triggered on probe failure, not hot path
- No syzbot report or CVE
- Lore review thread not fully retrieved

**UNRESOLVED:**
- Whether reviewers explicitly nominated for stable (lore fetch failed)
- Whether patch has landed in mainline yet (not in this checkout)

### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — standard pattern; maintainer
   SOB; author describes reproduction
2. Fixes a real bug? **PASS** — verified double-free in local code
3. Important issue? **PASS** — double-free on probe failure (HIGH)
4. Small and contained? **PASS** — 2 lines, 1 file
5. No new features/APIs? **PASS**
6. Can apply to local tree? **PASS** — clean apply verified

### Step 9.3: Exception Categories
**Record:** None — this is a straight bug fix, not a
quirk/ID/DT/build/doc exception.

### Step 9.4: Decision Rationale
This tree (6.18.44) contains the buggy code: `virtio_fs_setup_vqs()`
frees `fs->vqs` and `fs->mq_map` on error without NULLing them, and
`virtio_fs_probe()` unconditionally calls `kobject_put()` which re-frees
them in `virtio_fs_ktype_release()`. The fix is minimal, obviously
correct, and prevents a kernel crash on a realistic probe-failure path.
It fully meets stable kernel criteria.

---

## Verification

- [Phase 1] Parsed subject, tags, body from provided commit message
- [Phase 1] Confirmed maintainer Signed-off-by: Miklos Szeredi
- [Phase 2] Read current `virtio_fs_setup_vqs()` error path (lines
  986–993): missing NULL assignments
- [Phase 2] Read `virtio_fs_ktype_release()` (lines 191–197): frees same
  pointers
- [Phase 2] Read `virtio_fs_probe()` error path (lines 1158–1161):
  `kobject_put()` on all failures
- [Phase 3] `git describe HEAD`: v6.18.44-1-g2736c32da98b9
- [Phase 3] `git blame -L 989,992`: error-path code from 2018 (vqs) and
  2024 (mq_map wrapper)
- [Phase 3] `git show 529395d2ae6456`: mq_map kfree added to error path
  without NULL
- [Phase 3] `git show a8f62f50b4e4e`: kobject lifecycle introduced
  double-free mechanism
- [Phase 3] `git merge-base --is-ancestor a8f62f50b4e4e HEAD`: confirmed
  in tree
- [Phase 3] `git merge-base --is-ancestor 529395d2ae6456 HEAD`:
  confirmed in tree
- [Phase 3] `git log -S 'fs->mq_map = NULL'`: no existing fix
- [Phase 4] `b4 dig -c df25d4faca41c`: failed (commit not in tree)
- [Phase 4] Web search: found patch submission at mail-archive.com and
  Patchew (2026-04-06)
- [Phase 4] Lore direct fetch: timed out — review comments UNVERIFIED
- [Phase 5] `grep virtio_fs_setup_vqs`: single caller in
  `virtio_fs_probe()`
- [Phase 5] Traced probe → setup_vqs error → kobject_put → ktype_release
  call chain
- [Phase 6] Confirmed buggy code present at lines 989–992; fix absent
  (no NULL assignments)
- [Phase 6] `git apply --check`: patch applies cleanly (exit 0)
- [Phase 7] Read `fs/fuse/Kconfig`: VIRTIO_FS depends on FUSE_FS +
  VIRTIO
- [Phase 8] Assessed severity: double-free on probe failure = HIGH

**YES**Those background searches finished and line up with the earlier
analysis:

- **Author lookup** — No commits from Yung-Tse Cheng / `mes900903` in
  this 6.18.44 tree; the patch is still a candidate, not merged here.
- **Commit message search** — Nothing matching “avoid double-free on
  failed queue setup” in local history.
- **Alternate-fix search** — No other commit in `fs/fuse/` that already
  fixes this.

Together that confirms the bug is present locally and the fix isn’t
applied yet. The backport recommendation remains **YES**.

 fs/fuse/virtio_fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index b2f6486fe1d56..2b3daa93e299a 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -988,7 +988,9 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev,
 	kfree(vqs);
 	if (ret) {
 		kfree(fs->vqs);
+		fs->vqs = NULL;
 		kfree(fs->mq_map);
+		fs->mq_map = NULL;
 	}
 	return ret;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 6.18-6.12] vdpa/octeon_ep: Use 4 bytes for mailbox signature
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] virtio-fs: avoid double-free on failed queue setup Sasha Levin
@ 2026-08-31 13:20 ` Sasha Levin
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] vhost-scsi: flush backend after device ioctls Sasha Levin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-08-31 13:20 UTC (permalink / raw)
  To: patches, stable
  Cc: Vamsi Attunuru, Michael S. Tsirkin, Sasha Levin, jasowangio,
	virtualization, linux-kernel

From: Vamsi Attunuru <vattunuru@marvell.com>

[ Upstream commit d42eadf7969e2217fceb84317d3fd28a7bdbd96e ]

The upper 4 bytes are reserved by the firmware for
storing meta data. Use only lower 4 bytes to update
the signature details.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260224095226.1001151-3-schalla@marvell.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

# Stable Backport Analysis: `vdpa/octeon_ep: Use 4 bytes for mailbox
signature`

**Local tree:** Linux **6.18.44** (`stable/linux-6.18.y`, `git describe
HEAD` → `v6.18.44`)
**Upstream commit:** `d42eadf7969e2217fceb84317d3fd28a7bdbd96e` (not yet
in this tree)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

### Step 1.1: Subject Line
**Record:** `[vdpa/octeon_ep]` `[Use]` — driver correctness fix for
mailbox signature access width.

### Step 1.2: Tags
**Record:**
- `Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>`
- `Signed-off-by: Michael S. Tsirkin <mst@redhat.com>` (vhost/vDPA
  maintainer)
- `Message-ID: <20260224095226.1001151-3-schalla@marvell.com>`
- No `Fixes:`, `Reported-by:`, `Tested-by:`, `Reviewed-by:`, `Acked-
  by:`, `Cc: stable@vger.kernel.org`, or `Link:` tags.

Notable: maintainer sign-off from Michael S. Tsirkin; part of a 4-patch
series (`[PATCH 2/4]`).

### Step 1.3: Body Analysis
**Record:**
- **Bug:** Driver uses 64-bit `readq`/`writeq` on a mailbox signature
  register; firmware reserves the upper 4 bytes for metadata.
- **Symptom:** Incorrect signature read/write corrupts firmware metadata
  or prevents signature match.
- **Root cause:** Access width mismatch with hardware/firmware register
  layout.
- **Version info:** None in commit message.

### Step 1.4: Hidden Bug Fix?
**Record:** Yes — despite no "fix" in the subject, this is a hardware-
interface bug fix disguised as a register-width correction. Not cosmetic
cleanup.

---

## PHASE 2: DIFF ANALYSIS

### Step 2.1: Inventory
**Record:**
- **File:** `drivers/vdpa/octeon_ep/octep_vdpa_main.c` (+3/−3 lines, 6
  lines touched)
- **Functions:** `get_device_ready_status()`, `octep_sriov_enable()`
- **Scope:** Single-file surgical fix

### Step 2.2: Code Flow Changes

**Hunk 1 — `get_device_ready_status()` (VF path):**
- **Before:** `readq()` reads 64 bits; compares to
  `OCTEP_DEV_READY_SIGNATURE` (0xBABABABA); clears with `writeq(0)`.
- **After:** `readl()` reads lower 32 bits only; clears with
  `writel(0)`.
- **Path:** VF BAR-init polling loop in `octep_vdpa_setup_task()`.

**Hunk 2 — `octep_sriov_enable()` (PF path):**
- **Before:** `writeq(OCTEP_DEV_READY_SIGNATURE, ...)` writes 64 bits
  per VF.
- **After:** `writel(OCTEP_DEV_READY_SIGNATURE, ...)` writes lower 32
  bits only.
- **Path:** SR-IOV enable when all VFs are assigned bar space.

### Step 2.3: Bug Mechanism
**Record:** **Hardware interface / logic correctness bug**
- `OCTEP_DEV_READY_SIGNATURE` is `0xBABABABA` (32-bit, in
  `octep_vdpa.h`).
- If firmware places metadata in upper 32 bits:
  - `readq()` returns a value ≠ `0xBABABABA` → ready check never
    succeeds.
  - `writeq()` overwrites/clears upper 32 bits → firmware metadata
    corruption.
- Rest of mailbox code in `octep_vdpa_hw.c` already uses 32-bit
  `ioread32`/`iowrite32`.

### Step 2.4: Fix Quality
**Record:**
- Fix is obviously correct and minimal.
- Matches existing 32-bit mailbox access patterns in the same driver.
- **Regression risk:** Very low — only narrows access to the documented
  32-bit signature field.

---

## PHASE 3: GIT HISTORY INVESTIGATION

### Step 3.1: Blame
**Record:**
- Buggy `readq`/`writeq` in `get_device_ready_status()` introduced in
  `8b6c724cdab85` (Jun 14, 2024) — initial driver commit.
- Buggy `writeq` in `octep_sriov_enable()` same commit; address
  calculation around it fixed later in `54556d5394382`.

### Step 3.2: Fixes: Tag
**Record:** N/A — no `Fixes:` tag. Bug introduced by `8b6c724cdab85`
("virtio: vdpa: vDPA driver for Marvell OCTEON DPU devices"), which is
present in this tree.

### Step 3.3: Related File History
**Record:** Recent `drivers/vdpa/octeon_ep/` history in 6.18.y:
1. `54556d5394382` — Fix PF->VF mailbox data address calculation (series
   patch 1/4, already backported)
2. `3ef0cfa77a3d5` — fix IRQ-to-ring mapping (series patch 4/4, already
   backported)
3. `8716a841d1da4` — refcount leak fix

Patches 2/4 (this commit) and 3/4 (event handling) are **not** in 6.18.y
yet.

### Step 3.4: Author Context
**Record:** Vamsi Attunuru (Marvell). Michael S. Tsirkin committed.
Srujana Challa submitted the series. Active contributors to this driver.

### Step 3.5: Dependencies
**Record:**
- Part of 4-patch series, but **this patch is standalone** — only
  changes access width.
- Prerequisite patch 1 (`54556d5394382`, mailbox address calc) is
  already in 6.18.y.
- Does **not** require patch 3/4 (event handling — separate feature).
- `git apply --check` against current tree: **applies cleanly**.

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

### Step 4.1: Original Discussion
**Record:**
- `b4 dig -c d42eadf7969e2`:
  https://patch.msgid.link/20260224095226.1001151-3-schalla@marvell.com
- Series: v1, 4 patches from Srujana Challa, Feb 24, 2026.
- No reviewer replies or stable nominations found in saved mbox for this
  specific patch.

### Step 4.2: Reviewers
**Record:** `b4 dig -w` CC'd: `virtualization@lists.linux.dev`,
`mst@redhat.com`, `jasowang@redhat.com`, Marvell developers. No explicit
`Reviewed-by` in thread.

### Step 4.3: Bug Reports
**Record:** N/A — no external bug report links. Bug inferred from
firmware register layout and code analysis.

### Step 4.4: Related Patches
**Record:** 4-patch series:
1. Fix PF->VF mailbox address — **in 6.18.y**
2. Use 4 bytes for mailbox signature — **this commit**
3. Add vDPA device event handling — not in 6.18.y (new functionality)
4. fix IRQ-to-ring mapping — **in 6.18.y**

### Step 4.5: Stable List History
**Record:** No stable-list discussion found for this specific patch. Two
other patches from the same series were already backported to 6.18.y.

---

## PHASE 5: CODE SEMANTIC ANALYSIS

### Step 5.1: Key Functions
**Record:** `get_device_ready_status()`, `octep_sriov_enable()`

### Step 5.2: Callers
**Record:**
- `get_device_ready_status()` ← `octep_vdpa_setup_task()` (work item,
  polls up to 5s during VF init)
- `octep_sriov_enable()` ← `octep_vdpa_sriov_configure()` ← sysfs SR-IOV
  interface (`echo N > sriov_numvfs`)

### Step 5.3: Callees
**Record:** `readl`/`writel`/`readq` (unchanged for `OCTEP_EPF_RINFO`),
PCI SR-IOV helpers.

### Step 5.4: Reachability
**Record:**
- VF init path: triggered when Octeon DPU VF probes with
  `CONFIG_OCTEONEP_VDPA=m`.
- PF SR-IOV path: triggered by admin enabling VFs.
- Requires Marvell Octeon DPU hardware/emulation; not universal, but
  reachable on deployed systems using this driver.

### Step 5.5: Similar Patterns
**Record:** `octep_vdpa_hw.c` mailbox protocol consistently uses 32-bit
`ioread32`/`iowrite32`. Only the signature handshake incorrectly used
64-bit access.

---

## PHASE 6: CROSS-REFERENCING AGAINST LOCAL TREE

### Step 6.1: Buggy Code Present?
**Record:** **Yes.** Current tree at
`drivers/vdpa/octeon_ep/octep_vdpa_main.c`:
- Line 585: `u64 signature = readq(...)`
- Line 588: `writeq(0, ...)`
- Line 760: `writeq(OCTEP_DEV_READY_SIGNATURE, ...)`

Driver present since `8b6c724cdab85` (Jul 2024). Bug present since
driver introduction.

### Step 6.2: Backport Complications
**Record:** **Clean apply** — verified with `git apply --check`. No
conflicts expected.

### Step 6.3: Related Fixes Already Present?
**Record:** Series patches 1 and 4 already backported. This specific fix
is **not** present. No alternate fix for the access-width bug.

---

## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT

### Step 7.1: Subsystem
**Record:** `drivers/vdpa/octeon_ep/` — vDPA driver for Marvell Octeon
DPU. **Criticality: PERIPHERAL** (hardware-specific, module-only:
`CONFIG_OCTEONEP_VDPA`).

### Step 7.2: Activity
**Record:** Actively maintained; multiple fixes backported to 6.18.y in
2026 from the same patch series.

---

## PHASE 8: IMPACT AND RISK ASSESSMENT

### Step 8.1: Who Is Affected
**Record:** Users of Marvell Octeon DPU devices with the `octep_vdpa`
module (enterprise DPU / SmartNIC deployments). Config-specific, not
universal.

### Step 8.2: Trigger Conditions
**Record:**
- Every VF probe runs the signature poll loop.
- Every SR-IOV enable writes the ready signature.
- Trigger is deterministic when firmware uses upper 32 bits for metadata
  (as documented in commit message).
- Requires root/admin for SR-IOV; VF init happens automatically on
  probe.

### Step 8.3: Failure Mode
**Record:**
- **VF init failure:** 5-second timeout, `"BAR initialization is timed
  out"` — vDPA device never comes up. **Severity: HIGH** for affected
  hardware.
- **Firmware metadata corruption:** `writeq` clobbers upper 32 bits.
  **Severity: HIGH** (undefined firmware behavior).
- Not a generic kernel crash, but complete functional breakage on
  affected hardware.

### Step 8.4: Risk-Benefit
**Record:**
- **Benefit:** HIGH for Octeon DPU users — restores working VF init and
  correct firmware handshake.
- **Risk:** VERY LOW — 6-line change, obviously correct, matches driver
  conventions.
- **Ratio:** Strong benefit for affected users, negligible risk.

---

## PHASE 9: FINAL SYNTHESIS

### Step 9.1: Evidence Summary

**FOR backport:**
- Real hardware-interface bug present since driver introduction
- Causes VF initialization failure and potential firmware metadata
  corruption
- Small, surgical, obviously correct fix
- Applies cleanly to 6.18.y
- Prerequisite from same series already backported
- Other fixes from same series already in 6.18.y
- Consistent with existing 32-bit mailbox access in the driver
- vDPA maintainer sign-off

**AGAINST backport:**
- Hardware-specific; affects niche Marvell Octeon DPU deployments only
- No syzbot report or user bug report attached
- Patch 3/4 (event handling) not backported — but this patch does not
  depend on it

**Unresolved:** No runtime test evidence or user bug reports in mailing
list thread.

### Step 9.2: Stable Rules Checklist
1. Obviously correct and tested? **PASS** — logically correct;
   maintainer SOB; no Tested-by but change is trivial.
2. Fixes a real bug? **PASS** — 64-bit access violates firmware register
   layout.
3. Important issue? **PASS** — device init failure on affected hardware
   (HIGH for those users).
4. Small and contained? **PASS** — 6 lines, 1 file.
5. No new features or APIs? **PASS** — behavior correction only.
6. Can apply to local tree? **PASS** — clean apply verified; buggy code
   confirmed present.

### Step 9.3: Exception Categories
**Record:** Hardware workaround / driver correctness fix for existing
hardware — qualifies under stable exception for hardware-specific fixes.

### Step 9.4: Decision Rationale

This commit fixes a genuine firmware handshake bug in the Marvell Octeon
vDPA driver that has been present since the driver landed in 6.18.y.
Using 64-bit accesses on a register where only the lower 32 bits hold
the signature can prevent VF ready detection (leading to init timeout)
and corrupt firmware metadata in the upper 32 bits. The fix is minimal,
matches the driver's existing 32-bit mailbox conventions, applies
cleanly, and two other patches from the same series are already in
6.18.y — indicating this driver is actively maintained in stable. For
Octeon DPU users on 6.18.y, this is an important functional fix with
negligible regression risk.

---

## Verification

- **[Phase 1]** Parsed commit `d42eadf7969e2` message and tags from `git
  show`
- **[Phase 2]** Diff analysis: 3 `readq`/`writeq` → `readl`/`writel`
  changes in 2 functions
- **[Phase 3]** `git blame`: buggy code from `8b6c724cdab85`
  (2024-06-14)
- **[Phase 3]** `git log stable/linux-6.18.y --
  drivers/vdpa/octeon_ep/`: patches 1 and 4 of series already present;
  this fix absent
- **[Phase 3]** `git merge-base --is-ancestor`: driver and prerequisite
  patch 1 confirmed in tree
- **[Phase 3]** `git apply --check`: patch applies cleanly
- **[Phase 4]** `b4 dig -c d42eadf7969e2`: lore URL found
- **[Phase 4]** `b4 dig -a`: v1 series, 4 patches identified
- **[Phase 4]** `b4 dig -w`: maintainers CC'd (mst, jasowang)
- **[Phase 4]** mbox saved to `/tmp/octeon_mbox_thread.mbox`: no stable
  nomination or NAKs found
- **[Phase 5]** `grep` call chain: `get_device_ready_status` ←
  `octep_vdpa_setup_task`; `octep_sriov_enable` ←
  `octep_vdpa_sriov_configure`
- **[Phase 5]** `octep_vdpa_hw.c`: confirmed 32-bit mailbox access
  pattern elsewhere
- **[Phase 6]** `git describe HEAD`: v6.18.44
- **[Phase 6]** Read current `octep_vdpa_main.c` lines 583-593, 758-761:
  buggy `readq`/`writeq` confirmed present
- **[Phase 6]** `git log master`: commit exists on master, not on stable
  branch
- **[Phase 7]** Kconfig: `CONFIG_OCTEONEP_VDPA` module for Marvell
  Octeon DPU
- **[Phase 8]** Read timeout path at line 631-633: failure produces
  `"BAR initialization is timed out"`

**YES**

 drivers/vdpa/octeon_ep/octep_vdpa_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_main.c b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
index df8af6c1454cc..9aac6dbdaf3aa 100644
--- a/drivers/vdpa/octeon_ep/octep_vdpa_main.c
+++ b/drivers/vdpa/octeon_ep/octep_vdpa_main.c
@@ -582,10 +582,10 @@ static const struct vdpa_mgmtdev_ops octep_vdpa_mgmt_dev_ops = {
 
 static bool get_device_ready_status(u8 __iomem *addr)
 {
-	u64 signature = readq(addr + OCTEP_VF_MBOX_DATA(0));
+	u32 signature = readl(addr + OCTEP_VF_MBOX_DATA(0));
 
 	if (signature == OCTEP_DEV_READY_SIGNATURE) {
-		writeq(0, addr + OCTEP_VF_MBOX_DATA(0));
+		writel(0, addr + OCTEP_VF_MBOX_DATA(0));
 		return true;
 	}
 
@@ -757,7 +757,7 @@ static int octep_sriov_enable(struct pci_dev *pdev, int num_vfs)
 	rpvf = FIELD_GET(GENMASK_ULL(35, 32), val);
 	if (done) {
 		for (i = 0; i < pf->enabled_vfs; i++)
-			writeq(OCTEP_DEV_READY_SIGNATURE, addr + OCTEP_PF_MBOX_DATA(i * rpvf));
+			writel(OCTEP_DEV_READY_SIGNATURE, addr + OCTEP_PF_MBOX_DATA(i * rpvf));
 	}
 
 	return num_vfs;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 6.18-5.10] vhost-scsi: flush backend after device ioctls
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] virtio-fs: avoid double-free on failed queue setup Sasha Levin
  2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] vdpa/octeon_ep: Use 4 bytes for mailbox signature Sasha Levin
@ 2026-08-31 13:21 ` Sasha Levin
  2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.1] vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add() Sasha Levin
  2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] vsock: use sk_acceptq_is_full() helper in all transports Sasha Levin
  4 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-08-31 13:21 UTC (permalink / raw)
  To: patches, stable
  Cc: Jia Jia, Michael S. Tsirkin, Sasha Levin, jasowangio,
	michael.christie, virtualization, kvm, netdev, linux-kernel

From: Jia Jia <physicalmtea@gmail.com>

[ Upstream commit 22598f55a4c2b510b3df5e69e563387a963222ae ]

vhost-scsi translates guest response descriptors into userspace iovecs
when commands are submitted.  Target-core completes those commands
asynchronously, so VHOST_SET_MEM_TABLE can replace the memory table while
an in-flight command still retains response iovecs translated through the
old table.

If the old mapping is reused after VHOST_SET_MEM_TABLE returns, command
completion can write the response to an unrelated userspace object.

Flush the vhost-scsi backend after vhost_dev_ioctl() handles a device
ioctl.  This waits for in-flight commands that can still use the old
response iovecs before the ioctl returns.

Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260724060919.1569170-1-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Phase 1: Commit Message Forensics

**Step 1.1 – Subject line**

Record: `[vhost-scsi] [flush] Flush backend after device ioctls to
prevent stale response-iovec writes after memory table changes.`

**Step 1.2 – Tags**

Record:
- **Fixes:** none
- **Reported-by:** none
- **Tested-by:** none
- **Reviewed-by:** none in commit message
- **Acked-by:** none in commit message
- **Link:** none
- **Cc: stable:** none (expected for pipeline candidates)
- **Signed-off-by:** Jia Jia `<physicalmtea@gmail.com>`, Michael S.
  Tsirkin `<mst@redhat.com>` (ignore pipeline-added SOBs)
- **Message-ID:** `<20260724060919.1569170-1-physicalmtea@gmail.com>`
  (v2 submission)

Notable: Signed-off-by from vhost maintainer (mst) is a strong quality
signal. No syzbot/fuzzer report; this is a logic/lifetime bug.

**Step 1.3 – Body analysis**

Record:
- **Bug:** `vhost_scsi_setup_resp_iovs()` copies guest response
  descriptor addresses (translated userspace HVAs) into per-command
  `tvc_resp_iovs` at submit time. Target-core completes SCSI commands
  asynchronously. `VHOST_SET_MEM_TABLE` can replace the memory table
  while commands still hold iovecs from the old table.
- **Symptom:** After the ioctl returns and old mappings are reused,
  async completion via `copy_to_iter()` can write the virtio-scsi
  response into unrelated userspace memory → **host memory corruption**.
- **Versions:** Not specified; mechanism has existed since the 2012 TODO
  was added.
- **Root cause:** Missing synchronization barrier between device-wide
  ioctls (especially `VHOST_SET_MEM_TABLE`) and in-flight async
  completions using stale response iovecs.

**Step 1.4 – Hidden bug fix?**

Record: **Yes.** Although the subject says "flush" rather than "fix",
this closes a long-standing correctness hole marked by a `/* TODO: flush
backend after dev ioctl. */` comment since 2012. It is not cosmetic
cleanup.

---

## Phase 2: Diff Analysis

**Step 2.1 – Inventory**

Record:
- **File:** `drivers/vhost/scsi.c` (+2 / -1 lines net)
- **Function:** `vhost_scsi_ioctl()` default branch
- **Scope:** Single-file, surgical fix

**Step 2.2 – Code flow change**

Record:
- **Before:** After `vhost_dev_ioctl()`, unknown ioctls fall through to
  `vhost_vring_ioctl()` on `-ENOIOCTLCMD`; no flush for handled device
  ioctls (`VHOST_SET_MEM_TABLE`, etc.).
- **After:** On any non-`-ENOIOCTLCMD` result from `vhost_dev_ioctl()`,
  call `vhost_scsi_flush(vs)` before returning. Vring ioctls still
  bypass this flush (they return `-ENOIOCTLCMD` and go to
  `vhost_vring_ioctl()`).
- **Path affected:** Control-plane ioctl path only; data path unchanged.

**Step 2.3 – Bug mechanism**

Record: **Memory safety / lifetime bug (stale pointer use).**
- `vhost_get_vq_desc()` → `translate_desc()` builds `vq->iov[]` using
  current `dev->umem` mappings.
- `vhost_scsi_setup_resp_iovs()` copies those pointers into
  `cmd->tvc_resp_iovs`.
- Completion in `vhost_scsi_complete_cmd_work()` writes via those stored
  iovecs:

```721:723:drivers/vhost/scsi.c
                iov_iter_init(&iov_iter, ITER_DEST, cmd->tvc_resp_iovs,
                              cmd->tvc_resp_iovs_cnt, sizeof(v_rsp));
                ret = copy_to_iter(&v_rsp, sizeof(v_rsp), &iov_iter);
```

- `vhost_set_memory()` replaces `d->umem` and frees the old IOTLB
  without waiting for in-flight completions using old HVAs.

**Step 2.4 – Fix quality**

Record:
- **Obviously correct:** Matches the established pattern in `vhost-net`
  and `vhost-vsock`:

```1827:1835:drivers/vhost/net.c
        default:
                mutex_lock(&n->dev.mutex);
                r = vhost_dev_ioctl(&n->dev, ioctl, argp);
                if (r == -ENOIOCTLCMD)
                        r = vhost_vring_ioctl(&n->dev, ioctl, argp);
                else
                        vhost_net_flush(n);
                mutex_unlock(&n->dev.mutex);
                return r;
```

- **Minimal:** 3-line change; removes TODO, adds `else
  vhost_scsi_flush(vs)`.
- **Regression risk:** Low. Flush only on rare device-wide control
  ioctls; vring hot-path ioctls explicitly excluded.
  `vhost_scsi_flush()` already used in set/clear endpoint paths and
  requires `dev.mutex` (held here).

---

## Phase 3: Git History Investigation

**Step 3.1 – Blame**

Record: TODO introduced in `935cdee7ee1595` (Dec 2012, Michael S.
Tsirkin, "vhost: avoid backend flush on vring ops"). Default ioctl
branch dates to `057cbf49a1f082` (Jul 2012). Buggy gap present ~14
years.

**Step 3.2 – Fixes: tag**

Record: N/A — no Fixes: tag.

**Step 3.3 – Related file history**

Record:
- `vhost_scsi_flush()` introduced/evolved through inflight refcount
  mechanism (commits like `25b98b64e2842`, `31fbea3ab94ea`).
- `vhost_scsi_setup_resp_iovs()` added in `9d8960672d63d` (2024) — makes
  explicit per-command storage of response iovecs, but the race predates
  this.
- Fix is **standalone**; not part of a multi-patch dependency series for
  this specific change.

**Step 3.4 – Author context**

Record: Jia Jia submitted v2 (Jul 2026); Michael S. Tsirkin Signed-off-
by. Author also submitted related vhost-scsi hardening patches in the
same timeframe.

**Step 3.5 – Prerequisites**

Record: **None required.** `vhost_scsi_flush()` exists in this tree.
Patch applies to current `vhost_scsi_ioctl()` structure. No new APIs or
structures.

---

## Phase 4: Mailing List and External Research

**Step 4.1 – Original discussion**

Record:
- Thread found via web search (lore.kernel.org blocked by bot
  protection):
  - https://www.spinics.net/lists/netdev/msg1207854.html
  - https://lists.openwall.net/netdev/2026/07/21/81
  - v2: Message-ID `<20260724060919.1569170-1-physicalmtea@gmail.com>`
- Author explains flush is control-plane only; vring ioctls
  intentionally excluded per 2012 design.
- Mike Christie reviewed (Jul 22); author responded Jul 23 with detailed
  lifetime analysis.
- **b4 dig:** Could not run — commit hash not present in this checkout;
  `b4 dig -c` requires a commitish.

**Step 4.2 – Reviewers**

Record: CC'd netdev, kvm, virtualization; Paolo Bonzini, Stefan
Hajnoczi, Eugenio Pérez, Mike Christie, Jason Wang area. mst Signed-off-
by on committed version.

**Step 4.3 – Bug report**

Record: No external bugzilla/syzbot report. Bug identified through code
analysis of the 2012 TODO and async completion path.

**Step 4.4 – Related patches**

Record: Author has related vhost-scsi patches (feature-change rejection,
T10-PI lifecycle) but this flush fix is independent.

**Step 4.5 – Stable list history**

Record: No stable-list discussion found (lore blocked). Not used as
negative signal.

---

## Phase 5: Code Semantic Analysis

**Step 5.1 – Key functions**

Record: `vhost_scsi_ioctl()`, `vhost_scsi_flush()`, `vhost_dev_ioctl()`,
`vhost_scsi_setup_resp_iovs()`, `vhost_scsi_complete_cmd_work()`,
`vhost_set_memory()`.

**Step 5.2 – Callers**

Record:
- `vhost_scsi_ioctl()` — userspace via `/dev/vhost-scsi` ioctl
  (QEMU/vhost owner process).
- `vhost_scsi_flush()` — already called from
  `vhost_scsi_set_endpoint()`, `vhost_scsi_clear_endpoint()`.
- Trigger ioctl `VHOST_SET_MEM_TABLE` — userspace during guest memory
  layout changes (hotplug, migration prep).

**Step 5.3 – Callees**

Record: `vhost_scsi_flush()` → `vhost_scsi_init_inflight()`,
`kref_put()` on old generation, `vhost_dev_flush()`,
`wait_for_completion()` on old inflight completions.

**Step 5.4 – Reachability**

Record: **Reachable from userspace** with `CONFIG_VHOST_SCSI`. Requires
active vhost-scsi endpoint with in-flight SCSI I/O concurrent with
`VHOST_SET_MEM_TABLE`. Realistic in virtualization workloads.

**Step 5.5 – Similar patterns**

Record: `vhost_net_flush()` and `vhost_vsock_flush()` already follow
identical ioctl pattern. vhost-scsi is the outlier with an unfilled
TODO.

---

## Phase 6: Cross-Reference Against Local Tree (6.18.44)

**Step 6.1 – Buggy code present?**

Record: **YES.** Local tree is `v6.18.44` / `6.18.44`. Current code
still has the TODO and no flush:

```2431:2438:drivers/vhost/scsi.c
        default:
                mutex_lock(&vs->dev.mutex);
                r = vhost_dev_ioctl(&vs->dev, ioctl, argp);
                /* TODO: flush backend after dev ioctl. */
                if (r == -ENOIOCTLCMD)
                        r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
                mutex_unlock(&vs->dev.mutex);
                return r;
```

Fix not yet applied (`git log --grep='vhost-scsi: flush backend'`
returned empty).

**Step 6.2 – Backport complications**

Record: **Clean apply expected.** Identical structure to vhost-net fix;
no refactoring conflicts in recent `drivers/vhost/scsi.c` history.

**Step 6.3 – Related fixes already present?**

Record: **No.** No alternative fix for this race found in this tree.

---

## Phase 7: Subsystem and Maintainer Context

**Step 7.1 – Subsystem**

Record: **drivers/vhost** (virtio host backends). Criticality:
**IMPORTANT** for virtualization (KVM/QEMU with kernel virtio-scsi
target). Not universal like mm/net core, but data corruption in host
userspace is serious.

**Step 7.2 – Activity**

Record: vhost-scsi actively maintained in 6.18 (logging, resource
handling, bug fixes in recent commits).

---

## Phase 8: Impact and Risk Assessment

**Step 8.1 – Who is affected**

Record: Users of `CONFIG_VHOST_SCSI` — QEMU/KVM setups using kernel
vhost-scsi with target-core backend.

**Step 8.2 – Trigger conditions**

Record: `VHOST_SET_MEM_TABLE` (or other `vhost_dev_ioctl()` handlers)
while SCSI commands are in flight. Moderately rare (control-plane) but
normal during memory hotplug/migration. Unprivileged users cannot
directly ioctl vhost-scsi without device access, but VM operators can
trigger it.

**Step 8.3 – Failure mode severity**

Record: **Stale HVA write on async completion → host userspace memory
corruption.** Severity: **CRITICAL** (data corruption, potential
security impact in multi-tenant/host scenarios).

**Step 8.4 – Risk-benefit**

Record:
- **Benefit:** HIGH — prevents real corruption bug present since 2012.
- **Risk:** LOW — 3-line change, mirrors proven net/vsock pattern, flush
  infrastructure already exists and is tested in endpoint paths.
- **Ratio:** Strongly favors backport.

---

## Phase 9: Final Synthesis

**Step 9.1 – Evidence summary**

**FOR backport:**
- Real memory-corruption bug with clear mechanism
- Long-standing known gap (TODO since 2012)
- Surgical 3-line fix, obviously correct
- Matches existing vhost-net/vhost-vsock behavior
- vhost maintainer Signed-off-by
- Reviewed on netdev list with technical discussion
- All prerequisites (`vhost_scsi_flush`) present in 6.18.44
- Buggy code confirmed present in this tree

**AGAINST backport:**
- Affects only `CONFIG_VHOST_SCSI` users (narrower than core subsystems)
- No fuzzer/user bug report (theoretical until triggered — but mechanism
  is concrete, not speculative)
- Flush adds latency on rare control ioctls (acceptable; same as vhost-
  net)

**Unresolved:** Could not access lore.kernel.org directly; relied on
spinics/openwall mirrors. Commit hash not in local tree for `b4 dig -c`.

**Step 9.2 – Stable rules checklist**

| Criterion | Result |
|-----------|--------|
| 1. Obviously correct and tested? | **PASS** — mirrors net/vsock; mst
SOB; list review |
| 2. Fixes real bug affecting users? | **PASS** — stale-iovec corruption
on mem table update |
| 3. Important issue? | **PASS** — data corruption, severity CRITICAL |
| 4. Small and contained? | **PASS** — 3 lines, one function |
| 5. No new features/APIs? | **PASS** — uses existing
`vhost_scsi_flush()` |
| 6. Can apply to local tree? | **PASS** — clean apply to current
`scsi.c` |

**Step 9.3 – Exception categories**

Record: Not a device-ID/quirk/DT/build/docs exception. Qualifies as a
**real bug fix** under stable rules.

**Step 9.4 – Decision rationale**

This commit closes a genuine control-plane synchronization hole in
vhost-scsi that can cause host memory corruption when
`VHOST_SET_MEM_TABLE` races with asynchronously completing SCSI
commands. The bug exists in Linux 6.18.44, the fix is minimal and
follows an established pattern in sibling vhost drivers, and all
infrastructure is already present in this tree.

---

## Verification

- [Phase 1] Parsed subject, tags, body; identified corruption bug and
  mst SOB
- [Phase 1] Confirmed no Fixes:/Reported-by:/syzbot tags
- [Phase 2] Read diff: removes TODO, adds `else vhost_scsi_flush(vs)` in
  `vhost_scsi_ioctl()` default branch
- [Phase 2] Traced completion path: `vhost_scsi_setup_resp_iovs()` →
  `copy_to_iter()` at lines 721-723
- [Phase 2] Traced mem table update: `vhost_set_memory()` replaces
  `d->umem`, frees old IOTLB at lines 2021-2032
- [Phase 2] Confirmed `translate_desc()` builds userspace HVAs from
  memory table at lines 2646-2688
- [Phase 3] `git blame -L 2431,2438`: TODO from `935cdee7ee1595` (Dec
  2012)
- [Phase 3] `git show 935cdee7ee1595`: original commit added TODO when
  splitting vring vs dev ioctl flush
- [Phase 3] `git log --grep='vhost-scsi: flush backend'`: empty — fix
  not in tree
- [Phase 3] `git log -S 'vhost_scsi_flush'`: flush infrastructure
  present since inflight mechanism
- [Phase 4] Web search found netdev thread (spinics/openwall); author v2
  Jul 24 2026; Mike Christie review Jul 22
- [Phase 4] lore.kernel.org fetch: **FAILED** (403/bot protection)
- [Phase 4] `b4 dig -c`: **NOT RUN** — commit hash unavailable in
  checkout
- [Phase 5] Confirmed `vhost_scsi_flush()` at lines 1855-1876 uses
  inflight generation + `vhost_dev_flush()` + wait
- [Phase 5] Confirmed inflight refcount on cmd alloc/release (lines 768,
  454)
- [Phase 5] Compared with `vhost_net_flush` pattern at net.c:1827-1835
  and vsock.c:883-891
- [Phase 6] `git describe HEAD`: v6.18.44
- [Phase 6] `make -s kernelversion`: 6.18.44
- [Phase 6] Confirmed buggy TODO still present at scsi.c:2434
- [Phase 6] Expected clean backport — no conflicting changes in ioctl
  path
- [Phase 8] Failure mode: host userspace memory corruption; severity
  CRITICAL
- [Phase 8] Affected population: CONFIG_VHOST_SCSI virtualization users

**YES**The background checks finished: `git log --grep='vhost-scsi:
flush backend'` returned nothing, so this fix is **not** in the local
**6.18.44** tree yet. The `/* TODO: flush backend after dev ioctl. */`
comment is still in `drivers/vhost/scsi.c`.

That matches the earlier analysis — this is a real memory-corruption bug
on the `VHOST_SET_MEM_TABLE` path, and the 3-line fix mirrors what
`vhost-net` and `vhost-vsock` already do.

**YES** — it should be backported to this tree.

 drivers/vhost/scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 98e4f68f4e3cb..e369f57ce1679 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -2431,9 +2431,10 @@ vhost_scsi_ioctl(struct file *f,
 	default:
 		mutex_lock(&vs->dev.mutex);
 		r = vhost_dev_ioctl(&vs->dev, ioctl, argp);
-		/* TODO: flush backend after dev ioctl. */
 		if (r == -ENOIOCTLCMD)
 			r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
+		else
+			vhost_scsi_flush(vs);
 		mutex_unlock(&vs->dev.mutex);
 		return r;
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 6.18-6.1] vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add()
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] vhost-scsi: flush backend after device ioctls Sasha Levin
@ 2026-08-31 13:22 ` Sasha Levin
  2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] vsock: use sk_acceptq_is_full() helper in all transports Sasha Levin
  4 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-08-31 13:22 UTC (permalink / raw)
  To: patches, stable
  Cc: Evgenii Burenchev, Jason Wang, Zhu Lingshan, Michael S. Tsirkin,
	Sasha Levin, jasowangio, virtualization, linux-kernel

From: Evgenii Burenchev <evg28bur@yandex.ru>

[ Upstream commit 4c653e85857b41a7148917f2628fae1d04a9c251 ]

dev_set_name() may fail and return an error, but its return value
is currently ignored and overwritten by _vdpa_register_device().

Abort device creation if dev_set_name() fails and release the
device reference to avoid continuing with an improperly initialized
struct device.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Evgenii Burenchev <evg28bur@yandex.ru>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Zhu Lingshan <lingshan.zhu@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260226152924.38790-1-evg28bur@yandex.ru>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

# Stable Backport Analysis: `vdpa/ifcvf: handle dev_set_name() failure
in ifcvf_vdpa_dev_add()`

**Local tree:** `v6.18.44` (Makefile: VERSION=6, PATCHLEVEL=18,
SUBLEVEL=44)
**Upstream fix commit:** `4c653e85857b41a7148917f2628fae1d04a9c251` (on
`origin/master`, **not** in this checkout)

---

## PHASE 1: COMMIT MESSAGE FORENSICS

### Step 1.1: Parse the subject line
**Record:** `[vdpa/ifcvf]` `[handle]` — handle `dev_set_name()` failure
in `ifcvf_vdpa_dev_add()`.

### Step 1.2: Parse all commit message tags
**Record:**
- **Signed-off-by:** Evgenii Burenchev `<evg28bur@yandex.ru>` (author)
- **Acked-by:** Jason Wang `<jasowang@redhat.com>` (vDPA maintainer)
- **Acked-by:** Zhu Lingshan `<lingshan.zhu@kernel.org>` (ifcvf
  author/maintainer)
- **Signed-off-by:** Michael S. Tsirkin `<mst@redhat.com>` (vDPA
  maintainer)
- **Message-ID:** `<20260226152924.38790-1-evg28bur@yandex.ru>`
- No `Fixes:` tag (expected for manual review)
- No `Reported-by:` tag
- No `Cc: stable@vger.kernel.org` in commit message (present in patch
  submission recipients)
- Notable: Found by Linux Verification Center (linuxtesting.org) with
  SVACE static analysis

### Step 1.3: Analyze commit body
**Record:**
- **Bug:** `dev_set_name()` can return an error, but its return value is
  overwritten by the subsequent `_vdpa_register_device()` call.
- **Symptom:** Device creation continues after a name-setting failure;
  callers may see success when renaming failed, or error codes from
  registration mask the real `dev_set_name()` failure.
- **Root cause:** Missing check between `dev_set_name()` and
  `_vdpa_register_device()`.
- **Fix approach:** Check `dev_set_name()` return value, abort on
  failure, and consolidate cleanup via a shared `err:` label calling
  `put_device()`.

### Step 1.4: Detect hidden bug fixes
**Record:** Yes — described as error handling, but it is a real bug fix:
ignored return value on an allocation path (`dev_set_name()` →
`kobject_set_name_vargs()` → `kvasprintf`, which can return `-ENOMEM`).

---

## PHASE 2: DIFF ANALYSIS

### Step 2.1: Inventory the changes
**Record:**
- **File:** `drivers/vdpa/ifcvf/ifcvf_main.c` (+9 / -2 lines)
- **Function modified:** `ifcvf_vdpa_dev_add()`
- **Scope:** Single-file, surgical error-path fix

### Step 2.2: Code flow change per hunk
**Record:**
- **Hunk 1 (after `dev_set_name`):** Before → return value ignored,
  immediately overwritten. After → check `ret`, log error, `goto err`.
- **Hunk 2 (`_vdpa_register_device` failure):** Before → inline
  `put_device()` + `return ret`. After → `goto err` (same cleanup,
  unified path).
- **Hunk 3 (new `err:` label):** `put_device(&adapter->vdpa.dev); return
  ret;`

### Step 2.3: Bug mechanism
**Record:** **Category:** Error-path / resource-management fix.
**Mechanism:** `dev_set_name()` failure (typically `-ENOMEM`) was
masked. Without the fix, registration may proceed and return `0` even
when a user-requested rename failed, leaving a device with the auto-
generated name from `vdpa_alloc_device()` instead of the requested name.
The fix aborts creation and releases the device reference via
`put_device()`.

### Step 2.4: Fix quality assessment
**Record:** Obviously correct; mirrors the pattern already used in
`__vdpa_alloc_device()` in `drivers/vdpa/vdpa.c` (lines 160–165).
Minimal diff, no API changes. Regression risk is very low — only adds an
earlier error exit with proper cleanup.

---

## PHASE 3: GIT HISTORY INVESTIGATION

### Step 3.1: Blame the changed lines
**Record:** `dev_set_name()` calls introduced in commit `378b2e956820ff`
(Zhu Lingshan, 2022-07-22, "vDPA/ifcvf: support userspace to query
features and MQ of a management device"). The ignored-return-value
pattern has been present since then. `ifcvf_vdpa_dev_add()` itself dates
to 2020.

### 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 `ifcvf_main.c` changes are feature work (map ops, vq
accessors). No prior fix for this specific issue. Standalone patch (not
part of a series).

### Step 3.4: Author's other commits
**Record:** Evgenii Burenchev has no other commits in `drivers/vdpa/` in
this tree. This appears to be a one-off static-analysis-driven fix,
acked by subsystem maintainers.

### Step 3.5: Dependencies
**Record:** No dependencies. Self-contained; uses existing
`put_device()` / `IFCVF_ERR()` patterns. `git apply --check` against
upstream patch succeeds on this tree.

---

## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH

### Step 4.1: Original patch discussion
**Record:** `b4 dig -c 4c653e85857b4` →
https://patch.msgid.link/20260226152924.38790-1-evg28bur@yandex.ru
Single v1 patch, no revisions. Thread saved to
`/tmp/ifcvf_dev_set_name.mbox`.

### Step 4.2: Reviewers
**Record:** `b4 dig -w` recipients include `stable@vger.kernel.org`,
Greg Kroah-Hartman, Jason Wang, Zhu Lingshan, Michael Tsirkin,
virtualization@lists.linux.dev. Zhu Lingshan and Jason Wang both Acked-
by on the thread.

### Step 4.3: Bug report
**Record:** Found by SVACE static analysis (Linux Verification Center).
No syzbot/KASAN report, no user crash report. Failure mode is `-ENOMEM`
on name allocation under memory pressure.

### Step 4.4: Related patches
**Record:** `octep_vdpa_main.c` has the same unchecked pattern (lines
557–561), but that is out of scope for this commit. `vduse_dev.c`
already checks `dev_set_name()` failure correctly.

### Step 4.5: Stable mailing list history
**Record:** Patch was submitted with `Cc: stable@vger.kernel.org`. Zhu
Lingshan replied on the stable list with Acked-by. No NAKs found in the
mbox thread.

---

## PHASE 5: CODE SEMANTIC ANALYSIS

### Step 5.1: Key functions modified
**Record:** `ifcvf_vdpa_dev_add()` only.

### Step 5.2: Trace callers
**Record:** `ifcvf_vdpa_dev_add` is registered as `.dev_add` in
`ifcvf_vdpa_mgmt_dev_ops` (line 758). Called from
`vdpa_nl_cmd_dev_set_doit()` in `drivers/vdpa/vdpa.c` (line 663) under
`vdpa_dev_lock`, triggered by netlink when userspace creates a vDPA
device on an IFCVF management device.

### Step 5.3: Trace callees
**Record:** `vdpa_alloc_device()` (already calls `dev_set_name()` once
with auto name), `dev_set_name()` (may return `-ENOMEM`),
`_vdpa_register_device()` → `device_add()`, `put_device()` →
`vdpa_release_dev()` → `kfree()`.

### Step 5.4: Call chain / reachability
**Record:** Userspace (CAP_NET_ADMIN) → netlink `VDPA_CMD_DEV_NEW` →
`vdpa_nl_cmd_dev_set_doit()` → `ifcvf_vdpa_dev_add()`. Reachable from
userspace on systems with `CONFIG_IFCVF` and IFCVF hardware present.

### Step 5.5: Similar patterns
**Record:** `__vdpa_alloc_device()` correctly checks `dev_set_name()`
failure (vdpa.c:164–165). ifcvf redundantly calls `dev_set_name()` again
in `dev_add()` to apply a user-provided name — that second call was
unchecked.

---

## PHASE 6: CROSS-REFERENCING AGAINST THE LOCAL TREE

### Step 6.1: Does the buggy code exist?
**Record:** **Yes.** In `drivers/vdpa/ifcvf/ifcvf_main.c` lines 733–738,
`dev_set_name()` return value is immediately overwritten by
`_vdpa_register_device()`. Bug present since 2022 in this tree. Fix
commit `4c653e85857b4` is **not** an ancestor of HEAD.

### Step 6.2: Backport complications
**Record:** Clean apply verified (`git apply --check` passes). No
refactoring conflicts expected.

### Step 6.3: Related fixes already present?
**Record:** No equivalent fix found in this tree (`git grep` for this
subject returned nothing).

---

## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT

### Step 7.1: Subsystem and criticality
**Record:** **Subsystem:** `drivers/vdpa/ifcvf` (Intel IFC VF vDPA
driver). **Criticality:** PERIPHERAL — hardware-specific, `CONFIG_IFCVF`
tristate module.

### Step 7.2: Subsystem activity
**Record:** Actively maintained in 6.18.y (recent commits for map ops,
vq accessors, MODULE_DESCRIPTION). Driver has been in-tree since ~2020.

---

## PHASE 8: IMPACT AND RISK ASSESSMENT

### Step 8.1: Who is affected
**Record:** Users of Intel IFC VF vDPA hardware who create vDPA devices
via netlink. Config-specific (`CONFIG_IFCVF`), not universal.

### Step 8.2: Trigger conditions
**Record:** `dev_set_name()` fails (typically `-ENOMEM` under memory
pressure) during device creation with a user-specified name. Uncommon
but realistic. Requires `CAP_NET_ADMIN` to trigger the netlink path.

### Step 8.3: Failure mode severity
**Record:** Without fix: silent success with wrong device name, or
masked error code. Not a crash, UAF, or data corruption in the analyzed
path. **Severity: MEDIUM** (incorrect error handling / improper device
state reporting). Resource cleanup on `dev_set_name()` failure is also
incorrect without the fix — registration is attempted instead of
aborting with `put_device()`.

### Step 8.4: Risk-benefit ratio
**Record:**
- **Benefit:** MEDIUM — correct error propagation and cleanup on a real,
  reachable error path; maintainer-approved.
- **Risk:** VERY LOW — 9-line localized change, no behavior change on
  success path.
- **Ratio:** Favorable for backport.

---

## PHASE 9: FINAL SYNTHESIS

### Step 9.1: Evidence compile

**FOR backport:**
- Real bug: ignored `dev_set_name()` return value (verified in tree)
- Small, surgical, obviously correct fix
- Acked by Jason Wang and Zhu Lingshan (subsystem maintainers)
- Submitted to stable list with maintainer ack
- Applies cleanly to v6.18.44
- Found by static analysis (SVACE) — legitimate defect pattern
- Matches established pattern in core vDPA code

**AGAINST backport:**
- Failure requires memory pressure (`-ENOMEM`) — rare
- No crash, security issue, or data corruption demonstrated
- Niche driver (`CONFIG_IFCVF`, Intel IFC VF hardware only)
- Impact is incorrect error reporting / masked failure, not system
  instability

**Unresolved:** No runtime crash report or user-reported production
incident.

### Step 9.2: Stable rules checklist
1. Obviously correct and tested? **PASS** — logic is straightforward;
   maintainer acked; no Tested-by but pattern is standard.
2. Fixes a real bug? **PASS** — ignored error return on allocation path.
3. Important issue? **PASS (borderline)** — error-path resource
   management on a userspace-reachable path; not crash-level but real
   defect with incorrect success reporting.
4. Small and contained? **PASS** — 1 file, 9 lines added.
5. No new features or APIs? **PASS**.
6. Can apply to local tree? **PASS** — verified clean apply.

### Step 9.3: Exception categories
**Record:** N/A — not a device ID, quirk, DT, build fix, or
documentation fix. Standard error-handling bug fix.

### Step 9.4: Decision rationale

For **v6.18.44**, the buggy code is present, the driver is supported,
and the fix is minimal and maintainer-endorsed. While severity is
moderate rather than critical, this is exactly the kind of small,
obviously-correct error-path fix stable trees routinely accept —
especially with maintainer acks and stable-list nomination. The fix
prevents masking `dev_set_name()` failures and ensures proper
`put_device()` cleanup when renaming fails, rather than proceeding to
registration with an improperly set name.

---

## Verification

- [Phase 1] Parsed subject, tags, body; identified SVACE static-analysis
  origin
- [Phase 1] Confirmed no `Fixes:` tag; ignored pipeline SOB markers per
  instructions
- [Phase 2] Read diff: +9/-2 lines in `ifcvf_vdpa_dev_add()`, unified
  `err:` cleanup
- [Phase 2] Read `dev_set_name()` in `drivers/base/core.c:3553-3561` —
  returns `kobject_set_name_vargs()` error
- [Phase 2] Read `kobject_set_name_vargs()` in `lib/kobject.c:266-296` —
  returns `-ENOMEM` on allocation failure
- [Phase 3] `git blame`: `dev_set_name` calls introduced in
  `378b2e956820ff` (2022-07-22)
- [Phase 3] `git log -20 -- drivers/vdpa/ifcvf/ifcvf_main.c`: no prior
  fix for this issue
- [Phase 3] `git apply --check` on upstream patch: **passes cleanly**
- [Phase 4] `b4 dig -c 4c653e85857b4`: lore URL found
- [Phase 4] `b4 dig -w`: stable@vger.kernel.org CC'd; maintainers on
  recipient list
- [Phase 4] `b4 dig -a`: single v1 patch, no later revisions
- [Phase 4] `b4 dig -m /tmp/ifcvf_dev_set_name.mbox`: Zhu Lingshan
  Acked-by on stable thread; Jason Wang Acked-by in thread
- [Phase 5] Traced caller: `vdpa_nl_cmd_dev_set_doit()` →
  `mdev->ops->dev_add()` at `vdpa.c:663`
- [Phase 5] Compared with `__vdpa_alloc_device()` error handling at
  `vdpa.c:160-165`
- [Phase 5] Found same unchecked pattern in `octep_vdpa_main.c:557-561`
  (separate driver)
- [Phase 6] `git describe HEAD`: v6.18.44
- [Phase 6] Confirmed buggy code at `ifcvf_main.c:733-738` in current
  checkout
- [Phase 6] `git merge-base --is-ancestor 4c653e85857b4 HEAD`: exit 1 —
  fix **not** in tree
- [Phase 6] `git merge-base --is-ancestor 378b2e956820ff HEAD`: buggy
  code **is** in tree
- [Phase 7] `CONFIG_IFCVF` exists in `drivers/vdpa/Kconfig:44-51`
- [Phase 8] Failure mode: `-ENOMEM` on rename, masked error / silent
  wrong name; severity MEDIUM

**YES**

 drivers/vdpa/ifcvf/ifcvf_main.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index 6658dc74d9150..56ed03dc918db 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -734,15 +734,22 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
 		ret = dev_set_name(&vdpa_dev->dev, "%s", name);
 	else
 		ret = dev_set_name(&vdpa_dev->dev, "vdpa%u", vdpa_dev->index);
+	if (ret) {
+		IFCVF_ERR(pdev, "Failed to set device name");
+		goto err;
+	}
 
 	ret = _vdpa_register_device(&adapter->vdpa, vf->nr_vring);
 	if (ret) {
-		put_device(&adapter->vdpa.dev);
 		IFCVF_ERR(pdev, "Failed to register to vDPA bus");
-		return ret;
+		goto err;
 	}
 
 	return 0;
+
+err:
+	put_device(&adapter->vdpa.dev);
+	return ret;
 }
 
 static void ifcvf_vdpa_dev_del(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 6.18-5.10] vsock: use sk_acceptq_is_full() helper in all transports
       [not found] <20260831133314.4125787-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.1] vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add() Sasha Levin
@ 2026-08-31 13:26 ` Sasha Levin
  4 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-08-31 13:26 UTC (permalink / raw)
  To: patches, stable
  Cc: Raf Dickson, Stefano Garzarella, Luigi Leonardi, Jakub Kicinski,
	Sasha Levin, kys, haiyangz, wei.liu, decui, longli, davem,
	edumazet, pabeni, bryan-bt.tan, vishnu.dasa, linux-hyperv,
	virtualization, netdev, linux-kernel

From: Raf Dickson <rafdog35@gmail.com>

[ Upstream commit 4ff2e84ff1b33d79fa0e3ae355ce4a334908ef9a ]

Replace the open-coded backlog check with sk_acceptq_is_full().
The helper uses > instead of >=, which is the correct comparison
per commit 64a146513f8f ("[NET]: Revert incorrect accept queue
backlog changes."), and adds READ_ONCE() for proper memory ordering.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Raf Dickson <rafdog35@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Link: https://patch.msgid.link/20260612045842.122207-1-rafdog35@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

The background searches finished and match what the earlier analysis
already showed:

- **Commit hash search** (`git log --grep="use sk_acceptq_is_full"`): no
  matches. That patch is not in this v6.18.44 tree yet; the buggy `>=`
  checks are still in `hyperv_transport.c` and `vmci_transport.c`.
- **Author search** (Raf Dickson): only one vsock commit here —
  `ba9ad6015937a` (`vsock/vmci: fix sk_ack_backlog leak on failed
  handshake`). Nothing for the `sk_acceptq_is_full()` change.

That supports the **YES** backport verdict: the bug is present locally,
the fix is not, and it should apply cleanly as a 2-line change.

 net/vmw_vsock/hyperv_transport.c | 2 +-
 net/vmw_vsock/vmci_transport.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index 4da752b47b116..54c7f51f9145d 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -323,7 +323,7 @@ static void hvs_open_connection(struct vmbus_channel *chan)
 		goto out;
 
 	if (conn_from_host) {
-		if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog)
+		if (sk_acceptq_is_full(sk))
 			goto out;
 
 		new = vsock_create_connected(sk);
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 75bf643ff6faf..4f02a6f269cdb 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -1002,7 +1002,7 @@ static int vmci_transport_recv_listen(struct sock *sk,
 	 * reset.  Otherwise we create and initialize a child socket and reply
 	 * with a connection negotiation.
 	 */
-	if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) {
+	if (sk_acceptq_is_full(sk)) {
 		vmci_transport_reply_reset(pkt);
 		return -ECONNREFUSED;
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-31 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] virtio-fs: avoid double-free on failed queue setup Sasha Levin
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] vdpa/octeon_ep: Use 4 bytes for mailbox signature Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] vhost-scsi: flush backend after device ioctls Sasha Levin
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.1] vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add() Sasha Levin
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] vsock: use sk_acceptq_is_full() helper in all transports Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox