]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 11:21:08 +0000 (12:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 11:21:08 +0000 (12:21 +0100)
added patches:
asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch
net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch
net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch
net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch
net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch

queue-6.1/asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch [new file with mode: 0644]
queue-6.1/net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch [new file with mode: 0644]
queue-6.1/net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch [new file with mode: 0644]
queue-6.1/net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch [new file with mode: 0644]
queue-6.1/net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch b/queue-6.1/asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch
new file mode 100644 (file)
index 0000000..62dc9be
--- /dev/null
@@ -0,0 +1,134 @@
+From 6e8d96909a23c8078ee965bd48bb31cbef2de943 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 11 Aug 2023 22:36:58 +0200
+Subject: asm-generic: partially revert "Unify uapi bitsperlong.h for arm64, riscv and loongarch"
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 6e8d96909a23c8078ee965bd48bb31cbef2de943 upstream.
+
+Unifying the asm-generic headers across 32-bit and 64-bit architectures
+based on the compiler provided macros was a good idea and appears to work
+with all user space, but it caused a regression when building old kernels
+on systems that have the new headers installed in /usr/include, as this
+combination trips an inconsistency in the kernel's own tools/include
+headers that are a mix of userspace and kernel-internal headers.
+
+This affects kernel builds on arm64, riscv64 and loongarch64 systems that
+might end up using the "#define __BITS_PER_LONG 32" default from the old
+tools headers. Backporting the commit into stable kernels would address
+this, but it would still break building kernels without that backport,
+and waste time for developers trying to understand the problem.
+
+arm64 build machines are rather common, and on riscv64 this can also
+happen in practice, but loongarch64 is probably new enough to not
+be used much for building old kernels, so only revert the bits
+for arm64 and riscv.
+
+Link: https://lore.kernel.org/all/20230731160402.GB1823389@dev-arch.thelio-3990X/
+Reported-by: Nathan Chancellor <nathan@kernel.org>
+Fixes: 8386f58f8deda ("asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch")
+Acked-by: Catalin Marinas <catalin.marinas@arm.com>
+Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
+Tested-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/include/uapi/asm/bitsperlong.h       |   24 ++++++++++++++++++++++++
+ arch/riscv/include/uapi/asm/bitsperlong.h       |   14 ++++++++++++++
+ tools/arch/arm64/include/uapi/asm/bitsperlong.h |   24 ++++++++++++++++++++++++
+ tools/arch/riscv/include/uapi/asm/bitsperlong.h |   14 ++++++++++++++
+ 4 files changed, 76 insertions(+)
+ create mode 100644 arch/arm64/include/uapi/asm/bitsperlong.h
+ create mode 100644 arch/riscv/include/uapi/asm/bitsperlong.h
+ create mode 100644 tools/arch/arm64/include/uapi/asm/bitsperlong.h
+ create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
+
+--- /dev/null
++++ b/arch/arm64/include/uapi/asm/bitsperlong.h
+@@ -0,0 +1,24 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++/*
++ * Copyright (C) 2012 ARM Ltd.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef __ASM_BITSPERLONG_H
++#define __ASM_BITSPERLONG_H
++
++#define __BITS_PER_LONG 64
++
++#include <asm-generic/bitsperlong.h>
++
++#endif        /* __ASM_BITSPERLONG_H */
+--- /dev/null
++++ b/arch/riscv/include/uapi/asm/bitsperlong.h
+@@ -0,0 +1,14 @@
++/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
++/*
++ * Copyright (C) 2012 ARM Ltd.
++ * Copyright (C) 2015 Regents of the University of California
++ */
++
++#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
++#define _UAPI_ASM_RISCV_BITSPERLONG_H
++
++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
++
++#include <asm-generic/bitsperlong.h>
++
++#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
+--- /dev/null
++++ b/tools/arch/arm64/include/uapi/asm/bitsperlong.h
+@@ -0,0 +1,24 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++/*
++ * Copyright (C) 2012 ARM Ltd.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef __ASM_BITSPERLONG_H
++#define __ASM_BITSPERLONG_H
++
++#define __BITS_PER_LONG 64
++
++#include <asm-generic/bitsperlong.h>
++
++#endif        /* __ASM_BITSPERLONG_H */
+--- /dev/null
++++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
+@@ -0,0 +1,14 @@
++/* SPDX-License-Identifier: GPL-2.0-only */
++/*
++ * Copyright (C) 2012 ARM Ltd.
++ * Copyright (C) 2015 Regents of the University of California
++ */
++
++#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
++#define _UAPI_ASM_RISCV_BITSPERLONG_H
++
++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
++
++#include <asm-generic/bitsperlong.h>
++
++#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
diff --git a/queue-6.1/net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch b/queue-6.1/net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch
new file mode 100644 (file)
index 0000000..23154e6
--- /dev/null
@@ -0,0 +1,43 @@
+From e3e01c1c15986f9531b854634eec8381e72cb605 Mon Sep 17 00:00:00 2001
+From: Maher Sanalla <msanalla@nvidia.com>
+Date: Tue, 17 Jan 2023 14:54:36 +0200
+Subject: net/mlx5: Fix memory leak in error flow of port set buffer
+
+From: Maher Sanalla <msanalla@nvidia.com>
+
+commit e3e01c1c15986f9531b854634eec8381e72cb605 upstream.
+
+In the cited commit, shared buffer updates were added whenever
+port buffer gets updated.
+
+However, in case the shared buffer update fails, exiting early from
+port_set_buffer() is performed without freeing previously-allocated memory.
+
+Fix it by jumping to out label where memory is freed before returning
+with error.
+
+Fixes: a440030d8946 ("net/mlx5e: Update shared buffer along with device buffer changes")
+Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
+@@ -325,11 +325,11 @@ static int port_set_buffer(struct mlx5e_
+       err = port_update_shared_buffer(priv->mdev, current_headroom_size,
+                                       new_headroom_size);
+       if (err)
+-              return err;
++              goto out;
+       err = port_update_pool_cfg(priv->mdev, port_buffer);
+       if (err)
+-              return err;
++              goto out;
+       err = mlx5e_port_set_pbmc(mdev, in);
+ out:
diff --git a/queue-6.1/net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch b/queue-6.1/net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch
new file mode 100644 (file)
index 0000000..ba2d21a
--- /dev/null
@@ -0,0 +1,45 @@
+From 623efc4cbd6115db36716e31037cb6d1f3ce6754 Mon Sep 17 00:00:00 2001
+From: Maher Sanalla <msanalla@nvidia.com>
+Date: Tue, 9 May 2023 17:56:01 +0300
+Subject: net/mlx5e: Do not update SBCM when prio2buffer command is invalid
+
+From: Maher Sanalla <msanalla@nvidia.com>
+
+commit 623efc4cbd6115db36716e31037cb6d1f3ce6754 upstream.
+
+The shared buffer pools configuration which are stored in the SBCM
+register are updated when the user changes the prio2buffer mapping.
+
+However, in case the user desired prio2buffer change is invalid,
+which can occur due to mapping a lossless priority to a not large enough
+buffer, the SBCM update should not be performed, as the user command is
+failed.
+
+Thus, Perform the SBCM update only after xoff threshold calculation is
+performed and the user prio2buffer mapping is validated.
+
+Fixes: a440030d8946 ("net/mlx5e: Update shared buffer along with device buffer changes")
+Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
+@@ -443,11 +443,11 @@ static int update_buffer_lossy(struct ml
+       }
+       if (changed) {
+-              err = port_update_pool_cfg(mdev, port_buffer);
++              err = update_xoff_threshold(port_buffer, xoff, max_mtu, port_buff_cell_sz);
+               if (err)
+                       return err;
+-              err = update_xoff_threshold(port_buffer, xoff, max_mtu, port_buff_cell_sz);
++              err = port_update_pool_cfg(mdev, port_buffer);
+               if (err)
+                       return err;
diff --git a/queue-6.1/net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch b/queue-6.1/net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch
new file mode 100644 (file)
index 0000000..d2f3ac7
--- /dev/null
@@ -0,0 +1,102 @@
+From 8b0587a885fdb34fd6090a3f8625cb7ac1444826 Mon Sep 17 00:00:00 2001
+From: Armen Ratner <armeng@nvidia.com>
+Date: Wed, 20 Aug 2025 16:32:09 +0300
+Subject: net/mlx5e: Preserve shared buffer capacity during headroom updates
+
+From: Armen Ratner <armeng@nvidia.com>
+
+commit 8b0587a885fdb34fd6090a3f8625cb7ac1444826 upstream.
+
+When port buffer headroom changes, port_update_shared_buffer()
+recalculates the shared buffer size and splits it in a 3:1 ratio
+(lossy:lossless) - Currently, the calculation is:
+lossless = shared / 4;
+lossy = (shared / 4) * 3;
+
+Meaning, the calculation dropped the remainder of shared % 4 due to
+integer division, unintentionally reducing the total shared buffer
+by up to three cells on each update. Over time, this could shrink
+the buffer below usable size.
+
+Fix it by changing the calculation to:
+lossless = shared / 4;
+lossy = shared - lossless;
+
+This retains all buffer cells while still approximating the
+intended 3:1 split, preventing capacity loss over time.
+
+While at it, perform headroom calculations in units of cells rather than
+in bytes for more accurate calculations avoiding extra divisions.
+
+Fixes: a440030d8946 ("net/mlx5e: Update shared buffer along with device buffer changes")
+Signed-off-by: Armen Ratner <armeng@nvidia.com>
+Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: Alexei Lazar <alazar@nvidia.com>
+Signed-off-by: Mark Bloch <mbloch@nvidia.com>
+Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
+Link: https://patch.msgid.link/20250820133209.389065-9-mbloch@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c |   18 ++++++---------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
+@@ -272,8 +272,8 @@ static int port_update_shared_buffer(str
+       /* Total shared buffer size is split in a ratio of 3:1 between
+        * lossy and lossless pools respectively.
+        */
+-      lossy_epool_size = (shared_buffer_size / 4) * 3;
+       lossless_ipool_size = shared_buffer_size / 4;
++      lossy_epool_size    = shared_buffer_size - lossless_ipool_size;
+       mlx5e_port_set_sbpr(mdev, 0, MLX5_EGRESS_DIR, MLX5_LOSSY_POOL, 0,
+                           lossy_epool_size);
+@@ -288,14 +288,12 @@ static int port_set_buffer(struct mlx5e_
+       u16 port_buff_cell_sz = priv->dcbx.port_buff_cell_sz;
+       struct mlx5_core_dev *mdev = priv->mdev;
+       int sz = MLX5_ST_SZ_BYTES(pbmc_reg);
+-      u32 new_headroom_size = 0;
+-      u32 current_headroom_size;
++      u32 current_headroom_cells = 0;
++      u32 new_headroom_cells = 0;
+       void *in;
+       int err;
+       int i;
+-      current_headroom_size = port_buffer->headroom_size;
+-
+       in = kzalloc(sz, GFP_KERNEL);
+       if (!in)
+               return -ENOMEM;
+@@ -306,12 +304,14 @@ static int port_set_buffer(struct mlx5e_
+       for (i = 0; i < MLX5E_MAX_NETWORK_BUFFER; i++) {
+               void *buffer = MLX5_ADDR_OF(pbmc_reg, in, buffer[i]);
++              current_headroom_cells += MLX5_GET(bufferx_reg, buffer, size);
++
+               u64 size = port_buffer->buffer[i].size;
+               u64 xoff = port_buffer->buffer[i].xoff;
+               u64 xon = port_buffer->buffer[i].xon;
+-              new_headroom_size += size;
+               do_div(size, port_buff_cell_sz);
++              new_headroom_cells += size;
+               do_div(xoff, port_buff_cell_sz);
+               do_div(xon, port_buff_cell_sz);
+               MLX5_SET(bufferx_reg, buffer, size, size);
+@@ -320,10 +320,8 @@ static int port_set_buffer(struct mlx5e_
+               MLX5_SET(bufferx_reg, buffer, xon_threshold, xon);
+       }
+-      new_headroom_size /= port_buff_cell_sz;
+-      current_headroom_size /= port_buff_cell_sz;
+-      err = port_update_shared_buffer(priv->mdev, current_headroom_size,
+-                                      new_headroom_size);
++      err = port_update_shared_buffer(priv->mdev, current_headroom_cells,
++                                      new_headroom_cells);
+       if (err)
+               goto out;
diff --git a/queue-6.1/net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch b/queue-6.1/net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch
new file mode 100644 (file)
index 0000000..0559770
--- /dev/null
@@ -0,0 +1,35 @@
+From fb07390463c95e6eef254044d6dde050bfb9807a Mon Sep 17 00:00:00 2001
+From: Pedro Tammela <pctammela@mojatatu.com>
+Date: Mon, 27 Feb 2023 12:23:52 -0300
+Subject: net/sched: act_connmark: handle errno on tcf_idr_check_alloc
+
+From: Pedro Tammela <pctammela@mojatatu.com>
+
+commit fb07390463c95e6eef254044d6dde050bfb9807a upstream.
+
+Smatch reports that 'ci' can be used uninitialized.
+The current code ignores errno coming from tcf_idr_check_alloc, which
+will lead to the incorrect usage of 'ci'. Handle the errno as it should.
+
+Fixes: 288864effe33 ("net/sched: act_connmark: transition to percpu stats and rcu")
+Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
+Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
+Reviewed-by: Simon Horman <simon.horman@corigine.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/sched/act_connmark.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/net/sched/act_connmark.c
++++ b/net/sched/act_connmark.c
+@@ -156,6 +156,9 @@ static int tcf_connmark_init(struct net
+               nparms->zone = parm->zone;
+               ret = 0;
++      } else {
++              err = ret;
++              goto out_free;
+       }
+       err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
index 02236a3e8527e9986530ebe114b82d39a99953ff..a5c6be8dc47e158b8f6a0b1c9d293494e1f4c7ac 100644 (file)
@@ -422,3 +422,8 @@ net-netpoll-fix-incorrect-refcount-handling-causing-incorrect-cleanup.patch
 eventpoll-replace-rwlock-with-spinlock.patch
 mm-percpu-do-not-consider-sleepable-allocations-atomic.patch
 isdn-misdn-hfcsusb-fix-memory-leak-in-hfcsusb_probe.patch
+asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch
+net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch
+net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch
+net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch
+net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch