[PATCH 15/35] cifs: Do not try to overwrite existing sillyname in cifs_rename_pending_delete()

Pali Rohár posted 35 patches 1 month ago
[PATCH 15/35] cifs: Do not try to overwrite existing sillyname in cifs_rename_pending_delete()
Posted by Pali Rohár 1 month ago
If the target location for newly generated sillyname file already exists
then do not try to rename file to that new target name. It would either
fail (because file is still in use) or it will unexpectedly remove
additional file which was not requested.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 fs/smb/client/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index be8e5e5ca6cd..89d1b82ac55c 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -1793,7 +1793,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
 
 	/* rename the file */
 	rc = CIFSSMBRenameOpenFile(xid, tcon, fid.netfid, sillyname,
-				   true /* overwrite */,
+				   false /* overwrite */,
 				   cifs_sb->local_nls,
 				   cifs_remap(cifs_sb));
 	if (rc != 0) {
-- 
2.20.1