[SRU][n:linux-azure][PATCH 7/7] smb: client: fix double put of @cfile in smb2_rename_path()
Vinicius Peixoto
vinicius.peixoto at canonical.com
Mon Dec 2 23:28:02 UTC 2024
From: Paulo Alcantara <pc at manguebit.com>
BugLink: https://bugs.launchpad.net/bugs/2090880
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 at manguebit.com>
Cc: David Howells <dhowells at redhat.com>
Signed-off-by: Steve French <stfrench at microsoft.com>
(cherry picked from commit 3523a3df03c6f04f7ea9c2e7050102657e331a4f)
Signed-off-by: Vinicius Peixoto <vinicius.peixoto at canonical.com>
---
fs/smb/client/smb2inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 600cbd80c5a5..14b32f87af5c 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -945,6 +945,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);
}
--
2.43.0
More information about the kernel-team
mailing list