Commit 9e3267cf authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

eth: gve: add missing netdev locks on reset and shutdown paths



All the misc entry points end up calling into either gve_open()
or gve_close(), they take rtnl_lock today but since the recent
instance locking changes should also take the instance lock.

Found by code inspection and untested.

Fixes: cae03e5b ("net: hold netdev instance lock during queue operations")
Acked-by: default avatarStanislav Fomichev <sdf@fomichev.me>
Reviewed-by: default avatarHarshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20250328164742.1268069-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0a541eaf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2077,7 +2077,9 @@ static void gve_handle_reset(struct gve_priv *priv)

	if (gve_get_do_reset(priv)) {
		rtnl_lock();
		netdev_lock(priv->dev);
		gve_reset(priv, false);
		netdev_unlock(priv->dev);
		rtnl_unlock();
	}
}
@@ -2714,6 +2716,7 @@ static void gve_shutdown(struct pci_dev *pdev)
	bool was_up = netif_running(priv->dev);

	rtnl_lock();
	netdev_lock(netdev);
	if (was_up && gve_close(priv->dev)) {
		/* If the dev was up, attempt to close, if close fails, reset */
		gve_reset_and_teardown(priv, was_up);
@@ -2721,6 +2724,7 @@ static void gve_shutdown(struct pci_dev *pdev)
		/* If the dev wasn't up or close worked, finish tearing down */
		gve_teardown_priv_resources(priv);
	}
	netdev_unlock(netdev);
	rtnl_unlock();
}