]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()
authorEryu Guan <guaneryu@gmail.com>
Mon, 24 Oct 2016 12:46:40 +0000 (20:46 +0800)
committerSteve French <smfrench@gmail.com>
Tue, 29 Nov 2016 05:08:53 +0000 (23:08 -0600)
Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups")
removes the typedefs and the zero-length a_entries array in struct
posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header
and struct posix_acl_xattr_entry directly.

But it failed to iterate over posix acl slots when converting posix
acls to CIFS format, which results in several test failures in
xfstests (generic/053 generic/105) when testing against a samba v1
server, starting from v4.9-rc1 kernel. e.g.

  [root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
  --- tests/generic/105.out       2016-09-19 16:33:28.577962575 +0800
  +++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800
  @@ -1,3 +1,4 @@
   QA output created by 105
   -rw-r--r-- root
  +setfacl: subdir: Invalid argument
   -rw-r--r-- root

Fix it by introducing a new "ace" var, like what
cifs_copy_posix_acl() does, and iterating posix acl xattr entries
over it in the for loop.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/cifssmb.c

index 3f3185febc585f93fb9f88a0b0e96ec49b636f4a..e3fed9249a04f09929e772c0f4c9b0955263b13b 100644 (file)
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
        __u16 rc = 0;
        struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
        struct posix_acl_xattr_header *local_acl = (void *)pACL;
+       struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
        int count;
        int i;
 
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
                return 0;
        }
        for (i = 0; i < count; i++) {
-               rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],
-                       (struct posix_acl_xattr_entry *)(local_acl + 1));
+               rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
                if (rc != 0) {
                        /* ACE not converted */
                        break;