[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240923113455.24541-1-esalomatkina@ispras.ru>
Date: Mon, 23 Sep 2024 14:34:55 +0300
From: Elena Salomatkina <esalomatkina@...ras.ru>
To: Saeed Mahameed <saeedm@...dia.com>
Cc: Elena Salomatkina <esalomatkina@...ras.ru>,
Leon Romanovsky <leon@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Tariq Toukan <tariqt@...dia.com>,
Maor Dickman <maord@...dia.com>,
netdev@...r.kernel.org,
linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc()
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: a6696735d694 ("net/mlx5e: Convert TIR to a dedicated object")
Signed-off-by: Elena Salomatkina <esalomatkina@...ras.ru>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tir.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
index d4239e3b3c88..72310452fce5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
@@ -23,6 +23,8 @@ 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;
--
2.33.0
Powered by blists - more mailing lists