Commit 8f76dd94 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Kleber Sacilotto de Souza

net/mlx4_core: Do not access comm channel if it has not yet been initialized

BugLink: https://bugs.launchpad.net/bugs/1878232

commit 81d18419 upstream.

In the Hypervisor, there are several FW commands which are invoked
before the comm channel is initialized (in mlx4_multi_func_init).
These include MOD_STAT_CONFIG, QUERY_DEV_CAP, INIT_HCA, and others.

If any of these commands fails, say with a timeout, the Hypervisor
driver enters the internal error reset flow. In this flow, the driver
attempts to notify all slaves via the comm channel that an internal error
has occurred.

Since the comm channel has not yet been initialized (i.e., mapped via
ioremap), this will cause dereferencing a NULL pointer.

To fix this, do not access the comm channel in the internal error flow
if it has not yet been initialized.

Fixes: 55ad3592 ("net/mlx4_core: Enable device recovery flow with SRIOV")
Fixes: ab9c17a0 ("mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet")
Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 8dd9e9e5
...@@ -2451,6 +2451,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) ...@@ -2451,6 +2451,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
kfree(priv->mfunc.master.slave_state); kfree(priv->mfunc.master.slave_state);
err_comm: err_comm:
iounmap(priv->mfunc.comm); iounmap(priv->mfunc.comm);
priv->mfunc.comm = NULL;
err_vhcr: err_vhcr:
dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE,
priv->mfunc.vhcr, priv->mfunc.vhcr,
...@@ -2518,6 +2519,13 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev) ...@@ -2518,6 +2519,13 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev)
int slave; int slave;
u32 slave_read; u32 slave_read;
/* If the comm channel has not yet been initialized,
* skip reporting the internal error event to all
* the communication channels.
*/
if (!priv->mfunc.comm)
return;
/* Report an internal error event to all /* Report an internal error event to all
* communication channels. * communication channels.
*/ */
...@@ -2552,6 +2560,7 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev) ...@@ -2552,6 +2560,7 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev)
} }
iounmap(priv->mfunc.comm); iounmap(priv->mfunc.comm);
priv->mfunc.comm = NULL;
} }
void mlx4_cmd_cleanup(struct mlx4_dev *dev, int cleanup_mask) void mlx4_cmd_cleanup(struct mlx4_dev *dev, int cleanup_mask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment