Skip to content

Commit 287c038

Browse files
mhiramatrostedt
authored andcommitted
tracing/probe: Check maxactive error cases
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>
1 parent 31b265b commit 287c038

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,11 @@ static int trace_kprobe_create(int argc, const char *argv[])
624624
if (event)
625625
event++;
626626

627-
if (is_return && isdigit(argv[0][1])) {
627+
if (isdigit(argv[0][1])) {
628+
if (!is_return) {
629+
pr_info("Maxactive is not for kprobe");
630+
return -EINVAL;
631+
}
628632
if (event)
629633
len = event - &argv[0][1] - 1;
630634
else
@@ -634,8 +638,8 @@ static int trace_kprobe_create(int argc, const char *argv[])
634638
memcpy(buf, &argv[0][1], len);
635639
buf[len] = '\0';
636640
ret = kstrtouint(buf, 0, &maxactive);
637-
if (ret) {
638-
pr_info("Failed to parse maxactive.\n");
641+
if (ret || !maxactive) {
642+
pr_info("Invalid maxactive number\n");
639643
return ret;
640644
}
641645
/* kretprobes instances are iterated over via a list. The

0 commit comments

Comments
 (0)