Skip to content

Commit

Permalink
tracefs: Add missing lockdown check to tracefs_create_dir()
Browse files Browse the repository at this point in the history
commit 51aab5f upstream.

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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
rostedt authored and gregkh committed Sep 23, 2023
1 parent 576d25c commit 2ec4d50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/tracefs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
*/
struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
{
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;

return __create_dir(name, parent, &simple_dir_inode_operations);
}

Expand Down

0 comments on commit 2ec4d50

Please sign in to comment.