1 From 4b8b3905165ef98386a3c06f196c85d21292d029 Mon Sep 17 00:00:00 2001
2 From: Mohamed Khalfella <mkhalfella@purestorage.com>
3 Date: Fri, 14 Jul 2023 20:33:41 +0000
4 Subject: tracing/histograms: Return an error if we fail to add histogram to hist_vars list
6 From: Mohamed Khalfella <mkhalfella@purestorage.com>
8 commit 4b8b3905165ef98386a3c06f196c85d21292d029 upstream.
10 Commit 6018b585e8c6 ("tracing/histograms: Add histograms to hist_vars if
11 they have referenced variables") added a check to fail histogram creation
12 if save_hist_vars() failed to add histogram to hist_vars list. But the
13 commit failed to set ret to failed return code before jumping to
14 unregister histogram, fix it.
16 Link: https://lore.kernel.org/linux-trace-kernel/20230714203341.51396-1-mkhalfella@purestorage.com
18 Cc: stable@vger.kernel.org
19 Fixes: 6018b585e8c6 ("tracing/histograms: Add histograms to hist_vars if they have referenced variables")
20 Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com>
21 Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 kernel/trace/trace_events_hist.c | 3 ++-
25 1 file changed, 2 insertions(+), 1 deletion(-)
27 --- a/kernel/trace/trace_events_hist.c
28 +++ b/kernel/trace/trace_events_hist.c
29 @@ -5792,7 +5792,8 @@ static int event_hist_trigger_func(struc
32 if (has_hist_vars(hist_data) || hist_data->n_var_refs) {
33 - if (save_hist_vars(hist_data))
34 + ret = save_hist_vars(hist_data);