CVE-2025-40285: smb/server: fix possible refcount leak in smb2_sess_setup()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
smb/server: fix possible refcount leak in smb2_sess_setup()
Reference count of ksmbd_session will leak when session need reconnect. Fix this by adding the missing ksmbd_user_session_put().
The Linux kernel CVE team has assigned CVE-2025-40285 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.159 with commit 6fc935f798d44a8eb8a5e6659198399fbf57b981 Fixed in 6.6.117 with commit e671f9bb97805771380c98de944e2ceab6949188 Fixed in 6.12.59 with commit dcc51dfe6ff26b52cac106865a172ac982d78401 Fixed in 6.17.9 with commit d37b2c81c83d6c0d5ca582f4fe73c672983f9e0d Fixed in 6.18 with commit 379510a815cb2e64eb0a379cb62295d6ade65df0
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-2025-40285
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/server/smb2pdu.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/6fc935f798d44a8eb8a5e6659198399fbf57b981 https://git.kernel.org/stable/c/e671f9bb97805771380c98de944e2ceab6949188 https://git.kernel.org/stable/c/dcc51dfe6ff26b52cac106865a172ac982d78401 https://git.kernel.org/stable/c/d37b2c81c83d6c0d5ca582f4fe73c672983f9e0d https://git.kernel.org/stable/c/379510a815cb2e64eb0a379cb62295d6ade65df0