Skip to content

cifs: Improve access without FILE_READ_ATTRIBUTES permission

Pali Rohár linux-cifs lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

* At first attempt still try to open with FILE_READ_ATTRIBUTES and fallback to open without FILE_READ_ATTRIBUTES only on -EACCESS.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2cifs: Add fallback for SMB2 CREATE without FILE_READ_ATTRIBUTESfs/smb/client/smb2file.c+10 -10 replies
2/2cifs: Improve stat() to work also without FILE_READ_ATTRIBUTESfs/smb/client/cifspdu.h fs/smb/client/smb2file.c fs/smb/client/smb2glob.h +1 more+74 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] cifs: Improve access without FILE_READ_ATTRIBUTES permission

Linux SMB client currently is not able to access files for which do not have FILE_READ_ATTRIBUTES permission.

For example it is not able to write data into file on SMB server to which has only write access (no read or read attributes access). And applications are not able to get result of stat() syscall on such file.

Test case against Windows SMB server:

1) On SMB server prepare file with only GENERIC_WRITE access for Everyone:
ACL:S-1-1-0:ALLOWED/0x0/0x40000000

2) On SMB server remove all access for file's parent directory

3) Mount share by Linux SMB client and try to append data to that file:
echo test >> /mnt/share/dir/file

4) Try to call: stat /mnt/share/dir/file

Without this change the write test fails because Linux SMB client is trying to open SMB path "\dir\file" with GENERIC_WRITE|FILE_READ_ATTRIBUTES. With this change the test pass as Linux SMB client is not opening file with FILE_READ_ATTRIBUTES access anymore.

Similarly without this change the stat test always fails as Linux SMB client is trying to read attributes via SMB2_OP_QUERY_INFO. With this change, if SMB2_OP_QUERY_INFO fails then Linux SMB client fallbacks for reading stat attributes via OPEN with MAXIMUM_ALLOWED access (which will pass if there is some permission) and OPEN reply will contain attributes required for stat().

Changes in v2:
* At first attempt still try to open with FILE_READ_ATTRIBUTES and fallback to open without FILE_READ_ATTRIBUTES only on -EACCESS.

Pali Rohár (2):
cifs: Add fallback for SMB2 CREATE without FILE_READ_ATTRIBUTES
cifs: Improve stat() to work also without FILE_READ_ATTRIBUTES

 fs/smb/client/cifspdu.h   |  1 +
 fs/smb/client/smb2file.c  | 12 ++++++-
 fs/smb/client/smb2glob.h  |  1 +
 fs/smb/client/smb2inode.c | 71 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 83 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1