summaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorPaul Aurich <paul@darkrain42.org>2024-11-27 01:50:31 +0100
committerSteve French <stfrench@microsoft.com>2024-11-27 06:35:34 +0100
commitc353ee4fb119a2582d0e011f66a76a38f5cf984d (patch)
treeaa728ae856a52b6d1964a4683311b32a142a9885 /fs/smb
parentsmb: During unmount, ensure all cached dir instances drop their dentry (diff)
downloadlinux-c353ee4fb119a2582d0e011f66a76a38f5cf984d.tar.xz
linux-c353ee4fb119a2582d0e011f66a76a38f5cf984d.zip
smb: Initialize cfid->tcon before performing network ops
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>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/client/cached_dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index d9e1d1dc6178..fe738623cf1b 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -229,6 +229,7 @@ replay_again:
}
}
cfid->dentry = dentry;
+ cfid->tcon = tcon;
/*
* We do not hold the lock for the open because in case
@@ -300,7 +301,6 @@ replay_again:
}
goto oshr_free;
}
- cfid->tcon = tcon;
cfid->is_open = true;
spin_lock(&cfids->cfid_list_lock);