Performing the DUMP_ETH_STATS firmware command outside the lock leads to kernel
panic when data structures such as RX/TX rings are freed in parallel, e.g when
one changes the mtu or ring sizes.
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
        struct mlx4_en_dev *mdev = priv->mdev;
        int err;
 
-       err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
-       if (err)
-               en_dbg(HW, priv, "Could not update stats\n");
-
        mutex_lock(&mdev->state_lock);
        if (mdev->device_up) {
+               err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
+               if (err)
+                       en_dbg(HW, priv, "Could not update stats\n");
+
                if (priv->port_up)
                        mlx4_en_auto_moderation(priv);