mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: James Simmons <jsimmons@infradead.org>
Cc: devel@driverdev.osuosl.org,
	Dmitry Eremin <dmitry.eremin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	NeilBrown <neilb@suse.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Oleg Drokin <oleg.drokin@intel.com>,
	"John L. Hammond" <john.hammond@intel.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 19/22] staging: lustre: llite: add support set_acl method in inode operations
Date: Tue, 17 Apr 2018 11:38:54 +0300	[thread overview]
Message-ID: <20180417083854.7dgypv3eu4tc4e2c@mwanda> (raw)
In-Reply-To: <1523852111-17321-20-git-send-email-jsimmons@infradead.org>

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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2018-04-17  8:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  4:14 [PATCH 00/22] staging: lustre: llite: fix xattr handling James Simmons
2018-04-16  4:14 ` [PATCH 01/22] staging: lustre: llite: initialize xattr->xe_namelen James Simmons
2018-04-16  4:14 ` [PATCH 02/22] staging: lustre: obd: create it_has_reply_body() James Simmons
2018-04-16  4:14 ` [PATCH 03/22] staging: lustre: obd: change debug reporting in lmv_enqueue() James Simmons
2018-04-16  4:14 ` [PATCH 04/22] staging: lustre: ldlm: xattr locks are lost on mdt James Simmons
2018-04-16  4:14 ` [PATCH 05/22] staging: lustre: llite: handle xattr cache refill race James Simmons
2018-04-16  4:14 ` [PATCH 06/22] staging: lustre: llite: Remove filtering of seclabel xattr James Simmons
2018-04-16  4:14 ` [PATCH 07/22] staging: lustre: llite: refactor lustre.lov xattr handling James Simmons
2018-04-16  4:14 ` [PATCH 08/22] staging: lustre: llite: add simple comment about lustre.lov xattrs James Simmons
2018-04-16  4:14 ` [PATCH 09/22] staging: lustre: llite: break up ll_setstripe_ea function James Simmons
2018-04-16  4:14 ` [PATCH 10/22] staging: lustre: llite: return from ll_adjust_lum() if lump is NULL James Simmons
2018-04-16  4:15 ` [PATCH 11/22] staging: lustre: llite: eat -EEXIST on setting trusted.lov James Simmons
2018-04-16  4:15 ` [PATCH 12/22] staging: lustre: llite: fix invalid size test in ll_setstripe_ea() James Simmons
2018-04-16  4:15 ` [PATCH 13/22] staging: lustre: llite: remove newline in fullname strings James Simmons
2018-04-16  4:15 ` [PATCH 14/22] staging: lustre: llite: record in stats attempted removal of lma/link xattr James Simmons
2018-04-16  4:15 ` [PATCH 15/22] staging: lustre: llite: cleanup posix acl xattr code James Simmons
2018-04-16  4:15 ` [PATCH 16/22] staging: lustre: llite: use proper types in the " James Simmons
2018-04-16  4:15 ` [PATCH 17/22] staging: lustre: llite: cleanup xattr code comments James Simmons
2018-04-16  4:15 ` [PATCH 18/22] staging: lustre: llite: style changes in xattr.c James Simmons
2018-04-16  4:15 ` [PATCH 19/22] staging: lustre: llite: add support set_acl method in inode operations James Simmons
2018-04-17  8:38   ` Dan Carpenter [this message]
2018-04-16  4:15 ` [PATCH 20/22] staging: lustre: llite: use xattr_handler name for ACLs James Simmons
2018-04-16  4:15 ` [PATCH 21/22] staging: lustre: llite: correct removexattr detection James Simmons
2018-04-16  4:15 ` [PATCH 22/22] staging: lustre: llite: remove unused parameters from md_{get, set}xattr() James Simmons
2018-04-23 12:58 ` [PATCH 00/22] staging: lustre: llite: fix xattr handling Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180417083854.7dgypv3eu4tc4e2c@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dmitry.eremin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.hammond@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.com \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®