Patch "bpf,perf: Fix perf_event_detach_bpf_prog error handling" has been added to the 6.6-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

    bpf,perf: Fix perf_event_detach_bpf_prog error handling

to the 6.6-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:
     bpf-perf-fix-perf_event_detach_bpf_prog-error-handli.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 648ee4de16798e24fe06a1e47d9ba0b7e24f6fc6
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
Date:   Wed Oct 23 22:03:52 2024 +0200

    bpf,perf: Fix perf_event_detach_bpf_prog error handling
    
    [ Upstream commit 0ee288e69d033850bc87abe0f9cc3ada24763d7f ]
    
    Peter reported that perf_event_detach_bpf_prog might skip to release
    the bpf program for -ENOENT error from bpf_prog_array_copy.
    
    This can't happen because bpf program is stored in perf event and is
    detached and released only when perf event is freed.
    
    Let's drop the -ENOENT check and make sure the bpf program is released
    in any case.
    
    Fixes: 170a7e3ea070 ("bpf: bpf_prog_array_copy() should return -ENOENT if exclude_prog not found")
    Reported-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20241023200352.3488610-1-jolsa@xxxxxxxxxx
    
    Closes: https://lore.kernel.org/lkml/20241022111638.GC16066@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index ecc86a595b754..9064f75de7e46 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2217,8 +2217,6 @@ void perf_event_detach_bpf_prog(struct perf_event *event)
 
 	old_array = bpf_event_rcu_dereference(event->tp_event->prog_array);
 	ret = bpf_prog_array_copy(old_array, event->prog, NULL, 0, &new_array);
-	if (ret == -ENOENT)
-		goto unlock;
 	if (ret < 0) {
 		bpf_prog_array_delete_safe(old_array, event->prog);
 	} else {




[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