Patch "events: Reuse value read using READ_ONCE instead of re-reading it" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     events-reuse-value-read-using-read_once-instead-of-r.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1902cb9ce5b79abbc5e5848446f4b19c1ee5e90a
Author: Baptiste Lepers <baptiste.lepers@xxxxxxxxx>
Date:   Mon Sep 6 11:53:10 2021 +1000

    events: Reuse value read using READ_ONCE instead of re-reading it
    
    [ Upstream commit b89a05b21f46150ac10a962aa50109250b56b03b ]
    
    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@xxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Link: https://lkml.kernel.org/r/20210906015310.12802-1-baptiste.lepers@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 1cb1f9b8392e..e5c4aca620c5 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10192,7 +10192,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;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux