summaryrefslogtreecommitdiffstats
path: root/fs/smb/client
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.com>2024-09-03 15:53:23 +0200
committerSteve French <stfrench@microsoft.com>2024-09-03 16:48:50 +0200
commit3523a3df03c6f04f7ea9c2e7050102657e331a4f (patch)
treeb26c058231923b3c762ac5225d9a408ab62c368e /fs/smb/client
parentsmb: client: fix hang in wait_for_response() for negproto (diff)
downloadlinux-3523a3df03c6f04f7ea9c2e7050102657e331a4f.tar.xz
linux-3523a3df03c6f04f7ea9c2e7050102657e331a4f.zip
smb: client: fix double put of @cfile in smb2_rename_path()
If smb2_set_path_attr() is called with a valid @cfile and returned -EINVAL, we need to call cifs_get_writable_path() again as the reference of @cfile was already dropped by previous smb2_compound_op() call. Fixes: 71f15c90e785 ("smb: client: retry compound request without reusing lease") Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client')
-rw-r--r--fs/smb/client/smb2inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 9f5bc41433c1..e3117f3fb5b2 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -1106,6 +1106,8 @@ int smb2_rename_path(const unsigned int xid,
co, DELETE, SMB2_OP_RENAME, cfile, source_dentry);
if (rc == -EINVAL) {
cifs_dbg(FYI, "invalid lease key, resending request without lease");
+ cifs_get_writable_path(tcon, from_name,
+ FIND_WR_WITH_DELETE, &cfile);
rc = smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb,
co, DELETE, SMB2_OP_RENAME, cfile, NULL);
}