3.16.60-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Masami Hiramatsu <mhira...@kernel.org>

commit 50268a3d266ecfdd6c5873d62b2758d9732fc598 upstream.

Fix string fetch function to terminate with NUL.
It is OK to drop the rest of string.

Signed-off-by: Masami Hiramatsu <mhira...@kernel.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Song Liu <songliubrav...@fb.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: secur...@kernel.org
Cc: 范龙飞 <long7...@126.com>
Fixes: 5baaa59ef09e ("tracing/probes: Implement 'memory' fetch method for 
uprobes")
Signed-off-by: Ingo Molnar <mi...@kernel.org>
Signed-off-by: Ben Hutchings <b...@decadent.org.uk>
---
 kernel/trace/trace_uprobe.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -149,6 +149,8 @@ static void FETCH_FUNC_NAME(memory, stri
                return;
 
        ret = strncpy_from_user(dst, src, maxlen);
+       if (ret == maxlen)
+               dst[--ret] = '\0';
 
        if (ret < 0) {  /* Failed to fetch string */
                ((u8 *)get_rloc_data(dest))[0] = '\0';

Reply via email to