Skip to content

Commit

Permalink
net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc()
Browse files Browse the repository at this point in the history
[ Upstream commit f25389e ]

In mlx5e_tir_builder_alloc() kvzalloc() may return NULL
which is dereferenced on the next line in a reference
to the modify field.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: a669673 ("net/mlx5e: Convert TIR to a dedicated object")
Signed-off-by: Elena Salomatkina <esalomatkina@ispras.ru>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Elena Salomatkina authored and gregkh committed Oct 10, 2024
1 parent 8e1ee00 commit 1bcc86c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify)
struct mlx5e_tir_builder *builder;

builder = kvzalloc(sizeof(*builder), GFP_KERNEL);
if (!builder)
return NULL;

builder->modify = modify;

return builder;
Expand Down

0 comments on commit 1bcc86c

Please sign in to comment.