]> git.baikalelectronics.ru Git - kernel.git/commit
perf: Fix check before add_event_to_groups() in perf_group_detach()
authorBudimir Markovic <markovicbudimir@gmail.com>
Wed, 15 Mar 2023 07:29:01 +0000 (00:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:34:06 +0000 (13:34 +0100)
commit929f9f4684191f9a9038f14b27129ee46fcf383f
treedda6381c8fc75718562b1e3ad3d057bddfffbf90
parent6dc5c797710ede18f961b538a74dc3c0e7b48a71
perf: Fix check before add_event_to_groups() in perf_group_detach()

commit 762145c78d87c20c4d94cf997d97e4246accb849 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: f080088de594 ("perf: Add support for event removal on exec")
Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/ZBFzvQV9tEqoHEtH@gentoo
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/events/core.c