Commit 206237b1 authored by Steven Rostedt (Google)'s avatar Steven Rostedt (Google) Committed by sanglipeng
Browse files

tracing: Check field value in hist_field_name()

stable inclusion
from stable-v5.10.176
commit 8ae86ef7a0580135ac6d0afce3e16e2c9e4b8e96
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8CHVQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8ae86ef7a0580135ac6d0afce3e16e2c9e4b8e96

--------------------------------

commit 9f116f76 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: default avatarMark Rutland <mark.rutland@arm.com>
Fixes: c6afad49 ("tracing: Add hist trigger 'sym' and 'sym-offset' modifiers")
Tested-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 9a5fb8a0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment