CVE-2025-22083: vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint

Published Apr 16, 2025
·
Updated

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

vhost-scsi: Fix handling of multiple calls to vhostscsisetendpoint

If vhostscsisetendpoint is called multiple times without a vhostscsiclearendpoint 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 vhostscsisetendpoint is called more than once and calls after the first call do not find any tpgs to add to the vstpg. When vhostscsisetendpoint first finds tpgs to add to the vstpg array match=true, so we will do:

vhostvqsetbackend(vq, vstpg); ...

kfree(vs->vstpg); vs->vstpg = vstpg;

If vhostscsisetendpoint is called again and no tpgs are found match=false so we skip the vhostvqsetbackend call leaving the pointer to the vstpg we then free via:

kfree(vs->vstpg); vs->vstpg = vstpg;

If a scsi request is then sent we do:

vhostscsihandlevq -> vhostscsigetreq -> vhostvqgetbackend

which sees the vstpg 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 vhostscsisetendpoint detects a tpg is already in the vs->vstpg array or if the tpg has been removed so targetdependitem fails, the undepend goto handler will do targetundependitem on all tpgs in the vstpg array dropping their refcount to 0. At this time vstpg contains both the tpgs we have added in the current vhostscsisetendpoint call as well as tpgs we added in previous calls which are also in vs->vstpg.

Later, when vhostscsiclearendpoint runs it will do targetundependitem on all the tpgs in the vs->vstpg 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 vhostscsisetendpoint is called multiple times but with different target names.

The bug occurs if a user has called VHOSTSCSISETENDPOINT and setup a vhost-scsi device to target/tpg mapping, then calls VHOSTSCSISETENDPOINT 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->vstpg array. Later when we do vhostscsiclearendpoint, 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->vstpg. We will then return from the function without doing targetundependitem on the tpgs.

Because of all these bugs, it looks like being able to call vhostscsisetendpoint 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 vhostscsisetendpoint 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 vhostscsiclearendpoint first.

Affected Software

10 affected componentsFixes available
Linux Linux kernel
Linux Linux kernel>=3.9.1<6.6.87
Linux Linux kernel>=6.7<6.12.23
Linux Linux kernel>=6.13<6.13.11
Linux Linux kernel>=6.14<6.14.2
Linux Linux kernel=3.9
Linux Linux kernel=3.9-rc7
Linux Linux kernel=3.9-rc8
Microsoft azl3 kernel 6.6.85.1-4
Microsoft azl3 kernel 6.6.92.2-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Linux kernel vhost-scsi to a version that resolves this vulnerability.

    Patch vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint
  2. Configuration

    The material states the vulnerability is triggered by multiple calls to vhost_scsi_set_endpoint without the right teardown; ensure you call vhost_scsi_clear_endpoint (between endpoint changes) so you don't hit the multiple-call bugs (tpg dir removal hang / tpg leak / use-after-free / un-removable target).

    vhost-scsi endpoint handling vhost_scsi_set_endpoint = Call vhost_scsi_clear_endpoint before changing endpoint target/tpg configuration when vhost_scsi_set_endpoint would otherwise be called multiple times

Event History

Apr 16, 2025
CVE Published
via MITRE·02:12 PM
Data Sourced
via MITRE·02:12 PM
DescriptionSeverity
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 11, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
SeverityAffected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-22083?

CVE-2025-22083 is classified with a high severity due to potential exploitation risks in the Linux kernel.

2

How do I fix CVE-2025-22083?

To fix CVE-2025-22083, update your Linux kernel to the latest stable version where this vulnerability has been resolved.

3

What systems are affected by CVE-2025-22083?

CVE-2025-22083 affects various versions of the Linux kernel that utilize the vhost-scsi component.

4

What are the risks associated with CVE-2025-22083?

Exploitation of CVE-2025-22083 could lead to system crashes or corruption when multiple endpoint calls are mishandled.

5

Is CVE-2025-22083 being actively exploited?

As of current reports, there is no confirmed active exploitation of CVE-2025-22083 in the wild.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203