From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384154; b=BhD5itxDKiDcCJG318TYVhMfVGlxMEq0nwpfW6XXK1pd1s/ii/PBp9zlEu28x6dh3wU2 zcA8beknMU/0rwXThf/IN8Y7RsJ8Vm1ouvW+c83EvD7zbwG9bDNSYMq7qFWWnO9NCQtIZ HIO800nZyAYUUNTlxJCaEGLpmkIwtj65EU8DvBdzR1KmcB9BXuhpEHAJnE/I5Yo8t2EH0 cO/syRGlPoW+jyMv4GTEvM8Dve5SxIUTz2C3+Zx6kRb5Q9kMnNq3xWoAi/n0NhRluGMBi Yny5t8rccRsZGoHDVzh+wVmYmx/9txdijvnD60y6VxlfX8BqT0hrgZbAncdUvRJl4uQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384154; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=H6ZrX7V4XhSInYcCJFVDLoecKYUYWTNqoUpBmXAeXA0=; b=r2koya3P2Desnil330wl/8NxEKO0au/d+FcQ9PzOyz88gQa8+YOb8SKHKt8Vw0QBbczU ctpY7m3aDo1Vp8xDLIgmPgMWESNtN+VcJ0VSZwfbMay2DUA3ZhPXe66lG9PR0Op5eJCKl KrRrkKu8Bszs+znM7cVS0rviyzuJgrr7hsavbkGxsRlJkk+ktiFi4wVb7FIoFn+vPmL/r XzYAQibL++kstnIkvvUONEFgZs83/TnSCYchChY/oOPCUhf4lb23f6f3cGU6jxpqlnGo3 O9mdMtsQr/4H9GPaNroP6V6fNJPwQyWZmwECejQQVdWopqESIAZ+FhDkXTr1iBL58DA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fFfKcQhv; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03648606A32C; Fri, 4 Dec 2026 11:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fFfKcQhv Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E7491F00897; Fri, 4 Dec 2026 11:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384153; bh=H6ZrX7V4XhSInYcCJFVDLoecKYUYWTNqoUpBmXAeXA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fFfKcQhv3LE4iuhP0eQTSVLuoCpDinbkHsvAAL3qR2PZPMbL1ZpoSFN6UloF6fUwn 949TLq0/tw8sPKRcG9lr3FFnaoT+HFcT1rGdbl458ciQ57akYGRt7kMJAgWtl2sRG1 KyjTB0vjfaQ2LPJUuDhWmuLVG5Nc0D0HgY1QJzRI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Carlier , Steven Rostedt Subject: [PATCH 6.12 502/555] tracing: Drop the synthetic event ref when clearing hist triggers Date: Fri, 4 Dec 2026 19:09:05 +0900 Message-ID: <20261204100628.059019690@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Carlier commit 2b3bed9617bb71c9b1893d9f54ef8df59a239224 upstream. clear_event_triggers() frees a hist trigger on a synthetic event without dropping the se->ref taken by event_hist_trigger_parse(). Removing an instance with such a trigger leaves the synthetic event busy forever. Cc: stable@vger.kernel.org Fixes: 4b147936fa50 ("tracing: Add support for 'synthetic' events") Link: https://patch.msgid.link/20261022205405.1228742-1-devnexen@gmail.com Signed-off-by: David Carlier Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.h | 2 ++ kernel/trace/trace_events_hist.c | 20 +++++++++++++------- kernel/trace/trace_events_trigger.c | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1683,9 +1683,11 @@ extern const struct file_operations even #ifdef CONFIG_HIST_TRIGGERS extern int register_trigger_hist_cmd(void); extern int register_trigger_hist_enable_disable_cmds(void); +extern void hist_put_synth_event(struct trace_event_file *file); #else static inline int register_trigger_hist_cmd(void) { return 0; } static inline int register_trigger_hist_enable_disable_cmds(void) { return 0; } +static inline void hist_put_synth_event(struct trace_event_file *file) { } #endif extern int register_trigger_cmds(void); --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -6721,6 +6721,17 @@ static bool hist_trigger_check_refs(stru return false; } +void hist_put_synth_event(struct trace_event_file *file) +{ + struct synth_event *se; + + lockdep_assert_held(&event_mutex); + + se = find_synth_event_call(file->event_call); + if (se) + se->ref--; +} + static void hist_unregister_trigger(char *glob, struct event_trigger_data *data, struct trace_event_file *file) @@ -6776,7 +6787,6 @@ static void hist_unreg_all(struct trace_ { struct event_trigger_data *test, *n; struct hist_trigger_data *hist_data; - struct synth_event *se; lockdep_assert_held(&event_mutex); @@ -6789,9 +6799,7 @@ static void hist_unreg_all(struct trace_ list_del_rcu(&test->list); trace_event_trigger_enable_disable(file, 0); - se = find_synth_event_call(file->event_call); - if (se) - se->ref--; + hist_put_synth_event(file); update_cond_flag(file); if (hist_data->enable_timestamps) @@ -6906,9 +6914,7 @@ static int event_hist_trigger_parse(stru } event_trigger_unregister(cmd_ops, file, glob+1, trigger_data); - se = find_synth_event_call(file->event_call); - if (se) - se->ref--; + hist_put_synth_event(file); ret = 0; goto out_free; } --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -560,6 +560,8 @@ clear_event_triggers(struct trace_array list_for_each_entry_safe(data, n, &file->triggers, list) { trace_event_trigger_enable_disable(file, 0); list_del_rcu(&data->list); + if (data->cmd_ops->trigger_type == ETT_EVENT_HIST) + hist_put_synth_event(file); if (data->cmd_ops->free) data->cmd_ops->free(data); }