From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>,
Ammar Faizi <ammarfaizi2@gnuweeb.org>
Subject: [for-next][PATCH 15/21] tracing: Return -EINVAL if WARN_ON(!glob) triggered in event_hist_trigger_parse()
Date: Wed, 27 Apr 2022 15:36:38 -0400 [thread overview]
Message-ID: <20220427193642.218154566@goodmis.org> (raw)
In-Reply-To: 20220427193623.529296556@goodmis.org
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
If `WARN_ON(!glob)` is ever triggered, we will still continue executing
the next lines. This will trigger the more serious problem, a NULL
pointer dereference bug.
Just return -EINVAL if @glob is NULL.
Link: https://lkml.kernel.org/r/20220417185630.199062-2-ammarfaizi2@gnuweeb.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 998dfe2162fc..80c25be23c45 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -6214,7 +6214,8 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,
lockdep_assert_held(&event_mutex);
- WARN_ON(!glob);
+ if (WARN_ON(!glob))
+ return -EINVAL;
if (strlen(glob)) {
hist_err_clear();
--
2.35.1
next prev parent reply other threads:[~2022-04-27 19:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 19:36 [for-next][PATCH 00/21] tracing: Updates for 5.19 Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 01/21] tracing: Cleanup double word in comment Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 02/21] tracing: Remove logic for registering multiple event triggers at a time Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 03/21] tracing: Remove redundant trigger_ops params Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 04/21] tracing: Have existing event_command.parse() implementations use helpers Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 05/21] tracing: Separate hist state updates from hist registration Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 06/21] tracing: Fix inconsistent style of mini-HOWTO Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 07/21] tracing: Fix kernel-doc Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 08/21] MAINTAINERS: Enlarge coverage of TRACING inside architectures Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 09/21] tracing: Fix tracing_map_sort_entries() kernel-doc comment Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 10/21] bootconfig: Make the bootconfig.o as a normal object file Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 11/21] bootconfig: Check the checksum before removing the bootconfig from initrd Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 12/21] bootconfig: Support embedding a bootconfig file in kernel Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 13/21] docs: bootconfig: Add how to embed the bootconfig into kernel Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 14/21] tracing: Make tp_printk work on syscall tracepoints Steven Rostedt
2022-04-27 19:36 ` Steven Rostedt [this message]
2022-04-27 19:36 ` [for-next][PATCH 16/21] tracing: Change `if (strlen(glob))` to `if (glob[0])` Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 17/21] tracing: Fix sleeping function called from invalid context on RT kernel Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 18/21] tracing: Use WARN instead of printk and WARN_ON Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 19/21] ring-buffer: Simplify if-if to if-else Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 20/21] tracing: Avoid adding tracer option before update_tracer_options Steven Rostedt
2022-04-27 19:36 ` [for-next][PATCH 21/21] tracing: make tracer_init_tracefs initcall asynchronous Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220427193642.218154566@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=ammarfaizi2@gnuweeb.org \
--cc=gwml@vger.gnuweeb.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox