perf/core: Fix perf_uprobe_init()
authorSong Liu <[email protected]>
Mon, 9 Apr 2018 18:31:30 +0000 (18:31 +0000)
committerIngo Molnar <[email protected]>
Tue, 10 Apr 2018 05:33:10 +0000 (07:33 +0200)
Similarly to the uprobe PMU fix in perf_kprobe_init(), fix error
handling in perf_uprobe_init() as well.

Reported-by: 范龙飞 <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Fixes: e12f03d7031a ("perf/core: Implement the 'perf_kprobe' PMU")
Signed-off-by: Ingo Molnar <[email protected]>
kernel/trace/trace_event_perf.c

index 94600f1f7efac5ab9787711e198023a08f7bf020..c79193e598f54fe928d331588d7169c6e0154de1 100644 (file)
@@ -302,6 +302,8 @@ int perf_uprobe_init(struct perf_event *p_event, bool is_retprobe)
                return -ENOMEM;
        ret = strncpy_from_user(
                path, u64_to_user_ptr(p_event->attr.uprobe_path), PATH_MAX);
+       if (ret == PATH_MAX)
+               return -E2BIG;
        if (ret < 0)
                goto out;
        if (path[0] == '\0') {