Skip to content
Snippets Groups Projects
Commit c5102ced authored by Baptiste Lepers's avatar Baptiste Lepers Committed by Greg Kroah-Hartman
Browse files

events: Reuse value read using READ_ONCE instead of re-reading it


commit b89a05b2 upstream.

In perf_event_addr_filters_apply, the task associated with
the event (event->ctx->task) is read using READ_ONCE at the beginning
of the function, checked, and then re-read from event->ctx->task,
voiding all guarantees of the checks. Reuse the value that was read by
READ_ONCE to ensure the consistency of the task struct throughout the
function.

Fixes: 375637bc ("perf/core: Introduce address range filtering")
Signed-off-by: default avatarBaptiste Lepers <baptiste.lepers@gmail.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210906015310.12802-1-baptiste.lepers@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f8ad122
No related branches found
No related tags found
1 merge request!15.10.61 -> 5.10.152 upgrade
......@@ -9973,7 +9973,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event)
return;
if (ifh->nr_file_filters) {
mm = get_task_mm(event->ctx->task);
mm = get_task_mm(task);
if (!mm)
goto restart;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment