Skip to content

Commit

Permalink
security: inode: fix a missing check for securityfs_create_file
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kengiter authored and James Morris committed Apr 10, 2019
1 parent 0b9dc6c commit d1a0846
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions security/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ static int __init securityfs_init(void)
#ifdef CONFIG_SECURITY
lsm_dentry = securityfs_create_file("lsm", 0444, NULL, NULL,
&lsm_ops);
if (IS_ERR(lsm_dentry)) {
unregister_filesystem(&fs_type);
sysfs_remove_mount_point(kernel_kobj, "security");
return PTR_ERR(lsm_dentry);
}
#endif
return 0;
}
Expand Down

0 comments on commit d1a0846

Please sign in to comment.