Skip to content

Commit d1a0846

Browse files
kengiterJames Morris
authored andcommitted
security: inode: fix a missing check for securityfs_create_file
securityfs_create_file may fail. The fix checks its status and returns the error code upstream if it fails. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: James Morris <[email protected]>
1 parent 0b9dc6c commit d1a0846

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

security/inode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ static int __init securityfs_init(void)
339339
#ifdef CONFIG_SECURITY
340340
lsm_dentry = securityfs_create_file("lsm", 0444, NULL, NULL,
341341
&lsm_ops);
342+
if (IS_ERR(lsm_dentry)) {
343+
unregister_filesystem(&fs_type);
344+
sysfs_remove_mount_point(kernel_kobj, "security");
345+
return PTR_ERR(lsm_dentry);
346+
}
342347
#endif
343348
return 0;
344349
}

0 commit comments

Comments
 (0)