]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb: client: Avoid race in open_cached_dir with lease breaks
authorPaul Aurich <paul@darkrain42.org>
Wed, 7 May 2025 05:28:09 +0000 (22:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:24:08 +0000 (08:24 +0200)
commit2ed98e89ebc2e1bc73534dc3c18cb7843a889ff9
treebc7b524b3a1710521df02e3ebf6dd0b0d2bc0b0d
parent671c05434d9178fdb244bb17ba49add793d4d9c4
smb: client: Avoid race in open_cached_dir with lease breaks

commit 3ca02e63edccb78ef3659bebc68579c7224a6ca2 upstream.

A pre-existing valid cfid returned from find_or_create_cached_dir might
race with a lease break, meaning open_cached_dir doesn't consider it
valid, and thinks it's newly-constructed. This leaks a dentry reference
if the allocation occurs before the queued lease break work runs.

Avoid the race by extending holding the cfid_list_lock across
find_or_create_cached_dir and when the result is checked.

Cc: stable@vger.kernel.org
Reviewed-by: Henrique Carvalho <henrique.carvalho@suse.com>
Signed-off-by: Paul Aurich <paul@darkrain42.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/cached_dir.c