net/mlx4: Check retval of mlx4_bitmap_init
authorPeter Kosyh <pkosyh@yandex.ru>
Thu, 17 Nov 2022 15:28:06 +0000 (18:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:05 +0000 (17:41 +0100)
commit3a4cc56cd17d3f17053ef061ca9be356b2bf8aaa
treeaafe7abc6faf430fb57803c9083abe85727405c2
parentc368220e1780c06038c378f75c1928c2d07d471c
net/mlx4: Check retval of mlx4_bitmap_init

[ Upstream commit 594c61ffc77de0a197934aa0f1df9285c68801c6 ]

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.

Fixes: d57febe1a478 ("net/mlx4: Add A0 hybrid steering")
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Peter Kosyh <pkosyh@yandex.ru>
Link: https://lore.kernel.org/r/20221117152806.278072-1-pkosyh@yandex.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx4/qp.c