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
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.