CVE-2026-99156: scsi: st: Fix use-after-free race between st_remove() and st_open()
In the Linux kernel, the following vulnerability has been resolved:
scsi: st: Fix use-after-free race between stremove() and stopen()
stremove() drops the probe reference on the scsitape with krefput() and only afterwards removes its index from stindexidr. If that was the last reference, scsitaperelease() frees the structure while it is still published in the idr.
scsitapeget(), called from stopen(), looks up the tape in stindexidr and takes a reference under strefmutex and stindexlock. removecdevs() does not wait for opens that are already past chrdevopen(), so an open that is blocked on strefmutex while stremove() holds it can take the mutex as soon as stremove() drops it, find the freed tpnt in the idr and call krefget() on it:
BUG: KASAN: slab-use-after-free in stopen Write of size 4 ... stopen (drivers/scsi/st.c:254 drivers/scsi/st.c:1291) chrdevopen ... Freed by task ...: kfree stremove (drivers/scsi/st.c:4512)
Remove the index from the idr before dropping the reference, all under strefmutex. A concurrent scsitapeget() now either runs first and holds a valid reference that keeps the tape alive, or runs afterwards and finds nothing, so stopen() fails with -ENXIO.
This restores the ordering stremove() had before the conversion to stindexidr, where the tape was unpublished from scsitapes[] before the final krefput().
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
azurelinux/kernelto a version that resolves this vulnerability.Fixed in 6.6.161.1-1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.273 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.224 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.191 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.161 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.115 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.59 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.2.13 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.192-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.115-2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.2.13-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.115-2~deb12u1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.192-2Fixed in 6.12.117-1Fixed in 7.2.15-1Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.117-1~deb12u1 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 7.3.0-10.10 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-azureto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-azure-fdeto a version that resolves this vulnerability.Fixed in 7.3.0-1004.5 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-raspito a version that resolves this vulnerability.Fixed in 7.3.0-1004.4 - Upgrade
Upgrade
ubuntu/linux-realtimeto a version that resolves this vulnerability.Fixed in 7.3.0-10.10.1 - Upgrade
Upgrade
ubuntu/linux-riscvto a version that resolves this vulnerability.Fixed in 7.3.0-10.10.1
Event History
Frequently Asked Questions
Which systems are exposed to this race?
Linux systems using the SCSI tape driver are exposed when a tape device can be removed while another process is opening it. The affected path involves st_remove() and st_open() operating concurrently on the same scsi_tape object.
What evidence indicates the race may already have occurred?
The reported failure is a KASAN slab-use-after-free in st_open(), caused by kref_get() operating on a freed scsi_tape structure. A trace may show st_open and chrdev_open in the access path, with the object freed through kfree from st_remove().
What does the fix change to prevent exploitation?
The fix removes the tape index from st_index_idr before dropping the probe reference, while holding st_ref_mutex. A concurrent open then either obtains a valid reference before removal or finds no tape entry after removal.