CVE-2025-22083: vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint
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.
Security readout for executives and security teams
Plain-English summary
A local, low-privileged user may trigger serious Linux kernel failures when a vhost-scsi endpoint is configured repeatedly without first being cleared. The flaws include use-after-free, reference-count corruption causing administrative hangs, and leaked target mappings. Successful abuse could affect confidentiality, integrity, and availability, although the supplied sources provide no evidence of active exploitation.
Executive priority
Prioritize affected virtualization, storage, and appliance hosts where untrusted local users or custom vhost-scsi management exist. Patch during the next expedited maintenance window. Treat externally unreachable systems as still potentially exposed because the attack vector is local, while validating whether QEMU or another management layer blocks the triggering sequence.
Technical view
Repeated VHOST_SCSI_SET_ENDPOINT operations can leave a freed target portal group array referenced by a vhost queue, incorrectly decrement TPG reference counts, or lose dependencies after changing target names. The kernel fix rejects another endpoint-set operation after TPGs are successfully attached, requiring VHOST_SCSI_CLEAR_ENDPOINT before configuration is added, removed, or changed.
Likely exposure
Exposure requires Linux systems using vhost-scsi and a local user able to reach the relevant configuration interface. QEMU reportedly already prevents the unsupported repeated-set sequence, reducing exposure for that common path. The supplied affected-version data spans several kernel lines but is ambiguously encoded; confirm applicability through the kernel or system vendor.
Exploitation context
The CVSS 3.1 score is 7.8 with local access, low complexity, low privileges, and no user interaction. The bundle marks the CVE as absent from KEV and provides no cited evidence of active exploitation or a public exploit. Exploitability outside custom or non-QEMU endpoint management is not established.
Researcher notes
The principal security primitive is a stale backend pointer after freeing vs_tpg when a subsequent endpoint-set finds no TPGs. Separate error paths can underflow TPG references or leak dependencies. The source states repeated setting was never supported. No CWE assignment, reproducible proof, or exploitation telemetry is supplied, and the version representation requires vendor-level confirmation.
Mitigation direction
Install a vendor-supported kernel containing the applicable stable fix.
Check Linux distribution or appliance-vendor guidance for affected and corrected package versions.
Ensure endpoint management clears an existing vhost-scsi endpoint before setting or changing it.
Restrict access to vhost-scsi configuration interfaces to trusted administrators where operationally feasible.
Validation and detection
Inventory Linux kernel versions on systems using vhost-scsi.
Confirm whether vhost-scsi endpoint configuration is enabled or exercised.
Review management software for repeated endpoint-set operations without an intervening clear.
Verify the installed kernel includes the applicable upstream stable correction.
Test endpoint set, clear, and reconfiguration cycles safely in staging after updating.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2025-22083 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
8Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.