eth: gve: add missing netdev locks on reset and shutdown paths
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 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.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- drivers/net/ethernet/google/gve/gve_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/google/gve/gve_main.c +4 -0
@@ -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 (); }
Signature · 1 line
2.49.0
Quoted 8 lines · Jakub Kicinski
All the misc entry points end up calling into either
gve_open()orgve_close(), they takertnl_locktoday but since the recent instance locking changes should also take the instance lock.Found by code inspection and untested.
Fixes cae03e5bdd9e ("net: hold netdev instance lock during queue operations")Signed-off-by Jakub Kicinski <[email protected]>
Quoted 9 lines · Jakub Kicinski
All the misc entry points end up calling into either
gve_open()orgve_close(), they takertnl_locktoday but since the recent instance locking changes should also take the instance lock.Found by code inspection and untested.
Fixes cae03e5bdd9e ("net: hold netdev instance lock during queue operations")Signed-off-by Jakub Kicinski <[email protected]>
Quoted 45 lines
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]--- drivers/net/ethernet/google/gve/gve_main.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/ethernet/google/gve/gve_main.c +4
-1@@ -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 (); } --2.49.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 28 Mar 2025 09:47:42 -0700 you wrote:
All the misc entry points end up calling into either
gve_open()orgve_close(), they takertnl_locktoday but since the recent instance locking changes should also take the instance lock.Found by code inspection and untested.
Fixes cae03e5bdd9e ("net: hold netdev instance lock during queue operations")Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [net] eth: gve: add missing netdev locks on reset and shutdown paths
https://git.kernel.org/netdev/net/c/9e3267cf02c2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html