Skip to content

Commit e3e056c

Browse files
aaptelsmfrench
authored andcommitted
cifs: fix mode bits from dir listing when mounted with modefromsid
When mounting with -o modefromsid, the mode bits are stored in an ACE. Directory enumeration (e.g. ls -l /mnt) triggers an SMB Query Dir which does not include ACEs in its response. The mode bits in this case are silently set to a default value of 755 instead. This patch marks the dentry created during the directory enumeration as needing re-evaluation (i.e. additional Query Info with ACEs) so that the mode bits can be properly extracted. Quick repro: $ mount.cifs //win19.test/data /mnt -o ...,modefromsid $ touch /mnt/foo && chmod 751 /mnt/foo $ stat /mnt/foo # reports 751 (OK) $ sleep 2 # dentry older than 1s by default get invalidated $ ls -l /mnt # since dentry invalid, ls does a Query Dir # and reports foo as 755 (WRONG) Signed-off-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent cc95b67 commit e3e056c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/readdir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)
196196
* may look wrong since the inodes may not have timed out by the time
197197
* "ls" does a stat() call on them.
198198
*/
199-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
199+
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) ||
200+
(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID))
200201
fattr->cf_flags |= CIFS_FATTR_NEED_REVAL;
201202

202203
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL &&

0 commit comments

Comments
 (0)