mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] securityfs: securityfs_remove should handle IS_ERR pointers
@ 2009-05-12  0:47 Eric Paris
  2009-05-12  1:35 ` James Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Paris @ 2009-05-12  0:47 UTC (permalink / raw)
  To: jmorris; +Cc: linux-kernel

Both of the securityfs users (TPM and IMA) can call securityfs_remove and pass
an IS_ERR(dentry) in their failure paths.  This patch handles those rather
than panicing when it tries to start deferencing some negative memory.

Signed-off-by: Eric Paris <eparis@redhat.com>
---

 security/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/security/inode.c b/security/inode.c
index f3b91bf..f7496c6 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -287,7 +287,7 @@ void securityfs_remove(struct dentry *dentry)
 {
 	struct dentry *parent;
 
-	if (!dentry)
+	if (!dentry || IS_ERR(dentry))
 		return;
 
 	parent = dentry->d_parent;


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

* Re: [PATCH] securityfs: securityfs_remove should handle IS_ERR pointers
  2009-05-12  0:47 [PATCH] securityfs: securityfs_remove should handle IS_ERR pointers Eric Paris
@ 2009-05-12  1:35 ` James Morris
  0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2009-05-12  1:35 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-kernel

On Mon, 11 May 2009, Eric Paris wrote:

> Both of the securityfs users (TPM and IMA) can call securityfs_remove and pass
> an IS_ERR(dentry) in their failure paths.  This patch handles those rather
> than panicing when it tries to start deferencing some negative memory.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>

Applied to 
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next

> ---
> 
>  security/inode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/security/inode.c b/security/inode.c
> index f3b91bf..f7496c6 100644
> --- a/security/inode.c
> +++ b/security/inode.c
> @@ -287,7 +287,7 @@ void securityfs_remove(struct dentry *dentry)
>  {
>  	struct dentry *parent;
>  
> -	if (!dentry)
> +	if (!dentry || IS_ERR(dentry))
>  		return;
>  
>  	parent = dentry->d_parent;
> 

-- 
James Morris
<jmorris@namei.org>

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

end of thread, other threads:[~2009-05-12  1:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-12  0:47 [PATCH] securityfs: securityfs_remove should handle IS_ERR pointers Eric Paris
2009-05-12  1:35 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®