* [PATCH net] net/mlx5e: Fix shared buffer size underflow
@ 2026-12-02 13:13 Tariq Toukan
2026-12-02 13:18 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2026-12-02 13:13 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni, Willem de Bruijn
Cc: Alex Lazar, Elliot Edmunds, Gal Pressman, Leon Romanovsky,
linux-rdma, Maher Sanalla, Mark Bloch, Moshe Shemesh,
Saeed Mahameed, Tariq Toukan
From: Elliot Edmunds <eedmunds@nvidia.com>
port_update_shared_buffer() computes shared_buffer_size as a u32.
When the new headroom exceeds the current headroom plus both pools,
it wraps, passes the "< 4" check, and the wrapped split is written
to SBPR. mlnx_qos exits 0 with the pools reading 32709/32748 cells.
Refuse such a request before any register write.
Fixes: a440030d8946 ("net/mlx5e: Update shared buffer along with device buffer changes")
Signed-off-by: Elliot Edmunds <eedmunds@nvidia.com>
Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Alex Lazar <alazar@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
index 4720523813b9..622ea8d9b12a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
@@ -264,7 +264,7 @@ static int port_update_shared_buffer(struct mlx5_core_dev *mdev,
lossless_ipool.size;
shared_buffer_size = total_buffer_size - new_headroom_size;
- if (shared_buffer_size < 4) {
+ if (new_headroom_size > total_buffer_size || shared_buffer_size < 4) {
pr_err("Requested port buffer is too large, not enough space left for shared buffer\n");
return -EINVAL;
}
base-commit: b6c8f45ed340f00bf2004d407cf7316fe3e24c48
--
2.44.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net/mlx5e: Fix shared buffer size underflow
2026-12-02 13:13 [PATCH net] net/mlx5e: Fix shared buffer size underflow Tariq Toukan
@ 2026-12-02 13:18 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-02 13:18 UTC (permalink / raw)
To: Tariq Toukan; +Cc: linux-rdma
> From: Elliot Edmunds <eedmunds@nvidia.com>
>
> port_update_shared_buffer() computes shared_buffer_size as a u32.
> When the new headroom exceeds the current headroom plus both pools,
> it wraps, passes the "< 4" check, and the wrapped split is written
> to SBPR. mlnx_qos exits 0 with the pools reading 32709/32748 cells.
>
> Refuse such a request before any register write.
>
> Fixes: a440030d8946 ("net/mlx5e: Update shared buffer along with device buffer changes")
> Signed-off-by: Elliot Edmunds <eedmunds@nvidia.com>
> Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
> Reviewed-by: Alex Lazar <alazar@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202131331.3445566-1-tariqt@nvidia.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 13:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 13:13 [PATCH net] net/mlx5e: Fix shared buffer size underflow Tariq Toukan
2026-12-02 13:18 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.