From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Elena Salomatkina <esalomatkina@ispras.ru>,
Saeed Mahameed <saeedm@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxim Mikityanskiy <maximmi@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>, Maor Dickman <maord@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc()
Date: Wed, 25 Sep 2024 08:49:11 +0300 [thread overview]
Message-ID: <17f3baee-c654-4e6f-a5d4-ba0899fe2385@gmail.com> (raw)
In-Reply-To: <20240924160018.29049-1-esalomatkina@ispras.ru>
On 24/09/2024 19:00, Elena Salomatkina wrote:
> 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@ispras.ru>
> ---
> v2: Fix tab, add blank line
>
> drivers/net/ethernet/mellanox/mlx5/core/en/tir.c | 3 +++
> 1 file changed, 3 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..11f724ad90db 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
> @@ -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;
Thanks for your patch.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
next prev parent reply other threads:[~2024-09-25 5:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 16:00 [PATCH net v2] net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc() Elena Salomatkina
2024-09-24 18:11 ` Simon Horman
2024-09-25 2:01 ` Kalesh Anakkur Purayil
2024-09-25 5:49 ` Tariq Toukan [this message]
2024-09-25 6:17 ` Gal Pressman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17f3baee-c654-4e6f-a5d4-ba0899fe2385@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=esalomatkina@ispras.ru \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=maord@nvidia.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).