]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Fix access to sf_dev_table on allocation failure
authorShay Drory <shayd@nvidia.com>
Thu, 30 Dec 2021 06:54:08 +0000 (08:54 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 7 Jan 2022 00:55:41 +0000 (16:55 -0800)
commitaf5dbd9692e0631efa4f9e5293bf416c142b1876
tree6ad44c9117108c583fcec37e96edf3be95e81d90
parent7ce61ecbd546d09399d84c3a89a9611c79350678
net/mlx5: Fix access to sf_dev_table on allocation failure

Even when SF devices are supported, the SF device table allocation
can still fail.
In such case mlx5_sf_dev_supported still reports true, but SF device
table is invalid. This can result in NULL table access.

Hence, fix it by adding NULL table check.

Fixes: 8e1ee658163b ("net/mlx5: SF, Add auxiliary device driver")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c