The function mlx5_query_nic_vport_qkey_viol_cntr() calls the functuion
mlx5_query_nic_vport_context() but does not check its return value. This
could lead to undefined behavior if the query fails. A proper
implementation can be found in mlx5_nic_vport_query_local_lb().
Add error handling for mlx5_query_nic_vport_context(). If it fails, free
the out buffer via kvfree() and return error code.
Fixes: 9efa75254593 ("net/mlx5_core: Introduce access functions to query vport RoCE fields")
Cc: stable(a)vger.kernel.org # v4.5
Signed-off-by: Wentao Liang <vulab(a)iscas.ac.cn>
---
drivers/net/ethernet/mellanox/mlx5/core/vport.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
index 0d5f750faa45..276b162ccf18 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
@@ -518,20 +518,23 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
u16 *qkey_viol_cntr)
{
u32 *out;
- int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
+ int ret, outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
out = kvzalloc(outlen, GFP_KERNEL);
if (!out)
return -ENOMEM;
- mlx5_query_nic_vport_context(mdev, 0, out);
+ ret = mlx5_query_nic_vport_context(mdev, 0, out);
+ if (ret)
+ goto out;
*qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.qkey_violation_counter);
-
+ ret = 0;
+out:
kvfree(out);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_qkey_viol_cntr);
--
2.42.0.windows.2
v1->v2:
- Removed changes in pci-host-common.c, those were comitted
by mistake.
The first patch moves the initialization of cptlfs device info to the early
probe stage, also eliminate redundant initialization.
The second patch updates the driver to use a dynamically allocated
memory region for LMTST instead of the statically allocated memory
from firmware. It also adds myself as a maintainer.
Bharat Bhushan (2):
crypto: octeontx2: Initialize cptlfs device info once
crypto: octeontx2: Use dynamic allocated memory region for lmtst
MAINTAINERS | 1 +
drivers/crypto/marvell/octeontx2/cn10k_cpt.c | 89 ++++++++++++++-----
drivers/crypto/marvell/octeontx2/cn10k_cpt.h | 1 +
.../marvell/octeontx2/otx2_cpt_common.h | 1 +
.../marvell/octeontx2/otx2_cpt_mbox_common.c | 25 ++++++
drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 5 +-
drivers/crypto/marvell/octeontx2/otx2_cptlf.h | 12 ++-
.../marvell/octeontx2/otx2_cptpf_main.c | 18 +++-
.../marvell/octeontx2/otx2_cptpf_mbox.c | 6 +-
.../marvell/octeontx2/otx2_cptpf_ucode.c | 2 -
.../marvell/octeontx2/otx2_cptvf_main.c | 19 ++--
.../marvell/octeontx2/otx2_cptvf_mbox.c | 1 +
12 files changed, 133 insertions(+), 47 deletions(-)
--
2.34.1
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 76a771ec4c9adfd75fe53c8505cf656a075d7101
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable(a)vger.kernel.org>' --in-reply-to '2025051251-shawl-unmarked-03e8@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 76a771ec4c9adfd75fe53c8505cf656a075d7101 Mon Sep 17 00:00:00 2001
From: Koichiro Den <koichiro.den(a)canonical.com>
Date: Fri, 6 Dec 2024 10:10:47 +0900
Subject: [PATCH] virtio_net: ensure netdev_tx_reset_queue is called on bind
xsk for tx
virtnet_sq_bind_xsk_pool() flushes tx skbs and then resets tx queue, so
DQL counters need to be reset when flushing has actually occurred, Add
virtnet_sq_free_unused_buf_done() as a callback for virtqueue_resize()
to handle this.
Fixes: 21a4e3ce6dc7 ("virtio_net: xsk: bind/unbind xsk for tx")
Signed-off-by: Koichiro Den <koichiro.den(a)canonical.com>
Acked-by: Jason Wang <jasowang(a)redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo(a)linux.alibaba.com>
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 5cf4b2b20431..7646ddd9bef7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -5740,7 +5740,8 @@ static int virtnet_sq_bind_xsk_pool(struct virtnet_info *vi,
virtnet_tx_pause(vi, sq);
- err = virtqueue_reset(sq->vq, virtnet_sq_free_unused_buf, NULL);
+ err = virtqueue_reset(sq->vq, virtnet_sq_free_unused_buf,
+ virtnet_sq_free_unused_buf_done);
if (err) {
netdev_err(vi->dev, "reset tx fail: tx queue index: %d err: %d\n", qindex, err);
pool = NULL;
Hi,
On Sun, May 18, 2025 at 06:38:01AM -0400, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
>
> sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()
>
> to the 6.12-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
>
> The filename of the patch is:
> sched_ext-fix-missing-rq-lock-in-scx_bpf_cpuperf_set.patch
> and it can be found in the queue-6.12 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable(a)vger.kernel.org> know about it.
This requires upstream commit 18853ba782bef ("sched_ext: Track currently
locked rq").
Thanks,
-Andrea
>
>
>
> commit b19ccb5dc4d3d35b83b94fe2514456dc0b3a9ba5
> Author: Andrea Righi <arighi(a)nvidia.com>
> Date: Tue Apr 22 10:26:33 2025 +0200
>
> sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()
>
> [ Upstream commit a11d6784d7316a6c77ca9f14fb1a698ebbb3c1fb ]
>
> scx_bpf_cpuperf_set() can be used to set a performance target level on
> any CPU. However, it doesn't correctly acquire the corresponding rq
> lock, which may lead to unsafe behavior and trigger the following
> warning, due to the lockdep_assert_rq_held() check:
>
> [ 51.713737] WARNING: CPU: 3 PID: 3899 at kernel/sched/sched.h:1512 scx_bpf_cpuperf_set+0x1a0/0x1e0
> ...
> [ 51.713836] Call trace:
> [ 51.713837] scx_bpf_cpuperf_set+0x1a0/0x1e0 (P)
> [ 51.713839] bpf_prog_62d35beb9301601f_bpfland_init+0x168/0x440
> [ 51.713841] bpf__sched_ext_ops_init+0x54/0x8c
> [ 51.713843] scx_ops_enable.constprop.0+0x2c0/0x10f0
> [ 51.713845] bpf_scx_reg+0x18/0x30
> [ 51.713847] bpf_struct_ops_link_create+0x154/0x1b0
> [ 51.713849] __sys_bpf+0x1934/0x22a0
>
> Fix by properly acquiring the rq lock when possible or raising an error
> if we try to operate on a CPU that is not the one currently locked.
>
> Fixes: d86adb4fc0655 ("sched_ext: Add cpuperf support")
> Signed-off-by: Andrea Righi <arighi(a)nvidia.com>
> Acked-by: Changwoo Min <changwoo(a)igalia.com>
> Signed-off-by: Tejun Heo <tj(a)kernel.org>
> Signed-off-by: Sasha Levin <sashal(a)kernel.org>
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 7ed25654820fd..0147c4452f4df 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -7018,13 +7018,32 @@ __bpf_kfunc void scx_bpf_cpuperf_set(s32 cpu, u32 perf)
> }
>
> if (ops_cpu_valid(cpu, NULL)) {
> - struct rq *rq = cpu_rq(cpu);
> + struct rq *rq = cpu_rq(cpu), *locked_rq = scx_locked_rq();
> + struct rq_flags rf;
> +
> + /*
> + * When called with an rq lock held, restrict the operation
> + * to the corresponding CPU to prevent ABBA deadlocks.
> + */
> + if (locked_rq && rq != locked_rq) {
> + scx_ops_error("Invalid target CPU %d", cpu);
> + return;
> + }
> +
> + /*
> + * If no rq lock is held, allow to operate on any CPU by
> + * acquiring the corresponding rq lock.
> + */
> + if (!locked_rq) {
> + rq_lock_irqsave(rq, &rf);
> + update_rq_clock(rq);
> + }
>
> rq->scx.cpuperf_target = perf;
> + cpufreq_update_util(rq, 0);
>
> - rcu_read_lock_sched_notrace();
> - cpufreq_update_util(cpu_rq(cpu), 0);
> - rcu_read_unlock_sched_notrace();
> + if (!locked_rq)
> + rq_unlock_irqrestore(rq, &rf);
> }
> }
>