]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Check field value in hist_field_name()
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 2 Mar 2023 01:00:53 +0000 (20:00 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:59 +0000 (13:33 +0100)
commit16fbd09a20a8bc5a90239c8d033d43c7c9c06ddd
treead9be11895c5ae11a09dffcbaaa35dcaa1af2f41
parentc008beb34430e5119bb7f2b276056d7d4e515a39
tracing: Check field value in hist_field_name()

commit afe8943e3ea46cdab497549b235ba28adf3ecfad upstream.

The function hist_field_name() cannot handle being passed a NULL field
parameter. It should never be NULL, but due to a previous bug, NULL was
passed to the function and the kernel crashed due to a NULL dereference.
Mark Rutland reported this to me on IRC.

The bug was fixed, but to prevent future bugs from crashing the kernel,
check the field and add a WARN_ON() if it is NULL.

Link: https://lkml.kernel.org/r/20230302020810.762384440@goodmis.org
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Mark Rutland <mark.rutland@arm.com>
Fixes: 64363d35e3295 ("tracing: Add hist trigger 'sym' and 'sym-offset' modifiers")
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace_events_hist.c