Skip to contentSkip to conversation

ext2/3: check the acl's validity before setting

PATCH In review ZhangZhen 2 participants 2 messages Apr 8, 2014 1 message not in the archive ext2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

ZhangZhen

author
#1 lore raw

PATCH 1/1 ext2/3: check the acl's validity before setting

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

---
 fs/ext2/acl.c |    6 ++++++
 fs/ext3/acl.c |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
fs/ext2/acl.c +6 -0
index 27695e6..64b53b8 100644
@@ -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;
fs/ext3/acl.c +6 -0
index 8bbaf5b..68f873a 100644
@@ -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;
Signature · 1 line
1.6.0.2
#2 lore raw
Quoted 4 lines · ZhangZhen

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

As Christoph noted, this isn't needed since this check is done in the VFS.

- Ted