Re: [PATCH v1 0/2] smb: client: fix cached-dir and deferred-close unmount races

From: Siddharth Chintamaneni

Date: Fri Nov 27 2026 - 20:36:18 EST


On Thu, 26 Nov 2026 at 07:14, Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote:
>
> Hi Siddharth,
>
> Siddharth Chintamaneni <sidchintamaneni@xxxxxxxxx> writes:
>
> > While investigating the cifs_kill_sb() unmount busy-dentry race fixed in
> > "smb: client: fix busy dentry and inode on unmount from late oplock
> > break" [1], I wrote a static analysis tool with AI assistance to scan
> > for the same teardown pattern where objects are moved off shared lists
> > and locks are dropped before their underlying dentry references are
> > released.
> >
> > That scan identified two more unmount races in cifs_kill_sb(), both of
> > which I reproduced in QEMU where cifs_kill_sb() reaches
> > generic_shutdown_super() while dentries are still in use:
> >
> > - Patch 1 walks cfids->dying under cfids->cfid_list_lock in
> > close_all_cached_dirs() and holds cifs_sb->outstanding_rreq across
> > dput(dentry) in smb2_close_cached_fid() so dentries for dying or
> > concurrently closed cached directories are dropped before
> > kill_anon_super() runs.
> > - Patch 2 counts cancelled deferred-close handles in
> > cifs_sb->outstanding_rreq while they sit on a local stack list before
> > _cifsFileInfo_put() completes in cifs_close_deferred_file(),
> > cifs_close_all_deferred_files(), and
> > cifs_close_deferred_file_under_dentry().
> >
> > [1] https://lore.kernel.org/all/20261117001733.192399-1-sidchintamaneni@xxxxxxxxx/
> >
> > Siddharth Chintamaneni (2):
> > smb: client: drop dentries for dying cached dirs during unmount
> > smb: client: fix busy dentry on unmount from cancelled deferred close
> >
> > fs/smb/client/cached_dir.c | 31 +++++++++++++++++++++++++++++--
> > fs/smb/client/misc.c | 32 +++++++++++++++++++++++++++++---
> > 2 files changed, 58 insertions(+), 5 deletions(-)
>
> Please have a look at sashiko's reviews on your series
>
> https://sashiko.dev/#/patchset/20261118002529.250616-1-sidchintamaneni%40gmail.com

Sure, I’ll address the comments and re-spin the patches.

I also ran the static checker across the entire kernel, and it found
similar bug patterns in several filesystems and drivers. I was
wondering if there’s a better way to handle these findings.
I don’t really want to publish them somewhere since I’m not sure if
the races are exploitable. At the same time, I don’t want to spam
different subsystem maintainers with patches without verifying each
issue first, which feels a bit cumbersome.
Just wanted to reach out and get your advice on how best to approach this.

Thanks!