summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2014-11-06 12:51:22 +0200
committerDavid S. Miller <davem@davemloft.net>2014-11-06 16:40:36 -0500
commit364d1798efdf13c7f2b9d902228adf8e84f1d963 (patch)
tree7662a703252362ffbca459f891a34f73e6140c8c
parenta158906dd7d4379e85ec371a14edfe1ce5f2318d (diff)
downloadlinux-364d1798efdf13c7f2b9d902228adf8e84f1d963.tar.gz
linux-364d1798efdf13c7f2b9d902228adf8e84f1d963.tar.bz2
linux-364d1798efdf13c7f2b9d902228adf8e84f1d963.zip
net/mlx5_core: Fix race on driver load
When events arrive at driver load, the event handler gets called even before the spinlock and list are initialized. Fix this by moving the initialization before EQs creation. Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 3d8e8e489b2d..71b10b210792 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -864,14 +864,14 @@ static int init_one(struct pci_dev *pdev,
dev->profile = &profile[prof_sel];
dev->event = mlx5_core_event;
+ INIT_LIST_HEAD(&priv->ctx_list);
+ spin_lock_init(&priv->ctx_lock);
err = mlx5_dev_init(dev, pdev);
if (err) {
dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err);
goto out;
}
- INIT_LIST_HEAD(&priv->ctx_list);
- spin_lock_init(&priv->ctx_lock);
err = mlx5_register_device(dev);
if (err) {
dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err);