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=1796381379; b=41FzYew2+z0hMnp1+yk6iiR0myocs+AsNqx5VZM6EzAjxHqCX9I4zoYQVmCUXBS5clmn BlS3oGk81uM8WtxywtthHkbDnXSP5lDoCC3tx35cN3mjZt8BHlYXOourwp5D9vOJqkw4d jlexhrl38UaV7ya0F3gC1yEOhwt8H2+W2ryxju24+5apsgU57XLhpB4wGt9uyZkHGEwGS OnIR2Lw5h8vSl+mZfaP2XbcjsFBPL1Y8faAPwH3Y2Nh9v/ig/M4twIRgJE34eTb0Lgs87 tabu4qw7fuDos19uJ5UvLzx7mX9TTNbBDo6n2XsuiUxgOjI54p7eRSazGjAvzDwfLWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381379; 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=bVmzf83hwcyUqYAXTqSYHXuzH4WxNcTDsA2QUwLWQmc=; b=TX7o7jPr/hrzFzyssSej8T4o9tQtZkvJOQhuPDS6e71B4PhfZDUmk9wPwHgYT8LX3CWu d0gsMQ3PZO9jmXGHGlzj6g8iPhaRnofcxmJ3oQm6emhqSlchCEUeZj1AIvGHwGyK6MZxf AeQY8I+qWkxSi/hTaRunIH5xU4Uv2F09KBaIdzayK+0zMZG13/rjJvj9jo6zsyVpO7onH ip/RkhFYMUX7xuh6VOockSWWBYG+VrKK6Ei4XDU9FscyNVhC1dHPHLj8uREHDHn5a87kr z+iEgHGnEFlw6GPBc8ZJIHmFTmo9oifFi0aoU1MXGaiCB0jcLzAFDxyHrk9xySBVHZw== 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=TvW6DpHD; 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 E8514606A32F; Fri, 4 Dec 2026 10:49:38 +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=TvW6DpHD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6733B1F000C2; Fri, 4 Dec 2026 10:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381378; bh=bVmzf83hwcyUqYAXTqSYHXuzH4WxNcTDsA2QUwLWQmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TvW6DpHDePzDVgHVdwUW4NEBcvdDQgYYEfppU3dB0GRo+2mxguKaD1wcYjOdVySS+ 7WwVddae2AOkdb/w9sRaBX5GYD6UizS/H0JNwSzoA988jfDb5CDk+PI1oIUh2ZjOL5 EMGWRN0g08vmgcXXtDs1JoimeTexem1ZQwVySibQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Carlier , Steven Rostedt Subject: [PATCH 7.3 678/742] tracing: Drop the synthetic event ref when clearing hist triggers Date: Fri, 4 Dec 2026 19:09:02 +0900 Message-ID: <20261204100653.071136207@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -1911,9 +1911,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 @@ -6768,6 +6768,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) @@ -6823,7 +6834,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); @@ -6836,9 +6846,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) @@ -6953,9 +6961,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 @@ -643,6 +643,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); }