Re: [PATCH 06/29] 9p: implement get acl method

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

 



On Sat, Sep 24, 2022 at 06:56:49PM +0100, Al Viro wrote:
> On Thu, Sep 22, 2022 at 05:17:04PM +0200, Christian Brauner wrote:
> 
> > -static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
> > +static int v9fs_fid_get_acl(struct p9_fid *fid, const char *name,
> > +			    struct posix_acl **kacl)
> >  {
> >  	ssize_t size;
> >  	void *value = NULL;
> >  	struct posix_acl *acl = NULL;
> >  
> >  	size = v9fs_fid_xattr_get(fid, name, NULL, 0);
> > -	if (size > 0) {
> > -		value = kzalloc(size, GFP_NOFS);
> > -		if (!value)
> > -			return ERR_PTR(-ENOMEM);
> > -		size = v9fs_fid_xattr_get(fid, name, value, size);
> > -		if (size > 0) {
> > -			acl = posix_acl_from_xattr(&init_user_ns, value, size);
> > -			if (IS_ERR(acl))
> > -				goto err_out;
> > -		}
> > -	} else if (size == -ENODATA || size == 0 ||
> > -		   size == -ENOSYS || size == -EOPNOTSUPP) {
> > -		acl = NULL;
> > -	} else
> > -		acl = ERR_PTR(-EIO);
> > +	if (size <= 0)
> > +		goto out;
> >  
> > -err_out:
> > +	/* just return the size */
> > +	if (!kacl)
> > +		goto out;
> 
> How can that happen?  Both callers are passing addresses of local variables
> as the third argument.  And what's the point of that kacl thing, anyway?
> Same callers would be much happier if you returned acl or ERR_PTR()...

Yeah, my bad. I had an initial draft just to get something to test where
I returned it through an return argument instead of the function. Seems
I missed to fix that spot. Thanks, fixed and also massaged the callers a bit.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux