[PATCH 1/2] cifs: Do not issue SMB2 CREATE always with FILE_READ_ATTRIBUTES

From: Pali Rohár
Date: Sat Oct 05 2024 - 12:10:00 EST


Not all SMB2 operations require FILE_READ_ATTRIBUTES access and therefore
do not automatically request for FILE_READ_ATTRIBUTES access in every one
SMB2 CREATE command.

This change allows to complete WRITE operation to a file when it does not
grant FILE_READ_ATTRIBUTES permission and its parent directory does not
grant READ_DATA permission (parent directory READ_DATA is implicit grant of
child FILE_READ_ATTRIBUTES permission).

Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
---
fs/smb/client/smb2file.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
index 149449d9c1c0..faa634ce4d54 100644
--- a/fs/smb/client/smb2file.c
+++ b/fs/smb/client/smb2file.c
@@ -162,7 +162,6 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32
if (smb2_path == NULL)
return -ENOMEM;

- oparms->desired_access |= FILE_READ_ATTRIBUTES;
smb2_oplock = SMB2_OPLOCK_LEVEL_BATCH;

rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, smb2_data, NULL, &err_iov,
--
2.20.1