Skip to content

Commit 51aab5f

Browse files
committed
tracefs: Add missing lockdown check to tracefs_create_dir()
The function tracefs_create_dir() was missing a lockdown check and was called by the RV code. This gave an inconsistent behavior of this function returning success while other tracefs functions failed. This caused the inode being freed by the wrong kmem_cache. Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/all/[email protected]/ Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Ajay Kaher <[email protected]> Cc: Ching-lin Yu <[email protected]> Fixes: bf8e602 ("tracing: Do not create tracefs files if tracefs lockdown is in effect") Reported-by: kernel test robot <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent cbb557b commit 51aab5f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/tracefs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,9 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
673673
*/
674674
struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
675675
{
676+
if (security_locked_down(LOCKDOWN_TRACEFS))
677+
return NULL;
678+
676679
return __create_dir(name, parent, &simple_dir_inode_operations);
677680
}
678681

0 commit comments

Comments
 (0)