<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs, branch v7.1-rc7</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Merge tag 'vfs-7.1-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs</title>
<updated>2026-06-06T14:28:59+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-06-06T14:28:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=76351effa53d49114907dc9fd228110c2115292b'/>
<id>76351effa53d49114907dc9fd228110c2115292b</id>
<content type='text'>
Pull vfs fixes from Christian Brauner:

 - Fix error handling in ovl_cache_get()

 - Tighten access checks for exited tasks in pidfd_getfd()

 - Fix selftests leak in __wait_for_test()

 - Limit FUSE_NOTIFY_RETRIEVE to uptodate folios

 - Reject fuse_notify() pagecache ops on directories

 - Clear JOBCTL_PENDING_MASK for caller in zap_other_threads()

 - Fix failure to unlock in nfsd4_create_file()

 - Fix pointer arithmetic in qnx6 directory iteration

 - Fix UAF due to unlocked -&gt;mnt_ns read in may_decode_fh()

 - Avoid potential null folio-&gt;mapping deref during iomap error
   reporting

* tag 'vfs-7.1-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  iomap: avoid potential null folio-&gt;mapping deref during error reporting
  fhandle: fix UAF due to unlocked -&gt;mnt_ns read in may_decode_fh()
  fs/qnx6: fix pointer arithmetic in directory iteration
  VFS: fix possible failure to unlock in nfsd4_create_file()
  signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
  fuse: reject fuse_notify() pagecache ops on directories
  fuse: limit FUSE_NOTIFY_RETRIEVE to uptodate folios
  selftests: harness: fix pidfd leak in __wait_for_test
  pidfd: refuse access to tasks that have started exiting harder
  ovl: keep err zero after successful ovl_cache_get()
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull vfs fixes from Christian Brauner:

 - Fix error handling in ovl_cache_get()

 - Tighten access checks for exited tasks in pidfd_getfd()

 - Fix selftests leak in __wait_for_test()

 - Limit FUSE_NOTIFY_RETRIEVE to uptodate folios

 - Reject fuse_notify() pagecache ops on directories

 - Clear JOBCTL_PENDING_MASK for caller in zap_other_threads()

 - Fix failure to unlock in nfsd4_create_file()

 - Fix pointer arithmetic in qnx6 directory iteration

 - Fix UAF due to unlocked -&gt;mnt_ns read in may_decode_fh()

 - Avoid potential null folio-&gt;mapping deref during iomap error
   reporting

* tag 'vfs-7.1-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  iomap: avoid potential null folio-&gt;mapping deref during error reporting
  fhandle: fix UAF due to unlocked -&gt;mnt_ns read in may_decode_fh()
  fs/qnx6: fix pointer arithmetic in directory iteration
  VFS: fix possible failure to unlock in nfsd4_create_file()
  signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
  fuse: reject fuse_notify() pagecache ops on directories
  fuse: limit FUSE_NOTIFY_RETRIEVE to uptodate folios
  selftests: harness: fix pidfd leak in __wait_for_test
  pidfd: refuse access to tasks that have started exiting harder
  ovl: keep err zero after successful ovl_cache_get()
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'nfs-for-7.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs</title>
<updated>2026-06-05T16:34:14+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-06-05T16:34:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a8dc5f60d127f1d147a8e778563fcef7715d1316'/>
<id>a8dc5f60d127f1d147a8e778563fcef7715d1316</id>
<content type='text'>
Pull NFS client fix from Trond Myklebust:

 - Fix a use after free in nfs_write_completion

* tag 'nfs-for-7.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFS: write_completion: dereference loop-local req, not hdr-&gt;req
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull NFS client fix from Trond Myklebust:

 - Fix a use after free in nfs_write_completion

* tag 'nfs-for-7.1-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFS: write_completion: dereference loop-local req, not hdr-&gt;req
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'xfs-fixes-7.1-rc7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux</title>
<updated>2026-06-05T15:34:32+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-06-05T15:34:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6a5358410af387fd48251a5e5cc4cf73dc16de52'/>
<id>6a5358410af387fd48251a5e5cc4cf73dc16de52</id>
<content type='text'>
Pull xfs fixes from Carlos Maiolino:
 "A collection of fixes mostly for the RT device, including a small
  refactor that has no functional change"

* tag 'xfs-fixes-7.1-rc7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: Remove mention of PageWriteback
  xfs: abort mount if xfs_fs_reserve_ag_blocks fails
  xfs: factor rtgroup geom write pointer reporting into a helper
  xfs: drop the RTG reference later in xfs_ioc_rtgroup_geometry
  xfs: fix rtgroup cleanup in CoW fork repair
  xfs: fix error returns in CoW fork repair
  xfs: fix overlapping extents returned for pNFS LAYOUTGET
  xfs: fix use of uninitialized imap in xfs_fs_map_blocks error path
  xfs: handle racing deletions in xfs_zone_gc_iter_irec
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull xfs fixes from Carlos Maiolino:
 "A collection of fixes mostly for the RT device, including a small
  refactor that has no functional change"

