Skip to content

Commit 04d76ce

Browse files
rostedtroxanan1996
authored andcommitted
tracefs: Add missing lockdown check to tracefs_create_dir()
BugLink: https://bugs.launchpad.net/bugs/2043422 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/20230905182711.692687042@goodmis.org Link: https://lore.kernel.org/all/202309050916.58201dc6-oliver.sang@intel.com/ Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ajay Kaher <akaher@vmware.com> Cc: Ching-lin Yu <chinglinyu@google.com> Fixes: bf8e602 ("tracing: Do not create tracefs files if tracefs lockdown is in effect") Reported-by: kernel test robot <oliver.sang@intel.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 25aa18c commit 04d76ce

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
@@ -556,6 +556,9 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
556556
*/
557557
struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
558558
{
559+
if (security_locked_down(LOCKDOWN_TRACEFS))
560+
return NULL;
561+
559562
return __create_dir(name, parent, &simple_dir_inode_operations);
560563
}
561564

0 commit comments

Comments
 (0)