]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
smb: client: fix double put of @cfile in smb2_rename_path()
authorPaulo Alcantara <pc@manguebit.com>
Tue, 3 Sep 2024 13:53:23 +0000 (10:53 -0300)
committerSteve French <stfrench@microsoft.com>
Tue, 3 Sep 2024 14:48:50 +0000 (09:48 -0500)
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>
fs/smb/client/smb2inode.c

index 9f5bc41433c15646278d4dc19115c6f0798d5c14..e3117f3fb5b2b9683f337862c886864fe8f2666f 100644 (file)
@@ -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);
        }