CVE-2026-89641: cifs: clear tcon after cifsFileInfo_put() in cifs_file_set_size()
In the Linux kernel, the following vulnerability has been resolved:
cifs: clear tcon after cifsFileInfoput() in cifsfilesetsize()
When the else branch of cifsfilesetsize() finds a writable file handle via findwritablefile(), it borrows tcon and server from the handle's tlink, attempts the handle-based setfilesize() RPC, and then releases the handle with cifsFileInfoput().
If setfilesize() fails, execution falls through to the path-based fallback, which reuses the borrowed tcon and server under the "if (tcon == NULL)" guard. Since tcon is not NULL at that point, the guard is skipped. If cifsFileInfoput() dropped the last reference on a tlink that was already removed from the tlink tree (TCONLINKINTREE cleared, as happens during reconnection or session teardown), cifsputtlink() will have freed tcon; the subsequent setpathsize() call is then a use-after-free.
Setting tcon = NULL after cifsFileInfoput() causes the existing guard to take the cifssbtlink() path, which acquires a fresh reference for the path-based operation or fails cleanly if the session is gone.
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 - Compensating control
In cifs_file_set_size(), set tcon = NULL immediately after cifsFileInfo_put() so the existing if (tcon == NULL) guard takes the cifs_sb_tlink() path and acquires a fresh reference before the path-based operation.
Event History
Frequently Asked Questions
What conditions are required for the use-after-free to occur?
A writable CIFS file handle must be found, the handle-based set_file_size() RPC must fail, and releasing that handle must drop the last reference to a tlink that has already been removed during reconnection or session teardown. The subsequent path-based size update can then reuse a freed tcon.
Which systems are most exposed to this race?
Systems using the Linux kernel CIFS client are exposed when they perform file-size changes through writable handles while CIFS reconnection or session teardown is occurring. The failure path of the handle-based size-setting RPC is also required.
What does the resolved change do to prevent the issue?
It clears tcon after cifsFileInfo_put(), forcing the path-based fallback to acquire a fresh tlink reference through cifs_sb_tlink(). If the session is no longer available, that fallback fails cleanly instead of using the released connection object.