]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tracing/probe: Check maxactive error cases
authorMasami Hiramatsu <mhiramat@kernel.org>
Thu, 14 Mar 2019 04:30:09 +0000 (13:30 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 14 Mar 2019 23:53:29 +0000 (19:53 -0400)
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

index ceafa0a2b1d1d64022ca37372d33ffe3ed5d8385..a14837545295e292d9d30783736d7dc9273667a3 100644 (file)
@@ -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