summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-15 16:00:25 -0500
committerJames Morris <james.morris@microsoft.com>2019-04-10 10:34:29 -0700
commitd1a0846006e4325cc951ca0b05c02ed1d0865006 (patch)
tree53172e71d612f2300b07e4792f35ba02b5416849 /security
parent0b9dc6c9f01c4a726558b82a3b6082a89d264eb5 (diff)
downloadlinux-stable-d1a0846006e4325cc951ca0b05c02ed1d0865006.tar.gz
linux-stable-d1a0846006e4325cc951ca0b05c02ed1d0865006.tar.bz2
linux-stable-d1a0846006e4325cc951ca0b05c02ed1d0865006.zip
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 <kjlu@umn.edu> Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security')
-rw-r--r--security/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/security/inode.c b/security/inode.c
index b7772a9b315e..667f8b15027d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -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;
}