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=1796382764; b=4+APCRhMi0dKTenQ0ecGRp2zNL0lg9V4q4qQ6vfUQ52dTWjio5b8It2GMuL/SR12z1Mc dJysI4D9Q0u28xvaP6790vY7bhwXNCYxwL8IG8w+CKYB+2FDRChsD5bW4vGgyscc/586z ivSI1Go0A3a2fKFE+VOOLNTIp8LKpk5bZCNukQrvV8S1tN5GG+7oJmcbEyFP2NdNVjdd2 2kmVkHL3QLOLLVxQGqz9gT/8GeniGCHVnk77YDtYlQezroO5w4RuzDkUXLPlC1o3bEz8H EXPidhwX7FQk1xkxwMHhkB+dae0fwflWkQA8MS4GaTx2pkPu7MNeYdFhsBh+Cuvm1Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382764; 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=wKFZYRkmER8XmH2YuylNddNJL2cnnZ8LOYwHTwypTfg=; b=VtS+t18jkNDEumFwiHYRqbr7/3CjzRey9jFB2gWUUZAuhB2LR2OTaxHIhgfabqLMy0wb iZp/urCaPCrK4Xb9TdphUYzvYsW+FEvhQrbJrQaRc18KLGPEzQ9/ulIyBSk4L+ITJWrdV HPeJTTE2uhFzQ3dKQydqdMAuDJOIlacEje474oBcBBeFP7nFmidQytF1G6s9IdsuHHezm BB8NKoMRwZgBs0/yzL44xYRuF19N0FXufeThsabTI8UTDBNdDIOD/XRNTFHZxJDprz3HH mIC8xR/11fbdQ7rQ1I3/dxL0jpOm7SbsTl9oxECLoHqqytsmghKOB4rBkvnh88HdK5Q== 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="qWFMYz/g"; 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 BB325606A337; Fri, 4 Dec 2026 11:12:44 +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=qWFMYz/g Received: by smtp.kernel.org (Postfix) with ESMTPSA id 141911F00A08; Fri, 4 Dec 2026 11:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382764; bh=wKFZYRkmER8XmH2YuylNddNJL2cnnZ8LOYwHTwypTfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qWFMYz/gTsjGAeibLugRRVhM+TACLr7jsL+IinW9g/j86ct6HpbaiMtXAdD9bUTHg v/q88jN/n65HOCFTs/cPsdcyQ4bK+7NfPQUE7MmPJ+elmriQI6i1mWA7P6AAUcmvSy tvDoQom/+IJi4LiF+J7NVRg3zMp1HJnS/iHEmm3c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Carlier , Steven Rostedt Subject: [PATCH 6.18 593/703] tracing: Drop the synthetic event ref when clearing hist triggers Date: Fri, 4 Dec 2026 19:08:12 +0900 Message-ID: <20261204100643.525288778@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -1749,9 +1749,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 @@ -6749,6 +6749,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) @@ -6804,7 +6815,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); @@ -6817,9 +6827,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) @@ -6934,9 +6942,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 @@ -539,6 +539,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); }