CVE-2025-22083
vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint
Check your servers for CVE-2025-22083
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-22083 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.26%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 19.3% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 4beb02b7abd78af8c5aee9dd32722ccb1c3011e3 affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before c8c895a4b74f74b1041879a1305b1bcf2941ef43 affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 451c72f5e7cf5d339a6410a635cee0825687c3dc affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 2b34bdc42df047794542f3e220fe989124e4499a affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 3a19eb3d9818e28f14c818a18dc913344a52ca92 affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 3fd054baf382a426bbf5135ede0fc5673db74d3e affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c affected from 4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3, before 5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6
Other versions: unaffected
|
| Linux |
affected 3.9 unaffected before 3.9 unaffected from 5.10.276 up to and including 5.10.* unaffected from 5.15.227 up to and including 5.15.* unaffected from 6.1.162 up to and including 6.1.* unaffected from 6.6.87 up to and including 6.6.* unaffected from 6.12.23 up to and including 6.12.* unaffected from 6.13.11 up to and including 6.13.* unaffected from 6.14.2 up to and including 6.14.* unaffected 6.15 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-22083 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-22083
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-22083
trivy image --scanners vuln IMAGE | grep CVE-2025-22083
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/4beb02b7abd78af8c5aee9dd32722ccb1c3011e3 git.kernel.org
- https://git.kernel.org/stable/c/c8c895a4b74f74b1041879a1305b1bcf2941ef43 git.kernel.org
- https://git.kernel.org/stable/c/451c72f5e7cf5d339a6410a635cee0825687c3dc git.kernel.org
- https://git.kernel.org/stable/c/2b34bdc42df047794542f3e220fe989124e4499a git.kernel.org
- https://git.kernel.org/stable/c/3a19eb3d9818e28f14c818a18dc913344a52ca92 git.kernel.org
- https://git.kernel.org/stable/c/3fd054baf382a426bbf5135ede0fc5673db74d3e git.kernel.org
- https://git.kernel.org/stable/c/63b449f73ab0dcc0ba11ceaa4c5c70bc86ccf03c git.kernel.org
- https://git.kernel.org/stable/c/5dd639a1646ef5fe8f4bf270fad47c5c3755b9b6 git.kernel.org
- https://cert-portal.siemens.com/productcert/html/ssa-019113.html cert-portal.siemens.com
- https://cert-portal.siemens.com/productcert/html/ssa-457936.html cert-portal.siemens.com
Source: the record CVE-2025-22083 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse