{"id":15102,"date":"2026-09-04T19:02:25","date_gmt":"2026-09-04T11:02:25","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-64142"},"modified":"2026-09-04T19:02:25","modified_gmt":"2026-09-04T11:02:25","slug":"cve-2026-64142","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-64142","title":{"rendered":"CVE-2026-64142 [CRITICAL] &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: close durable"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>ksmbd: close durable scavenger races against m_fp_list lookups<\/p>\n<p>ksmbd_durable_scavenger() has two related races against any walker<br \/>\nthat iterates f_ci-&gt;m_fp_list, including ksmbd_lookup_fd_inode()<br \/>\n(used by ksmbd_vfs_rename) and the share-mode checks in<br \/>\nfs\/smb\/server\/smb_common.c.<\/p>\n<p>(1) fp-&gt;node list-head reuse.  Durable-preserved handles can remain<br \/>\nlinked on f_ci-&gt;m_fp_list after session teardown so share-mode checks<br \/>\nstill see them while the handle is reconnectable.  The scavenger<br \/>\ncollected expired handles by adding fp-&gt;node to a local<br \/>\nscavenger_list after removing them from the global durable idr.<br \/>\nBecause fp-&gt;node is the same list_head used by m_fp_list,<br \/>\nlist_add(&amp;fp-&gt;node, &amp;scavenger_list) overwrites the m_fp_list links<br \/>\nand corrupts both lists.  CONFIG_DEBUG_LIST can report this on the<br \/>\nshare-mode walk path.<\/p>\n<p>(2) Refcount race against m_fp_list walkers.  The scavenger qualifies<br \/>\nan expired durable handle with atomic_read(&amp;fp-&gt;refcount) &gt; 1 and<br \/>\nfp-&gt;conn under global_ft.lock, removes fp from global_ft, then drops<br \/>\nglobal_ft.lock before unlinking fp from m_fp_list and freeing it.<br \/>\nDuring that gap fp is still linked on m_fp_list with f_state ==<br \/>\nFP_INITED.  ksmbd_lookup_fd_inode() under m_lock read calls<br \/>\nksmbd_fp_get() (atomic_inc_not_zero on refcount that is still 1) and<br \/>\ntakes a live reference; the scavenger then unlinks and frees fp<br \/>\nwhile the holder owns a reference, leading to UAF on the holder&#8217;s<br \/>\nsubsequent ksmbd_fd_put() and on any field reads performed by a<br \/>\nconcurrent share-mode walker that iterates m_fp_list without taking<br \/>\nksmbd_fp_get() (smb_check_perm_dleases-like paths).<\/p>\n<p>Fix both:<\/p>\n<p>  * Stop reusing fp-&gt;node as a scavenger-private list node.  Remove<br \/>\n    one expired handle from global_ft under global_ft.lock, take an<br \/>\n    explicit transient reference, drop the lock, unlink fp-&gt;node<br \/>\n    from m_fp_list under f_ci-&gt;m_lock, then drop both the durable<br \/>\n    lifetime and transient references with atomic_sub_and_test(2,<br \/>\n    &amp;fp-&gt;refcount).  If the scavenger is the last putter the close<br \/>\n    runs there; otherwise an in-flight holder that already raced<br \/>\n    through the m_fp_list lookup owns the final close via its<br \/>\n    ksmbd_fd_put() path.  The one-at-a-time disposal can rescan the<br \/>\n    durable idr when multiple handles expire in the same pass, but<br \/>\n    durable scavenging is a background expiration path and the final<br \/>\n    full scan recomputes min_timeout before the next wait.<\/p>\n<p>  * Clear fp-&gt;persistent_id inside __ksmbd_remove_durable_fd() right<br \/>\n    after idr_remove(), so a delayed final close from a holder that<br \/>\n    snatched fp does not re-issue idr_remove() on a persistent id<br \/>\n    that idr_alloc_cyclic() in ksmbd_open_durable_fd() may have<br \/>\n    already handed out to a brand-new durable handle.<\/p>\n<p>  * Bypass the per-conn open_files_count decrement in<br \/>\n    __put_fd_final() when fp is detached from any session table<br \/>\n    (fp-&gt;conn cleared by session_fd_check() at durable preserve &#8212;<br \/>\n    paired with the volatile_id clear at unpublish, so checking<br \/>\n    fp-&gt;conn alone is sufficient).  The walker that owns the final<br \/>\n    close runs from an unrelated work-&gt;conn whose<br \/>\n    stats.open_files_count never tracked this durable fp; without<br \/>\n    this guard the holder would underflow that unrelated counter.<\/p>\n<p>The two races are folded into one patch because patch (1) alone<br \/>\ncleans up the corrupted list but leaves a deterministic UAF window<br \/>\nfor m_fp_list walkers that the transient-reference and<br \/>\npersistent_id discipline in (2) close; bisecting onto an<br \/>\nintermediate state would land on a UAF that pre-patch chaos merely<br \/>\nmade less reproducible.<\/p>\n<p>Validation:<br \/>\n  * CONFIG_DEBUG_LIST coverage for the list_head reuse path.<br \/>\n  * KASAN-enabled direct SMB2 durable-handle coverage that exercised<br \/>\n    ksmbd_durable_scavenger() and non-NULL ksmbd_lookup_fd_inode()<br \/>\n    returns while durable handles expired under concurrent rename<br \/>\n    lookups, with no KASAN, UAF, list-corruption, ODEBUG, or WARNING<br \/>\n    reports.<br \/>\n&#8212;truncated&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>ksmbd: close durable scavenger races against m_fp_list lookups<\/p>\n<p>ksmbd_durable_scavenger() has two related races against any walker<\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-15102","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/15102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/vuln"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}