* tag 'xfs-fixes-7.1-rc7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: Remove mention of PageWriteback
  xfs: abort mount if xfs_fs_reserve_ag_blocks fails
  xfs: factor rtgroup geom write pointer reporting into a helper
  xfs: drop the RTG reference later in xfs_ioc_rtgroup_geometry
  xfs: fix rtgroup cleanup in CoW fork repair
  xfs: fix error returns in CoW fork repair
  xfs: fix overlapping extents returned for pNFS LAYOUTGET
  xfs: fix use of uninitialized imap in xfs_fs_map_blocks error path
  xfs: handle racing deletions in xfs_zone_gc_iter_irec
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'erofs-for-7.1-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs</title>
<updated>2026-06-05T15:28:10+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-06-05T15:28:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2b389a573b76f4e3e1e17654eeaced3eb48c2972'/>
<id>2b389a573b76f4e3e1e17654eeaced3eb48c2972</id>
<content type='text'>
Pull erofs fixes from Gao Xiang:

 - Fix a UAF of sbi-&gt;sync_decompress when compressed I/Os
   race with unmount

 - Fix a regression introduced this development cycle that
   incorrectly rejects multiple-algorithm images

* tag 'erofs-for-7.1-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: fix EFSCORRUPTED on multi-algorithm images in z_erofs_map_sanity_check()
  erofs: fix use-after-free on sbi-&gt;sync_decompress
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull erofs fixes from Gao Xiang:

 - Fix a UAF of sbi-&gt;sync_decompress when compressed I/Os
   race with unmount

 - Fix a regression introduced this development cycle that
   incorrectly rejects multiple-algorithm images

* tag 'erofs-for-7.1-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: fix EFSCORRUPTED on multi-algorithm images in z_erofs_map_sanity_check()
  erofs: fix use-after-free on sbi-&gt;sync_decompress
</pre>
</div>
</content>
</entry>
<entry>
<title>iomap: avoid potential null folio-&gt;mapping deref during error reporting</title>
<updated>2026-06-04T08:02:56+00:00</updated>
<author>
<name>Joanne Koong</name>
<email>joannelkoong@gmail.com</email>
</author>
<published>2026-06-04T01:18:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2eea7f44b9c8b42fd7d3a1a87c06a7cd1b99c327'/>
<id>2eea7f44b9c8b42fd7d3a1a87c06a7cd1b99c327</id>
<content type='text'>
When a buffered read fails, iomap_finish_folio_read() reports the error
with fserror_report_io(folio-&gt;mapping-&gt;host, ...). This is called after
ifs-&gt;read_bytes_pending has been decremented by the bytes attempted to
be read.

For a folio split across multiple read completions, the folio is only
guaranteed to stay locked while read_bytes_pending &gt; 0. Once
iomap_finish_folio_read() decrements read_bytes_pending, another
in-flight read can complete and end the read on the folio, which unlocks
it. This allows truncate logic to run and detach the folio (set
folio-&gt;mapping to NULL). The error reporting path then can dereference a
NULL folio-&gt;mapping. As reported by Sam Sun, this is the race that can
occur:

CPU0: failed completion      CPU1: final completion     CPU2: truncate
-----------------------      ----------------------     --------------
read_bytes_pending -= len
finished = false
/* preempted before
   fserror_report_io() */
			     read_bytes_pending -= len
			     finished = true
			     folio_end_read()
							truncate clears
							folio-&gt;mapping
fserror_report_io(
  folio-&gt;mapping-&gt;host, ...)
	      ^ NULL deref

Fix this by reporting the error first before decrementing
ifs-&gt;read_bytes_pending.

Fixes: a9d573ee88af ("iomap: report file I/O errors to the VFS")
Cc: stable@vger.kernel.org
Reported-by: Sam Sun &lt;samsun1006219@gmail.com&gt;
Closes: https://lore.kernel.org/linux-fsdevel/CAEkJfYPhWdd59RKmuNLJg-bkypHz7xiOwaWyNVu3A8CUqQCnvg@mail.gmail.com/
Signed-off-by: Joanne Koong &lt;joannelkoong@gmail.com&gt;
Link: https://patch.msgid.link/20260604011858.2297561-1-joannelkoong@gmail.com
Reviewed-by: "Darrick J. Wong" &lt;djwong@kernel.org&gt;
Signed-off-by: Christian Brauner (Amutable) &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a buffered read fails, iomap_finish_folio_read() reports the error
with fserror_report_io(folio-&gt;mapping-&gt;host, ...). This is called after
ifs-&gt;read_bytes_pending has been decremented by the bytes attempted to
be read.

For a folio split across multiple read completions, the folio is only
guaranteed to stay locked while read_bytes_pending &gt; 0. Once
iomap_finish_folio_read() decrements read_bytes_pending, another
in-flight read can complete and end the read on the folio, which unlocks
it. This allows truncate logic to run and detach the folio (set
folio-&gt;mapping to NULL). The error reporting path then can dereference a
NULL folio-&gt;mapping. As reported by Sam Sun, this is the race that can
occur:

CPU0: failed completion      CPU1: final completion     CPU2: truncate
-----------------------      ----------------------     --------------
read_bytes_pending -= len
finished = false
/* preempted before
   fserror_report_io() */
			     read_bytes_pending -= len
			     finished = true
			     folio_end_read()
							truncate clears
							folio-&gt;mapping
fserror_report_io(
  folio-&gt;mapping-&gt;host, ...)
	      ^ NULL deref

Fix this by reporting the error first before decrementing
ifs-&gt;read_bytes_pending.

