Browse Source

securityfs: securityfs_remove should handle IS_ERR pointers

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>
Signed-off-by: James Morris <jmorris@namei.org>
Eric Paris 16 năm trước cách đây
mục cha
commit
d93e4c940f
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      security/inode.c

+ 1 - 1
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;