mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
net/mlx5: Fix access to sf_dev_table on allocation failure
[ Upstream commita1c7c49c20] 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:1958fc2f07("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7c1f9797e1
commit
fbe5f19824
@@ -28,10 +28,7 @@ bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_sf_dev_table *table = dev->priv.sf_dev_table;
|
||||
|
||||
if (!mlx5_sf_dev_supported(dev))
|
||||
return false;
|
||||
|
||||
return !xa_empty(&table->devices);
|
||||
return table && !xa_empty(&table->devices);
|
||||
}
|
||||
|
||||
static ssize_t sfnum_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
|
||||
Reference in New Issue
Block a user