Fixes: a9d573ee88af ("iomap: report file I/O errors to the VFS")
Cc: stable@vger.kernel.org
Reported-by: Sam Sun &lt;samsun1006219@gmail.com&gt;
Closes: https://lore.kernel.org/linux-fsdevel/CAEkJfYPhWdd59RKmuNLJg-bkypHz7xiOwaWyNVu3A8CUqQCnvg@mail.gmail.com/
Signed-off-by: Joanne Koong &lt;joannelkoong@gmail.com&gt;
Link: https://patch.msgid.link/20260604011858.2297561-1-joannelkoong@gmail.com
Reviewed-by: "Darrick J. Wong" &lt;djwong@kernel.org&gt;
Signed-off-by: Christian Brauner (Amutable) &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fhandle: fix UAF due to unlocked -&gt;mnt_ns read in may_decode_fh()</title>
<updated>2026-06-04T07:39:50+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2026-06-03T19:31:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=40ab6644b99685755f740b872c00ef40d9aa870e'/>
<id>40ab6644b99685755f740b872c00ef40d9aa870e</id>
<content type='text'>
may_decode_fh() accesses mount::mnt_ns without holding any locks; that
means the mount can concurrently be unmounted, and the mnt_namespace can
concurrently be freed after an RCU grace period.

This race can happens as follows, assuming that the mount point was
created by open_tree(..., OPEN_TREE_CLONE):

thread 1            thread 2            RCU
                    __do_sys_open_by_handle_at
                      do_handle_open
                        handle_to_path
                          may_decode_fh
                            is_mounted
                              [mount::mnt_ns access]
                            [mount::mnt_ns access]
__do_sys_close
  fput_close_sync
    __fput
      dissolve_on_fput
        umount_tree
        class_namespace_excl_destructor
          namespace_unlock
            free_mnt_ns
              mnt_ns_tree_remove
                call_rcu(mnt_ns_release_rcu)
                                        mnt_ns_release_rcu
                                          mnt_ns_release
                                            kfree
                            [mnt_namespace::user_ns access] **UAF**

Fix it by taking rcu_read_lock() around the mount::mnt_ns access, like
in __prepend_path().
Additionally, document the semantics of mount::mnt_ns, and use WRITE_ONCE()
for writers that can race with lockless readers.

This bug is unreachable unless one of the following is set:

 - CONFIG_PREEMPTION
 - CONFIG_RCU_STRICT_GRACE_PERIOD

because it requires an RCU grace period to happen during a syscall without
an explicit preemption.

This doesn't seem to have interesting security impact; worst-case, it could
leak the result of an integer comparison to userspace (from the level
check in cap_capable()), cause an endless loop, or crash the kernel by
dereferencing an invalid address.

Fixes: 620c266f3949 ("fhandle: relax open_by_handle_at() permission checks")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Link: https://patch.msgid.link/20260603-vfs-fhandle-uaf-fix-v2-1-d05db76a5084@google.com
Signed-off-by: Christian Brauner (Amutable) &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
may_decode_fh() accesses mount::mnt_ns without holding any locks; that
means the mount can concurrently be unmounted, and the mnt_namespace can
concurrently be freed after an RCU grace period.

This race can happens as follows, assuming that the mount point was
created by open_tree(..., OPEN_TREE_CLONE):

thread 1            thread 2            RCU
                    __do_sys_open_by_handle_at
                      do_handle_open
                        handle_to_path
                          may_decode_fh
                            is_mounted
                              [mount::mnt_ns access]
                            [mount::mnt_ns access]
__do_sys_close
  fput_close_sync
    __fput
      dissolve_on_fput
        umount_tree
        class_namespace_excl_destructor
          namespace_unlock
            free_mnt_ns
              mnt_ns_tree_remove
                call_rcu(mnt_ns_release_rcu)
                                        mnt_ns_release_rcu
                                          mnt_ns_release
                                            kfree
                            [mnt_namespace::user_ns access] **UAF**

Fix it by taking rcu_read_lock() around the mount::mnt_ns access, like
in __prepend_path().
Additionally, document the semantics of mount::mnt_ns, and use WRITE_ONCE()
for writers that can race with lockless readers.

This bug is unreachable unless one of the following is set:

 - CONFIG_PREEMPTION
 - CONFIG_RCU_STRICT_GRACE_PERIOD

because it requires an RCU grace period to happen during a syscall without
an explicit preemption.

This doesn't seem to have interesting security impact; worst-case, it could
leak the result of an integer comparison to userspace (from the level
check in cap_capable()), cause an endless loop, or crash the kernel by
dereferencing an invalid address.

Fixes: 620c266f3949 ("fhandle: relax open_by_handle_at() permission checks")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Link: https://patch.msgid.link/20260603-vfs-fhandle-uaf-fix-v2-1-d05db76a5084@google.com
Signed-off-by: Christian Brauner (Amutable) &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFS: write_completion: dereference loop-local req, not hdr-&gt;req</title>
<updated>2026-06-02T08:27:45+00:00</updated>
<author>
<name>Dave Jones</name>
<email>davej@codemonkey.org.uk</email>
</author>
<published>2026-05-18T18:46:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=317d5146fb399ad1e87b310ee7d018fe648d40ba'/>
<id>317d5146fb399ad1e87b310ee7d018fe648d40ba</id>
<content type='text'>
5d3869a41f36 ("NFS: fix writeback in presence of errors") introduced
a dereference of hdr-&gt;req-&gt;wb_lock_context in nfs_write_completion's
per-request loop.  hdr-&gt;req is set once at nfs_pgheader_init() time
and is not refcount-protected for the lifetime of the loop; when hdr
aggregates requests from multiple page groups (common under heavy
NFSv3 writeback), a parallel COMMIT on hdr-&gt;req's group can drop the
last reference and free it while the outer loop is still iterating
requests from other groups.  KASAN catches this as an 8-byte read at
offset +24 of a freed nfs_page slab object (wb_lock_context).

