2009-12-21 11:51:01

by liu weni

[permalink] [raw]
Subject: [PATCHv2 03/12]posix_acl: Add the check items

move the ACL validation check in to fs/posix_acl.c.
Including nullpointer check and PTR_ERR check.

---
Signed-off-by: Liuwenyi <[email protected]>
Cc: Al Viro <[email protected]>
Cc: James Morris <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index a99e543..480fe88 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -403,13 +403,11 @@ ext2_xattr_set_acl(struct dentry *dentry, const
char *name, const void *value,

if (value) {
acl = posix_acl_from_xattr(value, size);
- if (IS_ERR(acl))
- return PTR_ERR(acl);
- else if (acl) {
- error = posix_acl_valid(acl);
- if (error)
- goto release_and_out;
- }
+
+ error = posix_acl_valid(acl);
+ if (error)
+ goto release_and_out;
+
} else
acl = NULL;


--
Best Regards,
Liuwenyi


2009-12-21 15:39:28

by Serge E. Hallyn

[permalink] [raw]
Subject: Re: [PATCHv2 03/12]posix_acl: Add the check items

Quoting Liuwenyi ([email protected]):
> move the ACL validation check in to fs/posix_acl.c.
> Including nullpointer check and PTR_ERR check.
>
> ---
> Signed-off-by: Liuwenyi <[email protected]>
> Cc: Al Viro <[email protected]>
> Cc: James Morris <[email protected]>
> Cc: Joel Becker <[email protected]>
> Cc: Serge Hallyn <[email protected]>
> Cc: Christoph Hellwig <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
>
> ---
> diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
> index a99e543..480fe88 100644
> --- a/fs/ext2/acl.c
> +++ b/fs/ext2/acl.c
> @@ -403,13 +403,11 @@ ext2_xattr_set_acl(struct dentry *dentry, const
> char *name, const void *value,
>
> if (value) {
> acl = posix_acl_from_xattr(value, size);
> - if (IS_ERR(acl))
> - return PTR_ERR(acl);
> - else if (acl) {
> - error = posix_acl_valid(acl);
> - if (error)
> - goto release_and_out;
> - }
> +
> + error = posix_acl_valid(acl);
> + if (error)
> + goto release_and_out;

Don't you also need to either update posix_acl_release() in your
first patch to handle IS_ERR(acl), or else update the release_and_out:
path in each caller?

> +
> } else
> acl = NULL;
>
>
> --
> Best Regards,
> Liuwenyi