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: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH 4/8] tracing/probe: Check maxactive error cases
Date: Fri, 15 Mar 2019 14:45:09 -0400	[thread overview]
Message-ID: <20190315184536.759437856@goodmis.org> (raw)
In-Reply-To: <20190315184505.655928086@goodmis.org>

From: Masami Hiramatsu <mhiramat@kernel.org>

Check maxactive on kprobe error case, because maxactive
is only for kretprobe, not for kprobe. Also, maxactive
should not be 0, it should be at least 1.

Link: http://lkml.kernel.org/r/155253780952.14922.15784129810238750331.stgit@devnote2

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_kprobe.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index ceafa0a2b1d1..a14837545295 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -624,7 +624,11 @@ static int trace_kprobe_create(int argc, const char *argv[])
 	if (event)
 		event++;
 
-	if (is_return && isdigit(argv[0][1])) {
+	if (isdigit(argv[0][1])) {
+		if (!is_return) {
+			pr_info("Maxactive is not for kprobe");
+			return -EINVAL;
+		}
 		if (event)
 			len = event - &argv[0][1] - 1;
 		else
@@ -634,8 +638,8 @@ static int trace_kprobe_create(int argc, const char *argv[])
 		memcpy(buf, &argv[0][1], len);
 		buf[len] = '\0';
 		ret = kstrtouint(buf, 0, &maxactive);
-		if (ret) {
-			pr_info("Failed to parse maxactive.\n");
+		if (ret || !maxactive) {
+			pr_info("Invalid maxactive number\n");
 			return ret;
 		}
 		/* kretprobes instances are iterated over via a list. The
-- 
2.20.1



  parent reply	other threads:[~2019-03-15 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 18:45 [PATCH 0/8] [GIT PULL] tracing: Minor clean ups, fixes and error checking Steven Rostedt
2019-03-15 18:45 ` [PATCH 1/8] tracing/probes: Make reserved_field_names static Steven Rostedt
2019-03-15 18:45 ` [PATCH 2/8] trace/probes: Remove kernel doc style from non kernel doc comment Steven Rostedt
2019-03-15 18:45 ` [PATCH 3/8] tracing: kdb: Fix ftdump to not sleep Steven Rostedt
2019-03-15 18:45 ` Steven Rostedt [this message]
2019-03-15 18:45 ` [PATCH 5/8] tracing/probe: Check event name length correctly Steven Rostedt
2019-03-15 18:45 ` [PATCH 6/8] tracing/probe: Check the size of argument name and body Steven Rostedt
2019-03-15 18:45 ` [PATCH 7/8] tracing/probe: Check event/group naming rule at parsing Steven Rostedt
2019-03-15 18:45 ` [PATCH 8/8] tracing/probe: Verify alloc_trace_*probe() result 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=20190315184536.759437856@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome