tracing: Move mutex to protect against resetting of seq data
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Sat, 24 Sep 2016 02:57:13 +0000 (22:57 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:42 +0000 (01:01 +0000)
commite6711e36bb98f8538cadf8759a232cf49161fee6
tree38e0b18081e0b10235f14d08c43570bd6316aaa2
parent1f53d4c9835d7af7be92cdfc46b3062d051c1834
tracing: Move mutex to protect against resetting of seq data

commit 1245800c0f96eb6ebb368593e251d66c01e61022 upstream.

The iter->seq can be reset outside the protection of the mutex. So can
reading of user data. Move the mutex up to the beginning of the function.

Fixes: d7350c3f45694 ("tracing/core: make the read callbacks reentrants")
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/trace/trace.c