# CVE-2025-22083: vhost-scsi: Fix handling of multiple calls to vhost\_scsi\_set\_endpoint

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.30% (percentile 15, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-04-16T14:12:32.291Z
- **Modified:** 2026-11-10T13:17:42.053Z

## Who should check

- Anyone running Linux \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 451c72f5e7cf5d339a6410a635cee0825687c3dc; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 2b34bdc42df047794542f3e220fe989124e4499a; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3a19eb3d9818e28f14c818a18dc913344a52ca92; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3fd054baf382a426bbf5135ede0fc5673db74d3e; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6
- Anyone running Linux 3.9

## Description

In the Linux kernel, the following vulnerability has been resolved:

vhost-scsi: Fix handling of multiple calls to vhost\_scsi\_set\_endpoint

If vhost\_scsi\_set\_endpoint is called multiple times without a
vhost\_scsi\_clear\_endpoint between them, we can hit multiple bugs
found by Haoran Zhang:

1. Use-after-free when no tpgs are found:

This fixes a use after free that occurs when vhost\_scsi\_set\_endpoint is
called more than once and calls after the first call do not find any
tpgs to add to the vs\_tpg. When vhost\_scsi\_set\_endpoint first finds
tpgs to add to the vs\_tpg array match=true, so we will do:

vhost\_vq\_set\_backend(vq, vs\_tpg);
...

kfree(vs-\>vs\_tpg);
vs-\>vs\_tpg = vs\_tpg;

If vhost\_scsi\_set\_endpoint is called again and no tpgs are found
match=false so we skip the vhost\_vq\_set\_backend call leaving the
pointer to the vs\_tpg we then free via:

kfree(vs-\>vs\_tpg);
vs-\>vs\_tpg = vs\_tpg;

If a scsi request is then sent we do:

vhost\_scsi\_handle\_vq -\> vhost\_scsi\_get\_req -\> vhost\_vq\_get\_backend

which sees the vs\_tpg we just did a kfree on.

2. Tpg dir removal hang:

This patch fixes an issue where we cannot remove a LIO/target layer
tpg (and structs above it like the target) dir due to the refcount
dropping to -1.

The problem is that if vhost\_scsi\_set\_endpoint detects a tpg is already
in the vs-\>vs\_tpg array or if the tpg has been removed so
target\_depend\_item fails, the undepend goto handler will do
target\_undepend\_item on all tpgs in the vs\_tpg array dropping their
refcount to 0. At this time vs\_tpg contains both the tpgs we have added
in the current vhost\_scsi\_set\_endpoint call as well as tpgs we added in
previous calls which are also in vs-\>vs\_tpg.

Later, when vhost\_scsi\_clear\_endpoint runs it will do
target\_undepend\_item on all the tpgs in the vs-\>vs\_tpg which will drop
their refcount to -1. Userspace will then not be able to remove the tpg
and will hang when it tries to do rmdir on the tpg dir.

3. Tpg leak:

This fixes a bug where we can leak tpgs and cause them to be
un-removable because the target name is overwritten when
vhost\_scsi\_set\_endpoint is called multiple times but with different
target names.

The bug occurs if a user has called VHOST\_SCSI\_SET\_ENDPOINT and setup
a vhost-scsi device to target/tpg mapping, then calls
VHOST\_SCSI\_SET\_ENDPOINT again with a new target name that has tpgs we
haven't seen before (target1 has tpg1 but target2 has tpg2). When this
happens we don't teardown the old target tpg mapping and just overwrite
the target name and the vs-\>vs\_tpg array. Later when we do
vhost\_scsi\_clear\_endpoint, we are passed in either target1 or target2's
name and we will only match that target's tpgs when we loop over the
vs-\>vs\_tpg. We will then return from the function without doing
target\_undepend\_item on the tpgs.

Because of all these bugs, it looks like being able to call
vhost\_scsi\_set\_endpoint multiple times was never supported. The major
user, QEMU, already has checks to prevent this use case. So to fix the
issues, this patch prevents vhost\_scsi\_set\_endpoint from being called
if it's already successfully added tpgs. To add, remove or change the
tpg config or target name, you must do a vhost\_scsi\_clear\_endpoint
first.

## Affected and fixed versions

- Linux: \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 451c72f5e7cf5d339a6410a635cee0825687c3dc; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 2b34bdc42df047794542f3e220fe989124e4499a; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3a19eb3d9818e28f14c818a18dc913344a52ca92; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3fd054baf382a426bbf5135ede0fc5673db74d3e; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6 (cvelist)
- Linux: 3.9 (cvelist)

## Mitigation

- Upgrade Linux to 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-22083. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-22083.md
Affected: Linux >= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, < 451c72f5e7cf5d339a6410a635cee0825687c3dc; >= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, < 2b34bdc42df047794542f3e220fe989124e4499a; >= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, < 3a19eb3d9818e28f14c818a18dc913344a52ca92; >= 4f7f46d32c9875004fae1d5…
Fixed in: Linux 451c72f5e7cf5d339a6410a635cee0825687c3dc, Linux 2b34bdc42df047794542f3e220fe989124e4499a, Linux 3a19eb3d9818e28f14c818a18dc913344a52ca92, Linux 3fd054baf382a426bbf5135ede0fc5673db74d3e, Linux 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c, Linux 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-22083 being exploited?

There is no confirmed exploitation: CVE-2025-22083 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.30% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-22083?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-22083?

Linux \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 451c72f5e7cf5d339a6410a635cee0825687c3dc; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 2b34bdc42df047794542f3e220fe989124e4499a; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3a19eb3d9818e28f14c818a18dc913344a52ca92; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 3fd054baf382a426bbf5135ede0fc5673db74d3e; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c; \>= 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, \< 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6; Linux 3.9.

### Is there a fix for CVE-2025-22083?

Yes. Fixed in Linux 451c72f5e7cf5d339a6410a635cee0825687c3dc, Linux 2b34bdc42df047794542f3e220fe989124e4499a, Linux 3a19eb3d9818e28f14c818a18dc913344a52ca92, Linux 3fd054baf382a426bbf5135ede0fc5673db74d3e, Linux 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c, Linux 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6. Upgrade Linux to 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6 or later.

### How do I check if I'm affected by CVE-2025-22083?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/451c72f5e7cf5d339a6410a635cee0825687c3dc>
- patch: <https://git.kernel.org/stable/c/2b34bdc42df047794542f3e220fe989124e4499a>
- patch: <https://git.kernel.org/stable/c/3a19eb3d9818e28f14c818a18dc913344a52ca92>
- patch: <https://git.kernel.org/stable/c/3fd054baf382a426bbf5135ede0fc5673db74d3e>
- patch: <https://git.kernel.org/stable/c/63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c>
- patch: <https://git.kernel.org/stable/c/5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-019113.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-457936.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-22083>

HTML: <https://flawdb.com/CVE-2025-22083> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-22083>
