From: Masami Hiramatsu Date: Tue, 28 Aug 2018 16:17:47 +0000 (+0900) Subject: tracing/uprobes: Fix to return -EFAULT if copy_from_user failed X-Git-Tag: v5.4-rc1~2307^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3f58935edbcb33fd529fc46d554162a0660fd2d;p=platform%2Fkernel%2Flinux-rpi.git tracing/uprobes: Fix to return -EFAULT if copy_from_user failed Fix probe_mem_read() to return -EFAULT if copy_from_user() failed. The copy_from_user() returns remaining bytes when it failed, but probe_mem_read() caller expects it returns error code like as probe_kernel_read(). Link: http://lkml.kernel.org/r/153547306719.26502.8353484532699160223.stgit@devbox Reported-by: Dan Carpenter Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) --- diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 394b935..31ea48e 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -105,7 +105,7 @@ probe_mem_read(void *dest, void *src, size_t size) { void __user *vaddr = (void __force __user *)src; - return copy_from_user(dest, vaddr, size); + return copy_from_user(dest, vaddr, size) ? -EFAULT : 0; } /* * Fetch a null-terminated string. Caller MUST set *(u32 *)dest with max