diff mbox

[10/12] posix_acl: don't ignore return value of posix_acl_create_masq()

Message ID 1474028371-21288-11-git-send-email-mszeredi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Miklos Szeredi Sept. 16, 2016, 12:19 p.m. UTC
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/posix_acl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Andreas Grünbacher Sept. 16, 2016, 12:45 p.m. UTC | #1
2016-09-16 14:19 GMT+02:00 Miklos Szeredi <mszeredi@redhat.com>:
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> Cc: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  fs/posix_acl.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/fs/posix_acl.c b/fs/posix_acl.c
> index 59d47ab0791a..ea3eb6f3bf1e 100644
> --- a/fs/posix_acl.c
> +++ b/fs/posix_acl.c
> @@ -598,13 +598,14 @@ posix_acl_create(struct inode *dir, umode_t *mode,
>         if (IS_ERR(p))
>                 return PTR_ERR(p);
>
> +       ret = -ENOMEM;
>         clone = posix_acl_clone(p, GFP_NOFS);
>         if (!clone)
> -               goto no_mem;
> +               goto err_release;
>
>         ret = posix_acl_create_masq(clone, mode);
>         if (ret < 0)
> -               goto no_mem_clone;
> +               goto err_release_clone;
>
>         if (ret == 0)
>                 posix_acl_release(clone);
> @@ -618,11 +619,11 @@ posix_acl_create(struct inode *dir, umode_t *mode,
>
>         return 0;
>
> -no_mem_clone:
> +err_release_clone:
>         posix_acl_release(clone);
> -no_mem:
> +err_release:
>         posix_acl_release(p);
> -       return -ENOMEM;
> +       return ret;
>  }
>  EXPORT_SYMBOL_GPL(posix_acl_create);

Indeed, the return value of posix_acl_create_masq shouldn't be ignored
here. posix_acl_create_masq can still only fail when the default ACL
of the parent directory is corrupted as users are prohibited from
setting invalid default ACLs.

Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 59d47ab0791a..ea3eb6f3bf1e 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -598,13 +598,14 @@  posix_acl_create(struct inode *dir, umode_t *mode,
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
+	ret = -ENOMEM;
 	clone = posix_acl_clone(p, GFP_NOFS);
 	if (!clone)
-		goto no_mem;
+		goto err_release;
 
 	ret = posix_acl_create_masq(clone, mode);
 	if (ret < 0)
-		goto no_mem_clone;
+		goto err_release_clone;
 
 	if (ret == 0)
 		posix_acl_release(clone);
@@ -618,11 +619,11 @@  posix_acl_create(struct inode *dir, umode_t *mode,
 
 	return 0;
 
-no_mem_clone:
+err_release_clone:
 	posix_acl_release(clone);
-no_mem:
+err_release:
 	posix_acl_release(p);
-	return -ENOMEM;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(posix_acl_create);