lkml.org 
[lkml]   [2018]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 19/22] staging: lustre: llite: add support set_acl method in inode operations
On Mon, Apr 16, 2018 at 12:15:08AM -0400, James Simmons wrote:
> +int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type)
> +{
> + struct ll_sb_info *sbi = ll_i2sbi(inode);
> + struct ptlrpc_request *req = NULL;
> + const char *name = NULL;
> + size_t value_size = 0;
> + char *value = NULL;
> + int rc;
> +
> + switch (type) {
> + case ACL_TYPE_ACCESS:
> + name = XATTR_NAME_POSIX_ACL_ACCESS;
> + if (acl) {
> + rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
> + if (rc)
> + goto out;
> + }
> +
> + break;
> +
> + case ACL_TYPE_DEFAULT:
> + name = XATTR_NAME_POSIX_ACL_DEFAULT;
> + if (!S_ISDIR(inode->i_mode)) {
> + rc = acl ? -EACCES : 0;
> + goto out;

I just hate "goto out;" labels... They're so impossible to review...
Why are we calling forget_cached_acl() when we haven't set anything? I
have no idea. Perhaps it's not even intentional.

> + }
> +
> + break;
> +
> + default:
> + rc = -EINVAL;
> + goto out;

And on this path we're calling forget_cached_acl(inode, type) with an
invalid "type" so it will trigger a BUG()... That's obviously not
intended... Who knows what's going on when all the names are vague and
hand wavy.

regards,
dan carpenter

\
 
 \ /
  Last update: 2018-04-17 10:40    [W:0.059 / U:20.952 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site