linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] apparmor: Fix an error code in aafs_create()
@ 2017-07-13  7:39 Dan Carpenter
  2017-07-13 20:07 ` Serge E. Hallyn
  2017-07-13 20:22 ` John Johansen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:39 UTC (permalink / raw)
  To: linux-security-module

We accidentally forgot to set the error code on this path.  It means we
return NULL instead of an error pointer.  I looked through a bunch of
callers and I don't think it really causes a big issue, but the
documentation says we're supposed to return error pointers here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 853c2ec8e0c9..2caeb748070c 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -248,8 +248,10 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
 
 	inode_lock(dir);
 	dentry = lookup_one_len(name, parent, strlen(name));
-	if (IS_ERR(dentry))
+	if (IS_ERR(dentry)) {
+		error = PTR_ERR(dentry);
 		goto fail_lock;
+	}
 
 	if (d_really_is_positive(dentry)) {
 		error = -EEXIST;
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] apparmor: Fix an error code in aafs_create()
  2017-07-13  7:39 [PATCH] apparmor: Fix an error code in aafs_create() Dan Carpenter
@ 2017-07-13 20:07 ` Serge E. Hallyn
  2017-07-13 20:22 ` John Johansen
  1 sibling, 0 replies; 3+ messages in thread
From: Serge E. Hallyn @ 2017-07-13 20:07 UTC (permalink / raw)
  To: linux-security-module

Quoting Dan Carpenter (dan.carpenter at oracle.com):
> We accidentally forgot to set the error code on this path.  It means we
> return NULL instead of an error pointer.  I looked through a bunch of
> callers and I don't think it really causes a big issue, but the
> documentation says we're supposed to return error pointers here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Serge Hallyn <serge@hallyn.com>

thanks,
-serge

> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 853c2ec8e0c9..2caeb748070c 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -248,8 +248,10 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
>  
>  	inode_lock(dir);
>  	dentry = lookup_one_len(name, parent, strlen(name));
> -	if (IS_ERR(dentry))
> +	if (IS_ERR(dentry)) {
> +		error = PTR_ERR(dentry);
>  		goto fail_lock;
> +	}
>  
>  	if (d_really_is_positive(dentry)) {
>  		error = -EEXIST;
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] apparmor: Fix an error code in aafs_create()
  2017-07-13  7:39 [PATCH] apparmor: Fix an error code in aafs_create() Dan Carpenter
  2017-07-13 20:07 ` Serge E. Hallyn
@ 2017-07-13 20:22 ` John Johansen
  1 sibling, 0 replies; 3+ messages in thread
From: John Johansen @ 2017-07-13 20:22 UTC (permalink / raw)
  To: linux-security-module

On 07/13/2017 12:39 AM, Dan Carpenter wrote:
> We accidentally forgot to set the error code on this path.  It means we
> return NULL instead of an error pointer.  I looked through a bunch of
> callers and I don't think it really causes a big issue, but the
> documentation says we're supposed to return error pointers here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
Acked-by: John Johansen <john.johansen@canonical.com>

I've pulled it into my tree

> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index 853c2ec8e0c9..2caeb748070c 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -248,8 +248,10 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
>  
>  	inode_lock(dir);
>  	dentry = lookup_one_len(name, parent, strlen(name));
> -	if (IS_ERR(dentry))
> +	if (IS_ERR(dentry)) {
> +		error = PTR_ERR(dentry);
>  		goto fail_lock;
> +	}
>  
>  	if (d_really_is_positive(dentry)) {
>  		error = -EEXIST;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-07-13 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13  7:39 [PATCH] apparmor: Fix an error code in aafs_create() Dan Carpenter
2017-07-13 20:07 ` Serge E. Hallyn
2017-07-13 20:22 ` John Johansen

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).