From: Greg Kroah-Hartman Date: Mon, 20 Mar 2023 15:02:02 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.14.311~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53961aae61167e7c935bf713c6c9ed5e21780065;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: perf-fix-check-before-add_event_to_groups-in-perf_group_detach.patch --- diff --git a/queue-5.15/perf-fix-check-before-add_event_to_groups-in-perf_group_detach.patch b/queue-5.15/perf-fix-check-before-add_event_to_groups-in-perf_group_detach.patch new file mode 100644 index 00000000000..791843b241a --- /dev/null +++ b/queue-5.15/perf-fix-check-before-add_event_to_groups-in-perf_group_detach.patch @@ -0,0 +1,35 @@ +From fd0815f632c24878e325821943edccc7fde947a2 Mon Sep 17 00:00:00 2001 +From: Budimir Markovic +Date: Wed, 15 Mar 2023 00:29:01 -0700 +Subject: perf: Fix check before add_event_to_groups() in perf_group_detach() + +From: Budimir Markovic + +commit fd0815f632c24878e325821943edccc7fde947a2 upstream. + +Events should only be added to a groups rb tree if they have not been +removed from their context by list_del_event(). Since remove_on_exec +made it possible to call list_del_event() on individual events before +they are detached from their group, perf_group_detach() should check each +sibling's attach_state before calling add_event_to_groups() on it. + +Fixes: 2e498d0a74e5 ("perf: Add support for event removal on exec") +Signed-off-by: Budimir Markovic +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/ZBFzvQV9tEqoHEtH@gentoo +Signed-off-by: Greg Kroah-Hartman +--- + kernel/events/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -2252,7 +2252,7 @@ static void perf_group_detach(struct per + /* Inherit group flags from the previous leader */ + sibling->group_caps = event->group_caps; + +- if (!RB_EMPTY_NODE(&event->group_node)) { ++ if (sibling->attach_state & PERF_ATTACH_CONTEXT) { + add_event_to_groups(sibling, event->ctx); + + if (sibling->state == PERF_EVENT_STATE_ACTIVE) diff --git a/queue-5.15/series b/queue-5.15/series index 9ed4edb77da..b45c8cd441d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -113,3 +113,4 @@ pci-unify-delay-handling-for-reset-and-resume.patch pci-dpc-await-readiness-of-secondary-bus-after-reset.patch hid-core-provide-new-max_buffer_size-attribute-to-over-ride-the-default.patch hid-uhid-over-ride-the-default-maximum-data-buffer-value-with-our-own.patch +perf-fix-check-before-add_event_to_groups-in-perf_group_detach.patch