CVE-2026-99525: smb: client: fix use-after-free in cifs_ses_add_channel()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix use-after-free in cifs_ses_add_channel()
The error path of cifs_ses_add_channel() calls cifs_put_tcp_session() before cifs_chan_clear_need_reconnect(). The latter reaches cifs_ses_get_chan_index(), which dereferences server->terminate; if the put was the final reference, TCP_Server_Info is already freed and this is a use-after-free. Same put-then-use pattern as the recently fixed sibling in commit 717e0a25036b ("cifs: Fix server use-after-free in cifs_chan_skip_or_disable()").
Move the put last, but do not read chan->server after droppingchan_lock: chan points into ses->chans[], and once chan_count is decremented a concurrent add_channel can reuse the slot and overwrite the pointer, so the put would act on the new channel's server. Cache the pointer under chan_lock, clear the reconnect bit and decrement chan_count while still holding the reference, and release it after the unlock.
This issue was discovered by Tencent CodeBuddy Security.
The Linux kernel CVE team has assigned CVE-2026-99525 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.7 with commit ee1d21794e55ab76505745d24101331552182002 and fixed in 6.12.117 with commit d88e3e844fad0f6b9fbeb8c8862f9272a7c26a99 Issue introduced in 6.7 with commit ee1d21794e55ab76505745d24101331552182002 and fixed in 6.18.61 with commit 8069935474b1502459ab50f75a67d7394a93cd5d Issue introduced in 6.7 with commit ee1d21794e55ab76505745d24101331552182002 and fixed in 7.3.2 with commit 72367dacb5c9d8bd486b2fcaf56b6d3086d57250 Issue introduced in 6.7 with commit ee1d21794e55ab76505745d24101331552182002 and fixed in 7.4-rc1 with commit 031278577380e7875d95aed81a2b2bcac39be923 Issue introduced in 6.1.178 with commit e341b7975bd72d3ebda92b8d747d0aad15ce8717 Issue introduced in 6.6.15 with commit 3e1615361b6fa6e6e0bfae0efb3a8c2255ac101f
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-99525
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/smb/client/sess.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/d88e3e844fad0f6b9fbeb8c8862f9272a7c26a99 https://git.kernel.org/stable/c/8069935474b1502459ab50f75a67d7394a93cd5d https://git.kernel.org/stable/c/72367dacb5c9d8bd486b2fcaf56b6d3086d57250 https://git.kernel.org/stable/c/031278577380e7875d95aed81a2b2bcac39be923