mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Beau Belgrave <beaub@linux.microsoft.com>
Subject: [for-next][PATCH 05/11] tracing: Do not let synth_events block other dyn_event systems during create
Date: Sat, 11 Dec 2021 20:26:22 -0500	[thread overview]
Message-ID: <20211212012645.494928680@goodmis.org> (raw)
In-Reply-To: <20211212012617.690710310@goodmis.org>

From: Beau Belgrave <beaub@linux.microsoft.com>

synth_events is returning -EINVAL if the dyn_event create command does
not contain ' \t'. This prevents other systems from getting called back.
synth_events needs to return -ECANCELED in these cases when the command
is not targeting the synth_event system.

Link: https://lore.kernel.org/linux-trace-devel/20210930223821.11025-1-beaub@linux.microsoft.com

Fixes: c9e759b1e8456 ("tracing: Rework synthetic event command parsing")
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_synth.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 98e002648994..149011e34ad9 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -2053,6 +2053,13 @@ static int create_synth_event(const char *raw_command)
 
 	last_cmd_set(raw_command);
 
+	name = raw_command;
+
+	/* Don't try to process if not our system */
+	if (name[0] != 's' || name[1] != ':')
+		return -ECANCELED;
+	name += 2;
+
 	p = strpbrk(raw_command, " \t");
 	if (!p) {
 		synth_err(SYNTH_ERR_INVALID_CMD, 0);
@@ -2061,12 +2068,6 @@ static int create_synth_event(const char *raw_command)
 
 	fields = skip_spaces(p);
 
-	name = raw_command;
-
-	if (name[0] != 's' || name[1] != ':')
-		return -ECANCELED;
-	name += 2;
-
 	/* This interface accepts group name prefix */
 	if (strchr(name, '/')) {
 		len = str_has_prefix(name, SYNTH_SYSTEM "/");
-- 
2.33.0

  parent reply	other threads:[~2021-12-12  1:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12  1:26 [for-next][PATCH 00/11] tracing: More updates for 5.17 Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 01/11] tracing: Make trace_marker{,_raw} stream-like Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 02/11] script/sorttable: Code style improvements Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 03/11] tracefs: Use d_inode() helper function to get the dentry inode Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 04/11] tracing: Iterate trace_[ku]probe objects directly Steven Rostedt
2021-12-12  1:26 ` Steven Rostedt [this message]
2021-12-12  1:26 ` [for-next][PATCH 06/11] tracing: Use memset_startat helper in trace_iterator_reset() Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 07/11] tracing: Use trace_iterator_reset() in tracing_read_pipe() Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 08/11] tracing: Change event_command func() to parse() Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 09/11] tracing: Change event_trigger_ops func() to trigger() Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 10/11] tracing: Add helper functions to simplify event_command.parse() callback handling Steven Rostedt
2021-12-12  1:26 ` [for-next][PATCH 11/11] tracing: Have existing event_command.parse() implementations use helpers 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=20211212012645.494928680@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=beaub@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    /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

all inboxes | Powered by JetHome®