All requests in a given pgio share the same open_context, so reading
the loop-local req's wb_lock_context yields the same value and is
safe -- req is still on hdr-&gt;pages and holds its writeback kref
through the commit branch.

Caught with kasan:

BUG: KASAN: slab-use-after-free in nfs_write_completion+0x8f8/0xa50 [nfs]
Read of size 8 at addr ffff888118af2058 by task kworker/u16:16/122062
CPU: 2 UID: 0 PID: 122062 Comm: kworker/u16:16 Kdump: loaded Not tainted 7.1.0-rc4+ #ge05a759574b2 PREEMPT
Workqueue: nfsiod rpc_async_release
Call Trace:
 &lt;TASK&gt;
 dump_stack_lvl+0xaf/0x100
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 print_report+0x157/0x4a1
 ? __virt_addr_valid+0x1fb/0x400
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 kasan_report+0xc2/0x190
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 nfs_write_completion+0x8f8/0xa50 [nfs]
 ? nfs_commit_release_pages+0xbd0/0xbd0 [nfs]
 ? lock_acquire+0x182/0x2e0
 ? process_one_work+0x937/0x1890
 ? nfs_pgio_header_alloc+0xd0/0xd0 [nfs]
 rpc_free_task+0xee/0x160
 rpc_async_release+0x5d/0xb0
 process_one_work+0x9b0/0x1890
 ? pwq_dec_nr_in_flight+0xed0/0xed0
 ? rpc_final_put_task+0x140/0x140
 worker_thread+0x75a/0x10a0
 ? process_one_work+0x1890/0x1890
 ? kthread+0x1af/0x4d0
 ? process_one_work+0x1890/0x1890
 kthread+0x3d3/0x4d0
 ? kthread_affine_node+0x2c0/0x2c0
 ret_from_fork+0x669/0xa50
 ? native_tss_update_io_bitmap+0x660/0x660
 ? __switch_to+0x9dd/0x1310
 ? kthread_affine_node+0x2c0/0x2c0
 ret_from_fork_asm+0x11/0x20
 &lt;/TASK&gt;

Allocated by task 121997 on cpu 3 at 31643.290294s:
 kasan_save_stack+0x1e/0x40
 kasan_save_track+0x13/0x60
 __kasan_slab_alloc+0x62/0x70
 kmem_cache_alloc_noprof+0x1ab/0x4e0
 nfs_page_create+0x152/0x460 [nfs]
 nfs_page_create_from_folio+0x7e/0x210 [nfs]
 nfs_update_folio+0x7a9/0x32a0 [nfs]
 nfs_write_end+0x290/0xc60 [nfs]
 generic_perform_write+0x4ce/0x990
 nfs_file_write+0x6b3/0xce0 [nfs]
 vfs_write+0x63c/0xfa0
 ksys_write+0x122/0x240
 do_syscall_64+0xc3/0x13f0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53

Freed by task 122046 on cpu 0 at 31647.037964s:
 kasan_save_stack+0x1e/0x40
 kasan_save_track+0x13/0x60
 kasan_save_free_info+0x37/0x60
 __kasan_slab_free+0x3b/0x60
 kmem_cache_free+0x11b/0x5a0
 nfs_page_group_destroy+0x13a/0x210 [nfs]
 nfs_unlock_and_release_request+0x64/0x90 [nfs]
 nfs_commit_release_pages+0x339/0xbd0 [nfs]
 nfs_commit_release+0x51/0xb0 [nfs]
 rpc_free_task+0xee/0x160
 rpc_async_release+0x5d/0xb0
 process_one_work+0x9b0/0x1890
 worker_thread+0x75a/0x10a0
 kthread+0x3d3/0x4d0
 ret_from_fork+0x669/0xa50
 ret_from_fork_asm+0x11/0x20

