Skip to content

Commit e25fc55

Browse files
author
Al Viro
committed
evm_secfs: clear securityfs interactions
1) creation never returns NULL; error is reported as ERR_PTR() 2) no need to remove file before removing its parent Acked-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent d15ffbb commit e25fc55

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

security/integrity/evm/evm_secfs.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "evm.h"
1818

1919
static struct dentry *evm_dir;
20-
static struct dentry *evm_init_tpm;
2120
static struct dentry *evm_symlink;
2221

2322
#ifdef CONFIG_EVM_ADD_XATTRS
@@ -286,7 +285,7 @@ static int evm_init_xattrs(void)
286285
{
287286
evm_xattrs = securityfs_create_file("evm_xattrs", 0660, evm_dir, NULL,
288287
&evm_xattr_ops);
289-
if (!evm_xattrs || IS_ERR(evm_xattrs))
288+
if (IS_ERR(evm_xattrs))
290289
return -EFAULT;
291290

292291
return 0;
@@ -301,21 +300,22 @@ static int evm_init_xattrs(void)
301300
int __init evm_init_secfs(void)
302301
{
303302
int error = 0;
303+
struct dentry *dentry;
304304

305305
evm_dir = securityfs_create_dir("evm", integrity_dir);
306-
if (!evm_dir || IS_ERR(evm_dir))
306+
if (IS_ERR(evm_dir))
307307
return -EFAULT;
308308

309-
evm_init_tpm = securityfs_create_file("evm", 0660,
310-
evm_dir, NULL, &evm_key_ops);
311-
if (!evm_init_tpm || IS_ERR(evm_init_tpm)) {
309+
dentry = securityfs_create_file("evm", 0660,
310+
evm_dir, NULL, &evm_key_ops);
311+
if (IS_ERR(dentry)) {
312312
error = -EFAULT;
313313
goto out;
314314
}
315315

316316
evm_symlink = securityfs_create_symlink("evm", NULL,
317317
"integrity/evm/evm", NULL);
318-
if (!evm_symlink || IS_ERR(evm_symlink)) {
318+
if (IS_ERR(evm_symlink)) {
319319
error = -EFAULT;
320320
goto out;
321321
}
@@ -328,7 +328,6 @@ int __init evm_init_secfs(void)
328328
return 0;
329329
out:
330330
securityfs_remove(evm_symlink);
331-
securityfs_remove(evm_init_tpm);
332331
securityfs_remove(evm_dir);
333332
return error;
334333
}

0 commit comments

Comments
 (0)