diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2018-08-29 01:17:47 +0900 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-10-10 22:19:11 -0400 |
commit | f3f58935edbcb33fd529fc46d554162a0660fd2d (patch) | |
tree | 2ab53025647ecc7505e021f60fa646a83dcdccee | |
parent | a1303af5d79eb13a658633a9fb0ce3aed0f7decf (diff) | |
download | linux-stable-f3f58935edbcb33fd529fc46d554162a0660fd2d.tar.gz linux-stable-f3f58935edbcb33fd529fc46d554162a0660fd2d.tar.bz2 linux-stable-f3f58935edbcb33fd529fc46d554162a0660fd2d.zip |
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 <dan.carpenter@oracle.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/trace_uprobe.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 394b93572506..31ea48eceda1 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 |