diff options
author | Paul Aurich <paul@darkrain42.org> | 2024-11-27 03:50:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-05 15:54:31 +0300 |
commit | 4b216c8f9c7d84ef7de33ca60b97e08e03ef3292 (patch) | |
tree | fbc980a8a7e70af899bc6ae8742fc2c70a6776f7 | |
parent | 029ee0022a81eac2e6a11626320c7852785ae190 (diff) | |
download | linux-4b216c8f9c7d84ef7de33ca60b97e08e03ef3292.tar.xz |
smb: Initialize cfid->tcon before performing network ops
[ Upstream commit c353ee4fb119a2582d0e011f66a76a38f5cf984d ]
Avoid leaking a tcon ref when a lease break races with opening the
cached directory. Processing the leak break might take a reference to
the tcon in cached_dir_lease_break() and then fail to release the ref in
cached_dir_offload_close, since cfid->tcon is still NULL.
Fixes: ebe98f1447bb ("cifs: enable caching of directories for which a lease is held")
Signed-off-by: Paul Aurich <paul@darkrain42.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/smb/client/cached_dir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 004349a7ab69..9c0ef4195b58 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -227,6 +227,7 @@ replay_again: } } cfid->dentry = dentry; + cfid->tcon = tcon; /* * We do not hold the lock for the open because in case @@ -298,7 +299,6 @@ replay_again: } goto oshr_free; } - cfid->tcon = tcon; cfid->is_open = true; spin_lock(&cfids->cfid_list_lock); |