From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Peter Kosyh <pkosyh@yandex.ru>, Tariq Toukan <tariqt@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH] net/mlx4: Check retval of mlx4_bitmap_init
Date: Tue, 15 Nov 2022 15:03:58 +0200 [thread overview]
Message-ID: <d3d9737f-381b-0156-a352-fa5d4fdf8a9f@gmail.com> (raw)
In-Reply-To: <20221115095356.157451-1-pkosyh@yandex.ru>
On 11/15/2022 11:53 AM, Peter Kosyh wrote:
> If mlx4_bitmap_init fails, mlx4_bitmap_alloc_range will dereference
> the NULL pointer (bitmap->table).
>
> Make sure, that mlx4_bitmap_alloc_range called in no error case.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
> ---
> drivers/net/ethernet/mellanox/mlx4/qp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
> index b149e601f673..48cfaa7eaf50 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/qp.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
> @@ -697,7 +697,8 @@ static int mlx4_create_zones(struct mlx4_dev *dev,
> err = mlx4_bitmap_init(*bitmap + k, 1,
> MLX4_QP_TABLE_RAW_ETH_SIZE - 1, 0,
> 0);
> - mlx4_bitmap_alloc_range(*bitmap + k, 1, 1, 0);
> + if (!err)
> + mlx4_bitmap_alloc_range(*bitmap + k, 1, 1, 0);
> }
>
> if (err)
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks for your patch.
next prev parent reply other threads:[~2022-11-15 13:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 9:53 [PATCH] net/mlx4: Check retval of mlx4_bitmap_init Peter Kosyh
2022-11-15 13:03 ` Tariq Toukan [this message]
2022-11-16 4:32 ` Jakub Kicinski
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=d3d9737f-381b-0156-a352-fa5d4fdf8a9f@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkosyh@yandex.ru \
--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).