Skip to content

Commit 9e3267c

Browse files
committed
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: cae03e5 ("net: hold netdev instance lock during queue operations") Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com> Link: https://patch.msgid.link/20250328164742.1268069-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0a541ea commit 9e3267c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/ethernet/google/gve/gve_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,9 @@ static void gve_handle_reset(struct gve_priv *priv)
20772077

20782078
if (gve_get_do_reset(priv)) {
20792079
rtnl_lock();
2080+
netdev_lock(priv->dev);
20802081
gve_reset(priv, false);
2082+
netdev_unlock(priv->dev);
20812083
rtnl_unlock();
20822084
}
20832085
}
@@ -2714,13 +2716,15 @@ static void gve_shutdown(struct pci_dev *pdev)
27142716
bool was_up = netif_running(priv->dev);
27152717

27162718
rtnl_lock();
2719+
netdev_lock(netdev);
27172720
if (was_up && gve_close(priv->dev)) {
27182721
/* If the dev was up, attempt to close, if close fails, reset */
27192722
gve_reset_and_teardown(priv, was_up);
27202723
} else {
27212724
/* If the dev wasn't up or close worked, finish tearing down */
27222725
gve_teardown_priv_resources(priv);
27232726
}
2727+
netdev_unlock(netdev);
27242728
rtnl_unlock();
27252729
}
27262730

0 commit comments

Comments
 (0)