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>
This commit is contained in:
Masami Hiramatsu 2018-08-29 01:17:47 +09:00 committed by Steven Rostedt (VMware)
parent a1303af5d7
commit f3f58935ed
1 changed files with 1 additions and 1 deletions

View File

@ -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