Re: [PATCH] CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 24, 2016 at 01:03:16PM +0200, Andreas Gruenbacher wrote:
> On Sat, Oct 22, 2016 at 10:14 AM, Eryu Guan <guaneryu@xxxxxxxxx> wrote:
> > 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@xxxxxxxxx>
> > ---
> >  fs/cifs/cifssmb.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> > index 3f3185f..d04c21c 100644
> > --- a/fs/cifs/cifssmb.c
> > +++ b/fs/cifs/cifssmb.c
> > @@ -3453,8 +3453,8 @@ 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));
> > +               struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
> 
> Shouldn't ace better be defined outside the loop?

Agreed, that's much cleaner. Will fix in v2. Thanks for review!

Eryu

> 
> > +               rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
> >                 if (rc != 0) {
> >                         /* ACE not converted */
> >                         break;
> 
> Thanks,
> Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux