[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3d9737f-381b-0156-a352-fa5d4fdf8a9f@gmail.com>
Date: Tue, 15 Nov 2022 15:03:58 +0200
From: Tariq Toukan <ttoukan.linux@...il.com>
To: Peter Kosyh <pkosyh@...dex.ru>, Tariq Toukan <tariqt@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH] net/mlx4: Check retval of mlx4_bitmap_init
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@...dex.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@...dia.com>
Thanks for your patch.
Powered by blists - more mailing lists