linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: check the acl's validity before setting
       [not found] <1396922063-4879-1-git-send-email-zhenzhang.zhang@huawei.com>
@ 2014-04-08  2:02 ` ZhangZhen
  2014-04-08  5:46   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: ZhangZhen @ 2014-04-08  2:02 UTC (permalink / raw)
  To: tytso, Jan Kara; +Cc: linux-ext4

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/ext4/acl.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index d40c8db..97f7650 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -197,6 +197,12 @@ __ext4_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 = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
-- 
1.6.0.2





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: check the acl's validity before setting
  2014-04-08  2:02 ` [PATCH] ext4: check the acl's validity before setting ZhangZhen
@ 2014-04-08  5:46   ` Christoph Hellwig
  2014-04-08  8:59     ` ZhangZhen
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2014-04-08  5:46 UTC (permalink / raw)
  To: ZhangZhen; +Cc: tytso, Jan Kara, linux-ext4

On Tue, Apr 08, 2014 at 10:02:50AM +0800, ZhangZhen wrote:
> Before setting the acl, call posix_acl_valid() to check if it is
> valid or not.

Why? posix_acl_xattr_set already does that for you, and it's the only
way to feed in an ACL from userspace.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: check the acl's validity before setting
  2014-04-08  5:46   ` Christoph Hellwig
@ 2014-04-08  8:59     ` ZhangZhen
  2014-04-08 10:40       ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: ZhangZhen @ 2014-04-08  8:59 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: tytso, Jan Kara, linux-ext4

On 2014/4/8 13:46, Christoph Hellwig wrote:
> On Tue, Apr 08, 2014 at 10:02:50AM +0800, ZhangZhen wrote:
>> Before setting the acl, call posix_acl_valid() to check if it is
>> valid or not.
> 
> Why? posix_acl_xattr_set already does that for you, and it's the only
> way to feed in an ACL from userspace.
> 
> 
> 
Hi Hellwig,

You are right, this patch is useless. I'm sorry for this spam mail.

But btrfs_set_acl checks the validity of the ACL too. Should we delete it?
Another choice is we can check the validity in every fs tree, and delete the
check from posix_acl_xattr_set.

How should we do?

Thanks!



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: check the acl's validity before setting
  2014-04-08  8:59     ` ZhangZhen
@ 2014-04-08 10:40       ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2014-04-08 10:40 UTC (permalink / raw)
  To: ZhangZhen; +Cc: Christoph Hellwig, tytso, Jan Kara, linux-ext4

On Tue, Apr 08, 2014 at 04:59:48PM +0800, ZhangZhen wrote:
> You are right, this patch is useless. I'm sorry for this spam mail.
> 
> But btrfs_set_acl checks the validity of the ACL too. Should we delete it?
> Another choice is we can check the validity in every fs tree, and delete the
> check from posix_acl_xattr_set.

Doing it in common code is the right thing.  I suspect btrfs having it
is an oversight, but please verify it with the btrfs maintainers.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-08 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1396922063-4879-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-04-08  2:02 ` [PATCH] ext4: check the acl's validity before setting ZhangZhen
2014-04-08  5:46   ` Christoph Hellwig
2014-04-08  8:59     ` ZhangZhen
2014-04-08 10:40       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).