Skip to content

Commit

Permalink
securityfs: securityfs_remove should handle IS_ERR pointers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
eparis authored and James Morris committed May 12, 2009
1 parent 1a62e95 commit d93e4c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d93e4c9

Please sign in to comment.