From: Greg Kroah-Hartman Date: Fri, 21 Nov 2025 11:21:08 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.6.117~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d28a2e57bd94991615816e7b9b6cdee6358fd93f;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches 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 --- 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 index 0000000000..62dc9be0a1 --- /dev/null +++ b/queue-6.1/asm-generic-partially-revert-unify-uapi-bitsperlong.h-for-arm64-riscv-and-loongarch.patch @@ -0,0 +1,134 @@ +From 6e8d96909a23c8078ee965bd48bb31cbef2de943 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +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 + +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 +Fixes: 8386f58f8deda ("asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch") +Acked-by: Catalin Marinas +Acked-by: Palmer Dabbelt +Tested-by: Nathan Chancellor +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + 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 . ++ */ ++#ifndef __ASM_BITSPERLONG_H ++#define __ASM_BITSPERLONG_H ++ ++#define __BITS_PER_LONG 64 ++ ++#include ++ ++#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 ++ ++#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 . ++ */ ++#ifndef __ASM_BITSPERLONG_H ++#define __ASM_BITSPERLONG_H ++ ++#define __BITS_PER_LONG 64 ++ ++#include ++ ++#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 ++ ++#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 index 0000000000..23154e6b1e --- /dev/null +++ b/queue-6.1/net-mlx5-fix-memory-leak-in-error-flow-of-port-set-buffer.patch @@ -0,0 +1,43 @@ +From e3e01c1c15986f9531b854634eec8381e72cb605 Mon Sep 17 00:00:00 2001 +From: Maher Sanalla +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 + +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 +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Signed-off-by: Greg Kroah-Hartman +--- + 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 index 0000000000..ba2d21a60e --- /dev/null +++ b/queue-6.1/net-mlx5e-do-not-update-sbcm-when-prio2buffer-command-is-invalid.patch @@ -0,0 +1,45 @@ +From 623efc4cbd6115db36716e31037cb6d1f3ce6754 Mon Sep 17 00:00:00 2001 +From: Maher Sanalla +Date: Tue, 9 May 2023 17:56:01 +0300 +Subject: net/mlx5e: Do not update SBCM when prio2buffer command is invalid + +From: Maher Sanalla + +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 +Reviewed-by: Moshe Shemesh +Signed-off-by: Saeed Mahameed +Signed-off-by: Greg Kroah-Hartman +--- + 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 index 0000000000..d2f3ac7264 --- /dev/null +++ b/queue-6.1/net-mlx5e-preserve-shared-buffer-capacity-during-headroom-updates.patch @@ -0,0 +1,102 @@ +From 8b0587a885fdb34fd6090a3f8625cb7ac1444826 Mon Sep 17 00:00:00 2001 +From: Armen Ratner +Date: Wed, 20 Aug 2025 16:32:09 +0300 +Subject: net/mlx5e: Preserve shared buffer capacity during headroom updates + +From: Armen Ratner + +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 +Signed-off-by: Maher Sanalla +Reviewed-by: Tariq Toukan +Signed-off-by: Alexei Lazar +Signed-off-by: Mark Bloch +Reviewed-by: Przemek Kitszel +Link: https://patch.msgid.link/20250820133209.389065-9-mbloch@nvidia.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + 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 index 0000000000..0559770d14 --- /dev/null +++ b/queue-6.1/net-sched-act_connmark-handle-errno-on-tcf_idr_check_alloc.patch @@ -0,0 +1,35 @@ +From fb07390463c95e6eef254044d6dde050bfb9807a Mon Sep 17 00:00:00 2001 +From: Pedro Tammela +Date: Mon, 27 Feb 2023 12:23:52 -0300 +Subject: net/sched: act_connmark: handle errno on tcf_idr_check_alloc + +From: Pedro Tammela + +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 +Signed-off-by: Pedro Tammela +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + 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); diff --git a/queue-6.1/series b/queue-6.1/series index 02236a3e85..a5c6be8dc4 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -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