Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d51837f authored by Eugenia Emantayev's avatar Eugenia Emantayev Committed by David S. Miller
Browse files

net/mlx4_en: Issue the dump eth statistics command under lock



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: default avatarEugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1b1add0
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -977,12 +977,12 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
	struct mlx4_en_dev *mdev = priv->mdev;
	struct mlx4_en_dev *mdev = priv->mdev;
	int err;
	int err;


	mutex_lock(&mdev->state_lock);
	if (mdev->device_up) {
		err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
		err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
		if (err)
		if (err)
			en_dbg(HW, priv, "Could not update stats\n");
			en_dbg(HW, priv, "Could not update stats\n");


	mutex_lock(&mdev->state_lock);
	if (mdev->device_up) {
		if (priv->port_up)
		if (priv->port_up)
			mlx4_en_auto_moderation(priv);
			mlx4_en_auto_moderation(priv);