The buggy address belongs to the object at ffff888118af2040\x0a which belongs to the cache nfs_page of size 96
The buggy address is located 24 bytes inside of\x0a freed 96-byte region [ffff888118af2040, ffff888118af20a0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118af2
head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4000000000000040(head|zone=2)
page_type: f5(slab)
raw: 4000000000000040 ffff88818cf2c4c0 ffffea000e61b990 ffffea0004e7d110
raw: 0000000000000000 0000000800190019 00000000f5000000 0000000000000000
head: 4000000000000040 ffff88818cf2c4c0 ffffea000e61b990 ffffea0004e7d110
head: 0000000000000000 0000000800190019 00000000f5000000 0000000000000000
head: 4000000000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 121997, tgid 121997 (rsync), ts 31643290274577, free_ts 31642154777182
 post_alloc_hook+0xd1/0x100
 get_page_from_freelist+0xbad/0x2910
 __alloc_frozen_pages_noprof+0x1c6/0x4a0
 allocate_slab+0x330/0x620
 ___slab_alloc+0xe9/0x930
 kmem_cache_alloc_noprof+0x35b/0x4e0
 nfs_page_create+0x152/0x460 [nfs]
 nfs_page_create_from_folio+0x7e/0x210 [nfs]
 nfs_update_folio+0x7a9/0x32a0 [nfs]
 nfs_write_end+0x290/0xc60 [nfs]
 generic_perform_write+0x4ce/0x990
 nfs_file_write+0x6b3/0xce0 [nfs]
 vfs_write+0x63c/0xfa0
 ksys_write+0x122/0x240
 do_syscall_64+0xc3/0x13f0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
page last free pid 122202 tgid 122202 stack trace:
 __free_frozen_pages+0x6da/0xf30
 qlist_free_all+0x53/0x130
 kasan_quarantine_reduce+0x198/0x1f0
 __kasan_slab_alloc+0x46/0x70
 kmem_cache_alloc_noprof+0x1ab/0x4e0
 __alloc_object+0x2f/0x230
 __create_object+0x22/0x80
 kmem_cache_alloc_node_noprof+0x416/0x4d0
 __alloc_skb+0x146/0x6e0
 tcp_stream_alloc_skb+0x35/0x660
 tcp_sendmsg_locked+0x1746/0x4260
 tcp_sendmsg+0x2f/0x40
 inet_sendmsg+0x9e/0xe0
 __sock_sendmsg+0xd9/0x180
 sock_sendmsg+0x122/0x200
 xprt_sock_sendmsg+0x4ff/0x9a0

Memory state around the buggy address:
 ffff888118af1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
 ffff888118af1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;ffff888118af2000: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                    ^
 ffff888118af2080: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888118af2100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Reviewed-by Jeff Layton &lt;jlayton@kernel.org&gt;

Fixes: 5d3869a41f36 ("NFS: fix writeback in presence of errors")
Cc: Olga Kornievskaia &lt;okorniev@redhat.com&gt;
Cc: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Cc: Anna Schumaker &lt;anna@kernel.org&gt;
Cc: linux-nfs@vger.kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
5d3869a41f36 ("NFS: fix writeback in presence of errors") introduced
a dereference of hdr-&gt;req-&gt;wb_lock_context in nfs_write_completion's
per-request loop.  hdr-&gt;req is set once at nfs_pgheader_init() time
and is not refcount-protected for the lifetime of the loop; when hdr
aggregates requests from multiple page groups (common under heavy
NFSv3 writeback), a parallel COMMIT on hdr-&gt;req's group can drop the
last reference and free it while the outer loop is still iterating
requests from other groups.  KASAN catches this as an 8-byte read at
offset +24 of a freed nfs_page slab object (wb_lock_context).

All requests in a given pgio share the same open_context, so reading
the loop-local req's wb_lock_context yields the same value and is
safe -- req is still on hdr-&gt;pages and holds its writeback kref
through the commit branch.

Caught with kasan:

BUG: KASAN: slab-use-after-free in nfs_write_completion+0x8f8/0xa50 [nfs]
Read of size 8 at addr ffff888118af2058 by task kworker/u16:16/122062
CPU: 2 UID: 0 PID: 122062 Comm: kworker/u16:16 Kdump: loaded Not tainted 7.1.0-rc4+ #ge05a759574b2 PREEMPT
Workqueue: nfsiod rpc_async_release
Call Trace:
 &lt;TASK&gt;
 dump_stack_lvl+0xaf/0x100
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 print_report+0x157/0x4a1
 ? __virt_addr_valid+0x1fb/0x400
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 kasan_report+0xc2/0x190
 ? nfs_write_completion+0x8f8/0xa50 [nfs]
 nfs_write_completion+0x8f8/0xa50 [nfs]
 ? nfs_commit_release_pages+0xbd0/0xbd0 [nfs]
 ? lock_acquire+0x182/0x2e0
 ? process_one_work+0x937/0x1890
 ? nfs_pgio_header_alloc+0xd0/0xd0 [nfs]
 rpc_free_task+0xee/0x160
 rpc_async_release+0x5d/0xb0
 process_one_work+0x9b0/0x1890
 ? pwq_dec_nr_in_flight+0xed0/0xed0
 ? rpc_final_put_task+0x140/0x140
 worker_thread+0x75a/0x10a0
 ? process_one_work+0x1890/0x1890
 ? kthread+0x1af/0x4d0
 ? process_one_work+0x1890/0x1890
 kthread+0x3d3/0x4d0
 ? kthread_affine_node+0x2c0/0x2c0
 ret_from_fork+0x669/0xa50
 ? native_tss_update_io_bitmap+0x660/0x660
 ? __switch_to+0x9dd/0x1310
 ? kthread_affine_node+0x2c0/0x2c0
 ret_from_fork_asm+0x11/0x20
 &lt;/TASK&gt;

Allocated by task 121997 on cpu 3 at 31643.290294s:
 kasan_save_stack+0x1e/0x40
 kasan_save_track+0x13/0x60
 __kasan_slab_alloc+0x62/0x70
 kmem_cache_alloc_noprof+0x1ab/0x4e0
 nfs_page_create+0x152/0x460 [nfs]
 nfs_page_create_from_folio+0x7e/0x210 [nfs]
 nfs_update_folio+0x7a9/0x32a0 [nfs]
 nfs_write_end+0x290/0xc60 [nfs]
 generic_perform_write+0x4ce/0x990
 nfs_file_write+0x6b3/0xce0 [nfs]
 vfs_write+0x63c/0xfa0
 ksys_write+0x122/0x240
 do_syscall_64+0xc3/0x13f0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53

Freed by task 122046 on cpu 0 at 31647.037964s:
 kasan_save_stack+0x1e/0x40
 kasan_save_track+0x13/0x60
 kasan_save_free_info+0x37/0x60
 __kasan_slab_free+0x3b/0x60
 kmem_cache_free+0x11b/0x5a0
 nfs_page_group_destroy+0x13a/0x210 [nfs]
 nfs_unlock_and_release_request+0x64/0x90 [nfs]
 nfs_commit_release_pages+0x339/0xbd0 [nfs]
 nfs_commit_release+0x51/0xb0 [nfs]
 rpc_free_task+0xee/0x160
 rpc_async_release+0x5d/0xb0
 process_one_work+0x9b0/0x1890
 worker_thread+0x75a/0x10a0
 kthread+0x3d3/0x4d0
 ret_from_fork+0x669/0xa50
 ret_from_fork_asm+0x11/0x20

The buggy address belongs to the object at ffff888118af2040\x0a which belongs to the cache nfs_page of size 96
The buggy address is located 24 bytes inside of\x0a freed 96-byte region [ffff888118af2040, ffff888118af20a0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118af2
head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4000000000000040(head|zone=2)
page_type: f5(slab)
raw: 4000000000000040 ffff88818cf2c4c0 ffffea000e61b990 ffffea0004e7d110
raw: 0000000000000000 0000000800190019 00000000f5000000 0000000000000000
head: 4000000000000040 ffff88818cf2c4c0 ffffea000e61b990 ffffea0004e7d110
head: 0000000000000000 0000000800190019 00000000f5000000 0000000000000000
head: 4000000000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 121997, tgid 121997 (rsync), ts 31643290274577, free_ts 31642154777182
 post_alloc_hook+0xd1/0x100
 get_page_from_freelist+0xbad/0x2910
 __alloc_frozen_pages_noprof+0x1c6/0x4a0
 allocate_slab+0x330/0x620
 ___slab_alloc+0xe9/0x930
 kmem_cache_alloc_noprof+0x35b/0x4e0
 nfs_page_create+0x152/0x460 [nfs]
 nfs_page_create_from_folio+0x7e/0x210 [nfs]
 nfs_update_folio+0x7a9/0x32a0 [nfs]
 nfs_write_end+0x290/0xc60 [nfs]
 generic_perform_write+0x4ce/0x990
 nfs_file_write+0x6b3/0xce0 [nfs]
 vfs_write+0x63c/0xfa0
 ksys_write+0x122/0x240
 do_syscall_64+0xc3/0x13f0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
page last free pid 122202 tgid 122202 stack trace:
 __free_frozen_pages+0x6da/0xf30
 qlist_free_all+0x53/0x130
 kasan_quarantine_reduce+0x198/0x1f0
 __kasan_slab_alloc+0x46/0x70
 kmem_cache_alloc_noprof+0x1ab/0x4e0
 __alloc_object+0x2f/0x230
 __create_object+0x22/0x80
 kmem_cache_alloc_node_noprof+0x416/0x4d0
 __alloc_skb+0x146/0x6e0
 tcp_stream_alloc_skb+0x35/0x660
 tcp_sendmsg_locked+0x1746/0x4260
 tcp_sendmsg+0x2f/0x40
 inet_sendmsg+0x9e/0xe0
 __sock_sendmsg+0xd9/0x180
 sock_sendmsg+0x122/0x200
 xprt_sock_sendmsg+0x4ff/0x9a0

Memory state around the buggy address:
 ffff888118af1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
 ffff888118af1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;ffff888118af2000: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                    ^
 ffff888118af2080: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888118af2100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Reviewed-by Jeff Layton &lt;jlayton@kernel.org&gt;

Fixes: 5d3869a41f36 ("NFS: fix writeback in presence of errors")
Cc: Olga Kornievskaia &lt;okorniev@redhat.com&gt;
Cc: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Cc: Anna Schumaker &lt;anna@kernel.org&gt;
Cc: linux-nfs@vger.kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>erofs: fix EFSCORRUPTED on multi-algorithm images in z_erofs_map_sanity_check()</title>
<updated>2026-06-01T17:52:58+00:00</updated>
<author>
<name>Zhan Xusheng</name>
<email>zhanxusheng@xiaomi.com</email>
</author>
<published>2026-06-01T08:51:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=27f2d085bd72abe4235689d34d8654cfc876d568'/>
<id>27f2d085bd72abe4235689d34d8654cfc876d568</id>
<content type='text'>
Commit a5242d37c83a ("erofs: error out obviously illegal extents in
advance") changed the per-extent algorithm presence check from "is the
bit set" to "is the only bit set":
  -		     !(sbi-&gt;available_compr_algs &amp; (1 &lt;&lt; map-&gt;m_algorithmformat))
  +		(sbi-&gt;available_compr_algs ^ BIT(map-&gt;m_algorithmformat))

`available_compr_algs` is a bitmap of every compression algorithm
available in the image (z_erofs_parse_cfgs() iterates it with
for_each_set_bit()), so an image that enables more than one algorithm
has multiple bits set.  XOR is zero only when the bitmap is exactly
BIT(map-&gt;m_algorithmformat); for any image with two or more algorithms
the test is non-zero for every extent and the read fails with
-EFSCORRUPTED ("inconsistent algorithmtype %u").

Reproducer (mkfs.erofs from erofs-utils 1.7.1):
  $ mkdir src
  $ yes A | head -c 100K &gt; src/a
  $ head -c 64K /dev/zero &gt; src/b
  $ mkfs.erofs -zlz4:deflate multi.erofs src
  $ mount -t erofs -o loop multi.erofs /mnt
  $ cat /mnt/a &gt;/dev/null
  cat: /mnt/a: Structure needs cleaning
  $ dmesg | tail
    erofs (device loop0): inconsistent algorithmtype 0 for nid 46
    erofs (device loop0): read error -117 @ 0 of nid 46

The erofs on-disk format (Z_EROFS_COMPRESSION_MAX = 4 with LZ4, LZMA,
DEFLATE, ZSTD) and the kernel parser explicitly support
multi-algorithm images, and erofs-utils 1.7.1 generates them via the
"-z X:Y" syntax.

Restore the original per-bit presence check.

Fixes: a5242d37c83a ("erofs: error out obviously illegal extents in advance")
Signed-off-by: Zhan Xusheng &lt;zhanxusheng@xiaomi.com&gt;
Reviewed-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit a5242d37c83a ("erofs: error out obviously illegal extents in
advance") changed the per-extent algorithm presence check from "is the
bit set" to "is the only bit set":
  -		     !(sbi-&gt;available_compr_algs &amp; (1 &lt;&lt; map-&gt;m_algorithmformat))
  +		(sbi-&gt;available_compr_algs ^ BIT(map-&gt;m_algorithmformat))

`available_compr_algs` is a bitmap of every compression algorithm
available in the image (z_erofs_parse_cfgs() iterates it with
for_each_set_bit()), so an image that enables more than one algorithm
has multiple bits set.  XOR is zero only when the bitmap is exactly
BIT(map-&gt;m_algorithmformat); for any image with two or more algorithms
the test is non-zero for every extent and the read fails with
-EFSCORRUPTED ("inconsistent algorithmtype %u").

Reproducer (mkfs.erofs from erofs-utils 1.7.1):
  $ mkdir src
  $ yes A | head -c 100K &gt; src/a
  $ head -c 64K /dev/zero &gt; src/b
  $ mkfs.erofs -zlz4:deflate multi.erofs src
  $ mount -t erofs -o loop multi.erofs /mnt
  $ cat /mnt/a &gt;/dev/null
  cat: /mnt/a: Structure needs cleaning
  $ dmesg | tail
    erofs (device loop0): inconsistent algorithmtype 0 for nid 46
    erofs (device loop0): read error -117 @ 0 of nid 46

The erofs on-disk format (Z_EROFS_COMPRESSION_MAX = 4 with LZ4, LZMA,
DEFLATE, ZSTD) and the kernel parser explicitly support
multi-algorithm images, and erofs-utils 1.7.1 generates them via the
"-z X:Y" syntax.

Restore the original per-bit presence check.

Fixes: a5242d37c83a ("erofs: error out obviously illegal extents in advance")
Signed-off-by: Zhan Xusheng &lt;zhanxusheng@xiaomi.com&gt;
Reviewed-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
Signed-off-by: Gao Xiang &lt;hsiangkao@linux.alibaba.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ksmbd: fix use-after-free of a deferred file_lock on double SMB2_CANCEL</title>
<updated>2026-06-01T00:13:48+00:00</updated>
<author>
<name>Gil Portnoy</name>
<email>dddhkts1@gmail.com</email>
</author>
<published>2026-05-31T23:27:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f580d27e8928828693df44ba2db0fffdbe11dfea'/>
<id>f580d27e8928828693df44ba2db0fffdbe11dfea</id>
<content type='text'>
A deferred byte-range lock (an SMB2_LOCK that blocks) registers an async work on
conn-&gt;async_requests via setup_async_work(), with cancel_fn =
smb2_remove_blocked_lock and cancel_argv[0] pointing at the struct file_lock.

When the request is cancelled, the worker frees the file_lock with
locks_free_lock() and takes the cancelled early-exit, which "goto out"s and never
reaches release_async_work() -- the only site that unlinks the work from
conn-&gt;async_requests and clears cancel_fn/cancel_argv. The work therefore stays
matchable on async_requests with a live cancel_fn pointing at the freed file_lock,
until connection teardown finally runs release_async_work().

smb2_cancel() fires cancel_fn unconditionally with no state guard, so a second
SMB2_CANCEL for the same AsyncId, arriving in that window, re-runs
smb2_remove_blocked_lock() on the freed file_lock -- a slab use-after-free:

  BUG: KASAN: slab-use-after-free in __locks_delete_block
    __locks_delete_block
    locks_delete_block
    ksmbd_vfs_posix_lock_unblock
    smb2_remove_blocked_lock
    smb2_cancel                 &lt;- 2nd SMB2_CANCEL fires cancel_fn
    handle_ksmbd_work
  Allocated by ...: locks_alloc_lock &lt;- smb2_lock
  Freed by ...:     locks_free_lock  &lt;- smb2_lock (cancelled branch)
  ... cache file_lock_cache of size 192

Reproduced on mainline with KASAN by an authenticated SMB client.

Skip a work whose state is already KSMBD_WORK_CANCELLED so its cancel callback
cannot be fired a second time.

Cc: stable@vger.kernel.org
Signed-off-by: Gil Portnoy &lt;dddhkts1@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A deferred byte-range lock (an SMB2_LOCK that blocks) registers an async work on
conn-&gt;async_requests via setup_async_work(), with cancel_fn =
smb2_remove_blocked_lock and cancel_argv[0] pointing at the struct file_lock.

When the request is cancelled, the worker frees the file_lock with
locks_free_lock() and takes the cancelled early-exit, which "goto out"s and never
reaches release_async_work() -- the only site that unlinks the work from
conn-&gt;async_requests and clears cancel_fn/cancel_argv. The work therefore stays
matchable on async_requests with a live cancel_fn pointing at the freed file_lock,
until connection teardown finally runs release_async_work().

smb2_cancel() fires cancel_fn unconditionally with no state guard, so a second
SMB2_CANCEL for the same AsyncId, arriving in that window, re-runs
smb2_remove_blocked_lock() on the freed file_lock -- a slab use-after-free:

  BUG: KASAN: slab-use-after-free in __locks_delete_block
    __locks_delete_block
    locks_delete_block
    ksmbd_vfs_posix_lock_unblock
    smb2_remove_blocked_lock
    smb2_cancel                 &lt;- 2nd SMB2_CANCEL fires cancel_fn
    handle_ksmbd_work
  Allocated by ...: locks_alloc_lock &lt;- smb2_lock
  Freed by ...:     locks_free_lock  &lt;- smb2_lock (cancelled branch)
  ... cache file_lock_cache of size 192

Reproduced on mainline with KASAN by an authenticated SMB client.

Skip a work whose state is already KSMBD_WORK_CANCELLED so its cancel callback
cannot be fired a second time.

Cc: stable@vger.kernel.org
Signed-off-by: Gil Portnoy &lt;dddhkts1@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ksmbd: fix durable reconnect double-bind race in ksmbd_reopen_durable_fd</title>
<updated>2026-06-01T00:13:48+00:00</updated>
<author>
<name>Gil Portnoy</name>
<email>dddhkts1@gmail.com</email>
</author>
<published>2026-05-28T00:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7ce4fc40018de07f05f3035241122d992610dbfb'/>
<id>7ce4fc40018de07f05f3035241122d992610dbfb</id>
<content type='text'>
Two concurrent same-user DHnC reconnects can both observe fp-&gt;conn == NULL
before either sets it. ksmbd_reopen_durable_fd() checks fp-&gt;conn to guard
against a handle already being reconnected, but the check and the binding
assignment are not atomic: both threads pass the guard, both call
ksmbd_conn_get() on the same fp, and both eventually reach
kfree(fp-&gt;owner.name) -- a double-free of the owner.name slab object.
The double-bound ksmbd_file also causes a write-UAF on the 344-byte
ksmbd_file_cache object when a concurrent smb2_close() spins on fp-&gt;f_lock
after the object has been freed by the losing reconnect path.

KASAN on 7.1-rc5 (48-thread concurrent reconnect, 3000 cycles):
  BUG: KASAN: double-free in ksmbd_reopen_durable_fd+0x268/0x308
  BUG: KASAN: slab-use-after-free in _raw_spin_lock+0xac/0x150
    Write of size 4 at offset 24 into freed ksmbd_file_cache object
Five double-bind windows observed; 63 total KASAN reports triggered.

Fix: validate and claim fp-&gt;conn under write_lock(&amp;global_ft.lock) so the
check-and-claim is atomic. ksmbd_lookup_durable_fd() already treats
fp-&gt;conn != NULL as "in use" and skips such an fp; setting fp-&gt;conn before
dropping the lock closes the race. ksmbd_conn_get() is a non-sleeping
refcount increment, safe under the rwlock. The rollback path on __open_id()
failure also clears fp-&gt;conn/tcon under the lock so concurrent readers see
a consistent state.

Fixes: b1f1e80620de ("ksmbd: centralize ksmbd_conn final release to plug transport leak")
Assisted-by: Henry (Claude):claude-opus-4
Signed-off-by: Gil Portnoy &lt;dddhkts1@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Two concurrent same-user DHnC reconnects can both observe fp-&gt;conn == NULL
before either sets it. ksmbd_reopen_durable_fd() checks fp-&gt;conn to guard
against a handle already being reconnected, but the check and the binding
assignment are not atomic: both threads pass the guard, both call
ksmbd_conn_get() on the same fp, and both eventually reach
kfree(fp-&gt;owner.name) -- a double-free of the owner.name slab object.
The double-bound ksmbd_file also causes a write-UAF on the 344-byte
ksmbd_file_cache object when a concurrent smb2_close() spins on fp-&gt;f_lock
after the object has been freed by the losing reconnect path.

KASAN on 7.1-rc5 (48-thread concurrent reconnect, 3000 cycles):
  BUG: KASAN: double-free in ksmbd_reopen_durable_fd+0x268/0x308
  BUG: KASAN: slab-use-after-free in _raw_spin_lock+0xac/0x150
    Write of size 4 at offset 24 into freed ksmbd_file_cache object
Five double-bind windows observed; 63 total KASAN reports triggered.

Fix: validate and claim fp-&gt;conn under write_lock(&amp;global_ft.lock) so the
check-and-claim is atomic. ksmbd_lookup_durable_fd() already treats
fp-&gt;conn != NULL as "in use" and skips such an fp; setting fp-&gt;conn before
dropping the lock closes the race. ksmbd_conn_get() is a non-sleeping
refcount increment, safe under the rwlock. The rollback path on __open_id()
failure also clears fp-&gt;conn/tcon under the lock so concurrent readers see
a consistent state.

Fixes: b1f1e80620de ("ksmbd: centralize ksmbd_conn final release to plug transport leak")
Assisted-by: Henry (Claude):claude-opus-4
Signed-off-by: Gil Portnoy &lt;dddhkts1@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
