linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security: inode: fix a missing check for securityfs_create_file
@ 2019-03-15  4:09 Kangjie Lu
  2019-03-15 19:08 ` James Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Kangjie Lu @ 2019-03-15  4:09 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, James Morris, Serge E. Hallyn, linux-security-module,
	linux-kernel

securityfs_create_file  may fail. The fix checks its status and
returns EFAULT upstream if it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 security/inode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/security/inode.c b/security/inode.c
index b7772a9b315e..11d9a6bc2161 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 -EFAULT;
+	}
 #endif
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-10 22:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  4:09 [PATCH] security: inode: fix a missing check for securityfs_create_file Kangjie Lu
2019-03-15 19:08 ` James Morris
2019-03-15 21:00   ` Kangjie Lu
2019-03-15 22:34     ` Tetsuo Handa
2019-04-10 17:34     ` James Morris
2019-04-10 18:01       ` Al Viro
2019-04-10 22:00         ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).