UBUNTU-CVE-2026-89788: Use After Free
In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix tree connection use-after-free in smb2treeconnect() ksmbdtreeconnconnect() publishes a new tree connection in sess->treeconns with a single reference and returns its pointer to smb2treeconnect(). The handler continues to initialize the object and build the response after publication. A concurrent session logoff can erase the connection and drop that reference, freeing the object while the handler still uses it. BUG: KASAN: slab-use-after-free in smb2treeconnect+0xe3d/0xf90 smb2treeconnect (fs/smb/server/smb2pdu.c:2872) handleksmbdwork processonework workerthread kthread After xastore() succeeds, take a second reference before releasing treeconnslock. The original reference belongs to the xarray entry and the second belongs to the creating smb2treeconnect() handler. Keep the references balanced in every path: - On normal exit or an error after publication, smb2treeconnect() drops its creator reference. Error cleanup also calls ksmbdtreeconndisconnect(), which drops the xarray reference only if it removes the exact entry. - SMB2 TREEDISCONNECT uses the same helper to remove the entry and drop its xarray reference. The request's existing lookup reference remains owned by the request and is released by the existing cleanup. - Session LOGOFF removes each entry and drops its xarray reference. If it wins the race, later cleanup sees that the entry is gone and does not drop that reference again. To enforce this ownership, claim the disconnected state and erase the exact entry atomically under treeconnslock. This guarantees one drop for the xarray reference and one drop by each in-flight user, regardless of which teardown path wins. If logoff removes the entry before initialization completes, fail the connect instead of marking the detached object TREECONNECTED.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
ubuntu/linux-hwe-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-42.42~24.04.1 - Upgrade
Upgrade
ubuntu/linux-riscv-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-42.42.1~24.04.1 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 7.0.0-42.42 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 7.0.0-1016.17 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 7.0.0-1016.18 - Upgrade
Upgrade
ubuntu/linux-ibmto a version that resolves this vulnerability.Fixed in 7.0.0-1017.17 - Upgrade
Upgrade
ubuntu/linux-oem-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1017.17 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 7.0.0-1015.16 - Upgrade
Upgrade
ubuntu/linux-riscvto a version that resolves this vulnerability.Fixed in 7.0.0-42.42.1
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
Systems running an affected Ubuntu kernel are exposed when the ksmbd SMB server is in use. The affected package list includes Ubuntu linux, linux-realtime, linux-azure, linux-gcp, linux-azure-fde, linux-gke, linux-riscv, and linux-gkeop kernels.
What does an attacker need to trigger the flaw?
The attacker needs network access and low-privileged access, and exploitation depends on a race between SMB tree connection handling and a concurrent session logoff. No user interaction is required.
What is the security impact if exploitation succeeds?
The flaw is a use-after-free in SMB2 tree connection handling. The supplied severity vector indicates high impact to confidentiality, integrity, and availability of the vulnerable system.