Skip to contentSkip to conversation

tracing: Fix tracing buffer length in tracing_mark_write

PATCH New Wang ShaoBo 1 participant 1 message Jun 23, 2020 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix tracing buffer length in tracing_mark_write

__copy_from_user_inatomic() return the byte length that copied failed, tracing buffer should left this bytes.

Fixes 656c7f0d2d2b ("tracing: Replace kmap with copy_from_user() in trace_marker writing")
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 29615f15a820..ed5fe0f165e0 100644
@@ -6628,7 +6628,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 		written = -EFAULT;
 	} else
 		written = cnt;
-	len = cnt;
+	cnt -= len;
 
 	if (tr->trace_marker_file && !list_empty(&tr->trace_marker_file->triggers)) {
 		/* do not add \n before testing triggers, but add \0 */
Signature · 1 line
2.17.1