Skip to content

Commit b89a05b

Browse files
BLepersPeter Zijlstra
authored andcommitted
events: Reuse value read using READ_ONCE instead of re-reading it
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: 375637b ("perf/core: Introduce address range filtering") Signed-off-by: Baptiste Lepers <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 6880fa6 commit b89a05b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10193,7 +10193,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event)
1019310193
return;
1019410194

1019510195
if (ifh->nr_file_filters) {
10196-
mm = get_task_mm(event->ctx->task);
10196+
mm = get_task_mm(task);
1019710197
if (!mm)
1019810198
goto restart;
1019910199

0 commit comments

Comments
 (0)