[PATCH 29/35] cifs: Fix smb2_rmdir() on reparse point

Pali Rohár posted 35 patches 1 month ago
[PATCH 29/35] cifs: Fix smb2_rmdir() on reparse point
Posted by Pali Rohár 1 month ago
rmdir() should remove the directory node specified by the path and not the
path where reparse point can point. Open flag OPEN_REPARSE_POINT cause to
remove directory node itself.

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

diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index c69293fcf26c..59d73e01ccd2 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -1333,7 +1333,7 @@ smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
 
 	drop_cached_dir_by_name(xid, tcon, name, cifs_sb);
 	oparms = CIFS_OPARMS(cifs_sb, tcon, name, DELETE,
-			     FILE_OPEN, CREATE_NOT_FILE, ACL_NO_MODE);
+			     FILE_OPEN, CREATE_NOT_FILE | OPEN_REPARSE_POINT, ACL_NO_MODE);
 	return smb2_compound_op(xid, tcon, cifs_sb,
 				name, &oparms, NULL,
 				&(int){SMB2_OP_RMDIR}, 1,
-- 
2.20.1