diff options
author | Baptiste Lepers <baptiste.lepers@gmail.com> | 2021-09-06 11:53:10 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-22 11:48:11 +0200 |
commit | c09a84aea0d3902f955cc6504e1c25cddb7c48c2 (patch) | |
tree | 885a9360255d2111862d04b9bffd423486d26409 /kernel/events/core.c | |
parent | e68a11a4324dbf7e98eeda55c16501263ce2d00c (diff) | |
download | linux-stable-c09a84aea0d3902f955cc6504e1c25cddb7c48c2.tar.gz linux-stable-c09a84aea0d3902f955cc6504e1c25cddb7c48c2.tar.bz2 linux-stable-c09a84aea0d3902f955cc6504e1c25cddb7c48c2.zip |
events: Reuse value read using READ_ONCE instead of re-reading it
commit b89a05b21f46150ac10a962aa50109250b56b03b 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: 375637bc52495 ("perf/core: Introduce address range filtering")
Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210906015310.12802-1-baptiste.lepers@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/events/core.c')
-rw-r--r-- | kernel/events/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index dd740f91de47..4a8c3f5313f9 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8914,7 +8914,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; |