Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by "Daniel Zahka"
Fri, 27 Nov 2026 11:54
Re: [PATCH net] net/mlx5e: psp: Fix stack info leak in PSP device stats
Author: "Daniel Zahka"
Date: Fri, 27 Nov 2026 11:54
Date: Fri, 27 Nov 2026 11:54
36 lines
12809 bytes
12809 bytes
On Thu Nov 26, 2026 at 4:11 PM EST, Tariq Toukan wrote:
> mlx5e_psp_get_stats() reads the PSP flow counters into an uninitialized
> on-stack struct. mlx5e_accel_psp_fs_get_stats_fill() ignores the
> mlx5_fc_query() return value, and a failed query, e.g. -ENOLINK when the
> device is in internal error state, leaves the counter fields unset. The
> uninitialized stack values are then reported to user space through the
> PSP get-stats netlink command.
>
> Zero-initialize the struct, so the counters of a failed query read 0.
>
> Fixes: b1346219e535 ("net/mlx5e: Add PSP stats support for Rx/Tx flows")
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
> index 73b232379263..4aacb4173b1b 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
> @@ -995,7 +995,7 @@ static void
> mlx5e_psp_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
> {
> struct mlx5e_priv *priv = netdev_priv(psd->main_netdev);
> - struct mlx5e_psp_stats nstats;
> + struct mlx5e_psp_stats nstats = {};
>
> mlx5e_accel_psp_fs_get_stats_fill(priv, &nstats);
> stats->rx_packets = nstats.psp_rx_pkts;
>
> base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads