All of lore.kernel.org
 help / color / mirror / Atom feed
From: ZhangZhen <zhenzhang.zhang@huawei.com>
To: Jan Kara <jack@suse.cz>, <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>
Subject: [PATCH] ext2/3: check the acl's validity before setting
Date: Tue, 8 Apr 2014 10:04:09 +0800	[thread overview]
Message-ID: <53435919.7000509@huawei.com> (raw)
In-Reply-To: <1396922030-4800-1-git-send-email-zhenzhang.zhang@huawei.com>

Before setting the acl, call posix_acl_valid() to check if it is
valid or not.

Signed-off-by: zhang zhen <zhenzhang.zhang@huawei.com>
---
 fs/ext2/acl.c |    6 ++++++
 fs/ext3/acl.c |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 27695e6..64b53b8 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -189,6 +189,12 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 	size_t size = 0;
 	int error;

+	if (acl) {
+		error = posix_acl_valid(acl);
+		if (error < 0)
+			return error;
+	}
+
 	switch(type) {
 		case ACL_TYPE_ACCESS:
 			name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 8bbaf5b..68f873a 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -191,6 +191,12 @@ __ext3_set_acl(handle_t *handle, struct inode *inode, int type,
 	size_t size = 0;
 	int error;

+	if (acl) {
+		error = posix_acl_valid(acl);
+		if (error < 0)
+			return error;
+	}
+
 	switch(type) {
 		case ACL_TYPE_ACCESS:
 			name_index = EXT3_XATTR_INDEX_POSIX_ACL_ACCESS;
-- 
1.6.0.2





       reply	other threads:[~2014-04-08  2:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1396922030-4800-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-04-08  2:04 ` ZhangZhen [this message]
2014-04-08 15:30   ` [PATCH] ext2/3: check the acl's validity before setting Theodore Ts'o

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=53435919.7000509@huawei.com \
    --to=zhenzhang.zhang@huawei.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.