]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Aug 2025 07:34:50 +0000 (09:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Aug 2025 07:34:50 +0000 (09:34 +0200)
added patches:
compiler-remove-__addressable_asm-_str-again.patch
iio-imu-inv_icm42600-change-invalid-data-error-to-ebusy.patch
iio-light-as73211-ensure-buffer-holes-are-zeroed.patch
iio-temperature-maxim_thermocouple-use-dma-safe-buffer-for-spi_read.patch
tracing-limit-access-to-parser-buffer-when-trace_get_user-failed.patch
tracing-remove-unneeded-goto-out-logic.patch

queue-6.1/compiler-remove-__addressable_asm-_str-again.patch [new file with mode: 0644]
queue-6.1/iio-imu-inv_icm42600-change-invalid-data-error-to-ebusy.patch [new file with mode: 0644]
queue-6.1/iio-light-as73211-ensure-buffer-holes-are-zeroed.patch [new file with mode: 0644]
queue-6.1/iio-temperature-maxim_thermocouple-use-dma-safe-buffer-for-spi_read.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/tracing-limit-access-to-parser-buffer-when-trace_get_user-failed.patch [new file with mode: 0644]
queue-6.1/tracing-remove-unneeded-goto-out-logic.patch [new file with mode: 0644]

diff --git a/queue-6.1/compiler-remove-__addressable_asm-_str-again.patch b/queue-6.1/compiler-remove-__addressable_asm-_str-again.patch
new file mode 100644 (file)
index 0000000..26f3356
--- /dev/null
@@ -0,0 +1,73 @@
+From stable+bounces-172725-greg=kroah.com@vger.kernel.org Sun Aug 24 15:02:17 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 09:01:43 -0400
+Subject: compiler: remove __ADDRESSABLE_ASM{_STR,}() again
+To: stable@vger.kernel.org
+Cc: Jan Beulich <jbeulich@suse.com>, Josh Poimboeuf <jpoimboe@kernel.org>, Juergen Gross <jgross@suse.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20250824130143.2748139-1-sashal@kernel.org>
+
+From: Jan Beulich <jbeulich@suse.com>
+
+[ Upstream commit 8ea815399c3fcce1889bd951fec25b5b9a3979c1 ]
+
+__ADDRESSABLE_ASM_STR() is where the necessary stringification happens.
+As long as "sym" doesn't contain any odd characters, no quoting is
+required for its use with .quad / .long. In fact the quotation gets in
+the way with gas 2.25; it's only from 2.26 onwards that quoted symbols
+are half-way properly supported.
+
+However, assembly being different from C anyway, drop
+__ADDRESSABLE_ASM_STR() and its helper macro altogether. A simple
+.global directive will suffice to get the symbol "declared", i.e. into
+the symbol table. While there also stop open-coding STATIC_CALL_TRAMP()
+and STATIC_CALL_KEY().
+
+Fixes: 0ef8047b737d ("x86/static-call: provide a way to do very early static-call updates")
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Message-ID: <609d2c74-de13-4fae-ab1a-1ec44afb948d@suse.com>
+[ Adjust context ]
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/xen/hypercall.h |    5 +++--
+ include/linux/compiler.h             |    8 --------
+ 2 files changed, 3 insertions(+), 10 deletions(-)
+
+--- a/arch/x86/include/asm/xen/hypercall.h
++++ b/arch/x86/include/asm/xen/hypercall.h
+@@ -94,12 +94,13 @@ DECLARE_STATIC_CALL(xen_hypercall, xen_h
+ #ifdef MODULE
+ #define __ADDRESSABLE_xen_hypercall
+ #else
+-#define __ADDRESSABLE_xen_hypercall __ADDRESSABLE_ASM_STR(__SCK__xen_hypercall)
++#define __ADDRESSABLE_xen_hypercall \
++      __stringify(.global STATIC_CALL_KEY(xen_hypercall);)
+ #endif
+ #define __HYPERCALL                                   \
+       __ADDRESSABLE_xen_hypercall                     \
+-      "call __SCT__xen_hypercall"
++      __stringify(call STATIC_CALL_TRAMP(xen_hypercall))
+ #define __HYPERCALL_ENTRY(x)  "a" (x)
+--- a/include/linux/compiler.h
++++ b/include/linux/compiler.h
+@@ -235,14 +235,6 @@ static inline void *offset_to_ptr(const
+ #define __ADDRESSABLE(sym) \
+       ___ADDRESSABLE(sym, __section(".discard.addressable"))
+-#define __ADDRESSABLE_ASM(sym)                                                \
+-      .pushsection .discard.addressable,"aw";                         \
+-      .align ARCH_SEL(8,4);                                           \
+-      ARCH_SEL(.quad, .long) __stringify(sym);                        \
+-      .popsection;
+-
+-#define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym))
+-
+ /* &a[0] degrades to a pointer: a different type from an array */
+ #define __must_be_array(a)    BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
diff --git a/queue-6.1/iio-imu-inv_icm42600-change-invalid-data-error-to-ebusy.patch b/queue-6.1/iio-imu-inv_icm42600-change-invalid-data-error-to-ebusy.patch
new file mode 100644 (file)
index 0000000..e0228e5
--- /dev/null
@@ -0,0 +1,50 @@
+From stable+bounces-172750-greg=kroah.com@vger.kernel.org Sun Aug 24 16:44:44 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 10:44:36 -0400
+Subject: iio: imu: inv_icm42600: change invalid data error to -EBUSY
+To: stable@vger.kernel.org
+Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>, Andy Shevchenko <andy@kernel.org>, Sean Nyekjaer <sean@geanix.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20250824144436.3167804-1-sashal@kernel.org>
+
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+
+[ Upstream commit dfdc31e7ccf3ac1d5ec01d5120c71e14745e3dd8 ]
+
+Temperature sensor returns the temperature of the mechanical parts
+of the chip. If both accel and gyro are off, the temperature sensor is
+also automatically turned off and returns invalid data.
+
+In this case, returning -EBUSY error code is better then -EINVAL and
+indicates userspace that it needs to retry reading temperature in
+another context.
+
+Fixes: bc3eb0207fb5 ("iio: imu: inv_icm42600: add temperature sensor support")
+Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Cc: stable@vger.kernel.org
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Reviewed-by: Sean Nyekjaer <sean@geanix.com>
+Link: https://patch.msgid.link/20250808-inv-icm42600-change-temperature-error-code-v1-1-986fbf63b77d@tdk.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+[ Adjust context ]
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
+@@ -32,8 +32,12 @@ static int inv_icm42600_temp_read(struct
+               goto exit;
+       *temp = (int16_t)be16_to_cpup(raw);
++      /*
++       * Temperature data is invalid if both accel and gyro are off.
++       * Return -EBUSY in this case.
++       */
+       if (*temp == INV_ICM42600_DATA_INVALID)
+-              ret = -EINVAL;
++              ret = -EBUSY;
+ exit:
+       mutex_unlock(&st->lock);
diff --git a/queue-6.1/iio-light-as73211-ensure-buffer-holes-are-zeroed.patch b/queue-6.1/iio-light-as73211-ensure-buffer-holes-are-zeroed.patch
new file mode 100644 (file)
index 0000000..07db921
--- /dev/null
@@ -0,0 +1,39 @@
+From stable+bounces-172729-greg=kroah.com@vger.kernel.org Sun Aug 24 15:15:04 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 09:14:55 -0400
+Subject: iio: light: as73211: Ensure buffer holes are zeroed
+To: stable@vger.kernel.org
+Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>, Matti Vaittinen <mazziesaccount@gmail.com>, Andy Shevchenko <andy@kernel.org>, Stable@vger.kernel.org, Sasha Levin <sashal@kernel.org>
+Message-ID: <20250824131455.2815441-1-sashal@kernel.org>
+
+From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+
+[ Upstream commit 433b99e922943efdfd62b9a8e3ad1604838181f2 ]
+
+Given that the buffer is copied to a kfifo that ultimately user space
+can read, ensure we zero it.
+
+Fixes: 403e5586b52e ("iio: light: as73211: New driver")
+Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Link: https://patch.msgid.link/20250802164436.515988-2-jic23@kernel.org
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+[ Adjust context ]
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/light/as73211.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/light/as73211.c
++++ b/drivers/iio/light/as73211.c
+@@ -573,7 +573,7 @@ static irqreturn_t as73211_trigger_handl
+       struct {
+               __le16 chan[4];
+               s64 ts __aligned(8);
+-      } scan;
++      } scan = { };
+       int data_result, ret;
+       mutex_lock(&data->mutex);
diff --git a/queue-6.1/iio-temperature-maxim_thermocouple-use-dma-safe-buffer-for-spi_read.patch b/queue-6.1/iio-temperature-maxim_thermocouple-use-dma-safe-buffer-for-spi_read.patch
new file mode 100644 (file)
index 0000000..9aab467
--- /dev/null
@@ -0,0 +1,95 @@
+From stable+bounces-172728-greg=kroah.com@vger.kernel.org Sun Aug 24 15:13:13 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 09:13:03 -0400
+Subject: iio: temperature: maxim_thermocouple: use DMA-safe buffer for spi_read()
+To: stable@vger.kernel.org
+Cc: "David Lechner" <dlechner@baylibre.com>, "Nuno Sá" <nuno.sa@analog.com>, Stable@vger.kernel.org, "Jonathan Cameron" <Jonathan.Cameron@huawei.com>, "Sasha Levin" <sashal@kernel.org>
+Message-ID: <20250824131303.2806125-1-sashal@kernel.org>
+
+From: David Lechner <dlechner@baylibre.com>
+
+[ Upstream commit ae5bc07ec9f73a41734270ef3f800c5c8a7e0ad3 ]
+
+Replace using stack-allocated buffers with a DMA-safe buffer for use
+with spi_read(). This allows the driver to be safely used with
+DMA-enabled SPI controllers.
+
+The buffer array is also converted to a struct with a union to make the
+usage of the memory in the buffer more clear and ensure proper alignment.
+
+Fixes: 1f25ca11d84a ("iio: temperature: add support for Maxim thermocouple chips")
+Signed-off-by: David Lechner <dlechner@baylibre.com>
+Reviewed-by: Nuno Sá <nuno.sa@analog.com>
+Link: https://patch.msgid.link/20250721-iio-use-more-iio_declare_buffer_with_ts-3-v2-1-0c68d41ccf6c@baylibre.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+[ iio_push_to_buffers_with_ts() => iio_push_to_buffers_with_timestamp() ]
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/temperature/maxim_thermocouple.c |   26 ++++++++++++++++----------
+ 1 file changed, 16 insertions(+), 10 deletions(-)
+
+--- a/drivers/iio/temperature/maxim_thermocouple.c
++++ b/drivers/iio/temperature/maxim_thermocouple.c
+@@ -12,6 +12,7 @@
+ #include <linux/mutex.h>
+ #include <linux/err.h>
+ #include <linux/spi/spi.h>
++#include <linux/types.h>
+ #include <linux/iio/iio.h>
+ #include <linux/iio/sysfs.h>
+ #include <linux/iio/trigger.h>
+@@ -122,8 +123,15 @@ struct maxim_thermocouple_data {
+       struct spi_device *spi;
+       const struct maxim_thermocouple_chip *chip;
+       char tc_type;
+-
+-      u8 buffer[16] __aligned(IIO_DMA_MINALIGN);
++      /* Buffer for reading up to 2 hardware channels. */
++      struct {
++              union {
++                      __be16 raw16;
++                      __be32 raw32;
++                      __be16 raw[2];
++              };
++              aligned_s64 timestamp;
++      } buffer __aligned(IIO_DMA_MINALIGN);
+ };
+ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
+@@ -131,18 +139,16 @@ static int maxim_thermocouple_read(struc
+ {
+       unsigned int storage_bytes = data->chip->read_size;
+       unsigned int shift = chan->scan_type.shift + (chan->address * 8);
+-      __be16 buf16;
+-      __be32 buf32;
+       int ret;
+       switch (storage_bytes) {
+       case 2:
+-              ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
+-              *val = be16_to_cpu(buf16);
++              ret = spi_read(data->spi, &data->buffer.raw16, storage_bytes);
++              *val = be16_to_cpu(data->buffer.raw16);
+               break;
+       case 4:
+-              ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
+-              *val = be32_to_cpu(buf32);
++              ret = spi_read(data->spi, &data->buffer.raw32, storage_bytes);
++              *val = be32_to_cpu(data->buffer.raw32);
+               break;
+       default:
+               ret = -EINVAL;
+@@ -167,9 +173,9 @@ static irqreturn_t maxim_thermocouple_tr
+       struct maxim_thermocouple_data *data = iio_priv(indio_dev);
+       int ret;
+-      ret = spi_read(data->spi, data->buffer, data->chip->read_size);
++      ret = spi_read(data->spi, data->buffer.raw, data->chip->read_size);
+       if (!ret) {
+-              iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
++              iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
+                                                  iio_get_time_ns(indio_dev));
+       }
index 318a1110955f13ce910364c31b4a795d6a38cefa..c06358b298c790d1e999efb20158b6f75cdd8872 100644 (file)
@@ -443,3 +443,9 @@ selftests-mptcp-pm-check-flush-doesn-t-reset-limits.patch
 wifi-mac80211-avoid-lockdep-checking-when-removing-deflink.patch
 wifi-mac80211-check-basic-rates-validity-in-sta_link_apply_parameters.patch
 tls-fix-handling-of-zero-length-records-on-the-rx_list.patch
+iio-imu-inv_icm42600-change-invalid-data-error-to-ebusy.patch
+tracing-remove-unneeded-goto-out-logic.patch
+tracing-limit-access-to-parser-buffer-when-trace_get_user-failed.patch
+iio-light-as73211-ensure-buffer-holes-are-zeroed.patch
+iio-temperature-maxim_thermocouple-use-dma-safe-buffer-for-spi_read.patch
+compiler-remove-__addressable_asm-_str-again.patch
diff --git a/queue-6.1/tracing-limit-access-to-parser-buffer-when-trace_get_user-failed.patch b/queue-6.1/tracing-limit-access-to-parser-buffer-when-trace_get_user-failed.patch
new file mode 100644 (file)
index 0000000..2cec95f
--- /dev/null
@@ -0,0 +1,142 @@
+From stable+bounces-172739-greg=kroah.com@vger.kernel.org Sun Aug 24 15:51:14 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 09:49:36 -0400
+Subject: tracing: Limit access to parser->buffer when trace_get_user failed
+To: stable@vger.kernel.org
+Cc: Pu Lehui <pulehui@huawei.com>, "Steven Rostedt (Google)" <rostedt@goodmis.org>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20250824134936.2918494-2-sashal@kernel.org>
+
+From: Pu Lehui <pulehui@huawei.com>
+
+[ Upstream commit 6a909ea83f226803ea0e718f6e88613df9234d58 ]
+
+When the length of the string written to set_ftrace_filter exceeds
+FTRACE_BUFF_MAX, the following KASAN alarm will be triggered:
+
+BUG: KASAN: slab-out-of-bounds in strsep+0x18c/0x1b0
+Read of size 1 at addr ffff0000d00bd5ba by task ash/165
+
+CPU: 1 UID: 0 PID: 165 Comm: ash Not tainted 6.16.0-g6bcdbd62bd56-dirty
+Hardware name: linux,dummy-virt (DT)
+Call trace:
+ show_stack+0x34/0x50 (C)
+ dump_stack_lvl+0xa0/0x158
+ print_address_description.constprop.0+0x88/0x398
+ print_report+0xb0/0x280
+ kasan_report+0xa4/0xf0
+ __asan_report_load1_noabort+0x20/0x30
+ strsep+0x18c/0x1b0
+ ftrace_process_regex.isra.0+0x100/0x2d8
+ ftrace_regex_release+0x484/0x618
+ __fput+0x364/0xa58
+ ____fput+0x28/0x40
+ task_work_run+0x154/0x278
+ do_notify_resume+0x1f0/0x220
+ el0_svc+0xec/0xf0
+ el0t_64_sync_handler+0xa0/0xe8
+ el0t_64_sync+0x1ac/0x1b0
+
+The reason is that trace_get_user will fail when processing a string
+longer than FTRACE_BUFF_MAX, but not set the end of parser->buffer to 0.
+Then an OOB access will be triggered in ftrace_regex_release->
+ftrace_process_regex->strsep->strpbrk. We can solve this problem by
+limiting access to parser->buffer when trace_get_user failed.
+
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/20250813040232.1344527-1-pulehui@huaweicloud.com
+Fixes: 8c9af478c06b ("ftrace: Handle commands when closing set_ftrace_filter file")
+Signed-off-by: Pu Lehui <pulehui@huawei.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c |   18 ++++++++++++------
+ kernel/trace/trace.h |    8 +++++++-
+ 2 files changed, 19 insertions(+), 7 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1618,7 +1618,7 @@ int trace_get_user(struct trace_parser *
+       ret = get_user(ch, ubuf++);
+       if (ret)
+-              return ret;
++              goto fail;
+       read++;
+       cnt--;
+@@ -1632,7 +1632,7 @@ int trace_get_user(struct trace_parser *
+               while (cnt && isspace(ch)) {
+                       ret = get_user(ch, ubuf++);
+                       if (ret)
+-                              return ret;
++                              goto fail;
+                       read++;
+                       cnt--;
+               }
+@@ -1650,12 +1650,14 @@ int trace_get_user(struct trace_parser *
+       while (cnt && !isspace(ch) && ch) {
+               if (parser->idx < parser->size - 1)
+                       parser->buffer[parser->idx++] = ch;
+-              else
+-                      return -EINVAL;
++              else {
++                      ret = -EINVAL;
++                      goto fail;
++              }
+               ret = get_user(ch, ubuf++);
+               if (ret)
+-                      return ret;
++                      goto fail;
+               read++;
+               cnt--;
+       }
+@@ -1670,11 +1672,15 @@ int trace_get_user(struct trace_parser *
+               /* Make sure the parsed string always terminates with '\0'. */
+               parser->buffer[parser->idx] = 0;
+       } else {
+-              return -EINVAL;
++              ret = -EINVAL;
++              goto fail;
+       }
+       *ppos += read;
+       return read;
++fail:
++      trace_parser_fail(parser);
++      return ret;
+ }
+ /* TODO add a seq_buf_to_buffer() */
+--- a/kernel/trace/trace.h
++++ b/kernel/trace/trace.h
+@@ -1131,6 +1131,7 @@ bool ftrace_event_is_function(struct tra
+  */
+ struct trace_parser {
+       bool            cont;
++      bool            fail;
+       char            *buffer;
+       unsigned        idx;
+       unsigned        size;
+@@ -1138,7 +1139,7 @@ struct trace_parser {
+ static inline bool trace_parser_loaded(struct trace_parser *parser)
+ {
+-      return (parser->idx != 0);
++      return !parser->fail && parser->idx != 0;
+ }
+ static inline bool trace_parser_cont(struct trace_parser *parser)
+@@ -1152,6 +1153,11 @@ static inline void trace_parser_clear(st
+       parser->idx = 0;
+ }
++static inline void trace_parser_fail(struct trace_parser *parser)
++{
++      parser->fail = true;
++}
++
+ extern int trace_parser_get_init(struct trace_parser *parser, int size);
+ extern void trace_parser_put(struct trace_parser *parser);
+ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
diff --git a/queue-6.1/tracing-remove-unneeded-goto-out-logic.patch b/queue-6.1/tracing-remove-unneeded-goto-out-logic.patch
new file mode 100644 (file)
index 0000000..971bef0
--- /dev/null
@@ -0,0 +1,149 @@
+From stable+bounces-172738-greg=kroah.com@vger.kernel.org Sun Aug 24 15:49:46 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Aug 2025 09:49:35 -0400
+Subject: tracing: Remove unneeded goto out logic
+To: stable@vger.kernel.org
+Cc: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20250824134936.2918494-1-sashal@kernel.org>
+
+From: Steven Rostedt <rostedt@goodmis.org>
+
+[ Upstream commit c89504a703fb779052213add0e8ed642f4a4f1c8 ]
+
+Several places in the trace.c file there's a goto out where the out is
+simply a return. There's no reason to jump to the out label if it's not
+doing any more logic but simply returning from the function.
+
+Replace the goto outs with a return and remove the out labels.
+
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Link: https://lore.kernel.org/20250801203857.538726745@kernel.org
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c |   37 ++++++++++++++-----------------------
+ 1 file changed, 14 insertions(+), 23 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1618,7 +1618,7 @@ int trace_get_user(struct trace_parser *
+       ret = get_user(ch, ubuf++);
+       if (ret)
+-              goto out;
++              return ret;
+       read++;
+       cnt--;
+@@ -1632,7 +1632,7 @@ int trace_get_user(struct trace_parser *
+               while (cnt && isspace(ch)) {
+                       ret = get_user(ch, ubuf++);
+                       if (ret)
+-                              goto out;
++                              return ret;
+                       read++;
+                       cnt--;
+               }
+@@ -1642,8 +1642,7 @@ int trace_get_user(struct trace_parser *
+               /* only spaces were written */
+               if (isspace(ch) || !ch) {
+                       *ppos += read;
+-                      ret = read;
+-                      goto out;
++                      return read;
+               }
+       }
+@@ -1651,13 +1650,12 @@ int trace_get_user(struct trace_parser *
+       while (cnt && !isspace(ch) && ch) {
+               if (parser->idx < parser->size - 1)
+                       parser->buffer[parser->idx++] = ch;
+-              else {
+-                      ret = -EINVAL;
+-                      goto out;
+-              }
++              else
++                      return -EINVAL;
++
+               ret = get_user(ch, ubuf++);
+               if (ret)
+-                      goto out;
++                      return ret;
+               read++;
+               cnt--;
+       }
+@@ -1672,15 +1670,11 @@ int trace_get_user(struct trace_parser *
+               /* Make sure the parsed string always terminates with '\0'. */
+               parser->buffer[parser->idx] = 0;
+       } else {
+-              ret = -EINVAL;
+-              goto out;
++              return -EINVAL;
+       }
+       *ppos += read;
+-      ret = read;
+-
+-out:
+-      return ret;
++      return read;
+ }
+ /* TODO add a seq_buf_to_buffer() */
+@@ -2149,10 +2143,10 @@ int __init register_tracer(struct tracer
+       mutex_unlock(&trace_types_lock);
+       if (ret || !default_bootup_tracer)
+-              goto out_unlock;
++              return ret;
+       if (strncmp(default_bootup_tracer, type->name, MAX_TRACER_SIZE))
+-              goto out_unlock;
++              return 0;
+       printk(KERN_INFO "Starting tracer '%s'\n", type->name);
+       /* Do we want this tracer to start on bootup? */
+@@ -2164,8 +2158,7 @@ int __init register_tracer(struct tracer
+       /* disable other selftests, since this will break it. */
+       disable_tracing_selftest("running a tracer");
+- out_unlock:
+-      return ret;
++      return 0;
+ }
+ static void tracing_reset_cpu(struct array_buffer *buf, int cpu)
+@@ -8761,11 +8754,10 @@ ftrace_trace_snapshot_callback(struct tr
+  out_reg:
+       ret = tracing_alloc_snapshot_instance(tr);
+       if (ret < 0)
+-              goto out;
++              return ret;
+       ret = register_ftrace_function_probe(glob, tr, ops, count);
+- out:
+       return ret < 0 ? ret : 0;
+ }
+@@ -10292,7 +10284,7 @@ __init static int tracer_alloc_buffers(v
+       BUILD_BUG_ON(TRACE_ITER_LAST_BIT > TRACE_FLAGS_MAX_SIZE);
+       if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL))
+-              goto out;
++              return -ENOMEM;
+       if (!alloc_cpumask_var(&global_trace.tracing_cpumask, GFP_KERNEL))
+               goto out_free_buffer_mask;
+@@ -10405,7 +10397,6 @@ out_free_cpumask:
+       free_cpumask_var(global_trace.tracing_cpumask);
+ out_free_buffer_mask:
+       free_cpumask_var(tracing_buffer_mask);
+-out:
+       return ret;
+ }