mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: koloskov <koloskov@ispras.ru>
To: <dwmw2@infradead.org>, <linux-mtd@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: jffs2: Do not rewrite posix_acl_equiv_mode() result in  jffs2_set_acl()
Date: Thu, 05 Feb 2015 11:20:08 +0300	[thread overview]
Message-ID: <028837a9a50ec9241d93c26d2daba477@ispras.ru> (raw)
In-Reply-To: <f75d56ff5d79c7a3b16e3579ed10ca4c@ispras.ru>

 From ad03fe743959c04a9e7d611c026c201a14ce0ed6 Mon Sep 17 00:00:00 2001
 From: Andrey Koloskov <koloskov@ispras.ru>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

Date: Tue, 13 Jan 2015 14:37:18 +0400
Subject: [PATCH] jffs2: Do not rewrite posix_acl_equiv_mode() result in
  jffs2_set_acl()

Result of posix_acl_equiv_mode() is rewritten with one of 
jffs2_do_setattr(),
so it is always assumed that acl can be exactly represented by the
traditional file mode permission bits.

The patch adds a new variable for store result of 
posix_acl_equiv_mode().

Found by Linux File System Verification project (linuxtesting.org).

Signed-off-by: Andrey Koloskov <koloskov@ispras.ru>
---
  fs/jffs2/acl.c |   10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 2f7a3c0..63705bd 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -229,16 +229,16 @@ static int __jffs2_set_acl(struct inode *inode, 
int xprefix, struct posix_acl *a

  int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int 
type)
  {
-	int rc, xprefix;
+	int rc, xprefix, not_equiv;

  	switch (type) {
  	case ACL_TYPE_ACCESS:
  		xprefix = JFFS2_XPREFIX_ACL_ACCESS;
  		if (acl) {
  			umode_t mode = inode->i_mode;
-			rc = posix_acl_equiv_mode(acl, &mode);
-			if (rc < 0)
-				return rc;
+			not_equiv = posix_acl_equiv_mode(acl, &mode);
+			if (not_equiv < 0)
+				return not_equiv;
  			if (inode->i_mode != mode) {
  				struct iattr attr;

@@ -249,7 +249,7 @@ int jffs2_set_acl(struct inode *inode, struct 
posix_acl *acl, int type)
  				if (rc < 0)
  					return rc;
  			}
-			if (rc == 0)
+			if (not_equiv == 0)
  				acl = NULL;
  		}
  		break;
-- 
1.7.9.5


      reply	other threads:[~2015-02-05  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 11:17 koloskov
2015-02-05  8:20 ` koloskov [this message]

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=028837a9a50ec9241d93c26d2daba477@ispras.ru \
    --to=koloskov@ispras.ru \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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®