* [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths
@ 2025-03-28 16:47 Jakub Kicinski
2025-03-28 16:59 ` Stanislav Fomichev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-03-28 16:47 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
jeroendb, hramamurthy, pkaligineedi, willemb, shailend, joshwash,
sdf
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: cae03e5bdd9e ("net: hold netdev instance lock during queue operations")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jeroendb@google.com
CC: hramamurthy@google.com
CC: pkaligineedi@google.com
CC: willemb@google.com
CC: shailend@google.com
CC: joshwash@google.com
CC: sdf@fomichev.me
---
drivers/net/ethernet/google/gve/gve_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index cb2f9978f45e..f9a73c956861 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths
2025-03-28 16:47 [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths Jakub Kicinski
@ 2025-03-28 16:59 ` Stanislav Fomichev
2025-03-28 21:55 ` Harshitha Ramamurthy
2025-04-01 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2025-03-28 16:59 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, jeroendb,
hramamurthy, pkaligineedi, willemb, shailend, joshwash, sdf
On 03/28, Jakub Kicinski wrote:
> 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: cae03e5bdd9e ("net: hold netdev instance lock during queue operations")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths
2025-03-28 16:47 [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths Jakub Kicinski
2025-03-28 16:59 ` Stanislav Fomichev
@ 2025-03-28 21:55 ` Harshitha Ramamurthy
2025-04-01 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Harshitha Ramamurthy @ 2025-03-28 21:55 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, jeroendb,
pkaligineedi, willemb, shailend, joshwash, sdf
On Fri, Mar 28, 2025 at 9:47 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> 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: cae03e5bdd9e ("net: hold netdev instance lock during queue operations")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
> ---
> CC: jeroendb@google.com
> CC: hramamurthy@google.com
> CC: pkaligineedi@google.com
> CC: willemb@google.com
> CC: shailend@google.com
> CC: joshwash@google.com
> CC: sdf@fomichev.me
> ---
> drivers/net/ethernet/google/gve/gve_main.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index cb2f9978f45e..f9a73c956861 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths
2025-03-28 16:47 [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths Jakub Kicinski
2025-03-28 16:59 ` Stanislav Fomichev
2025-03-28 21:55 ` Harshitha Ramamurthy
@ 2025-04-01 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-01 0:10 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, jeroendb,
hramamurthy, pkaligineedi, willemb, shailend, joshwash, sdf
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 28 Mar 2025 09:47:42 -0700 you wrote:
> 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: cae03e5bdd9e ("net: hold netdev instance lock during queue operations")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-01 0:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 16:47 [PATCH net] eth: gve: add missing netdev locks on reset and shutdown paths Jakub Kicinski
2025-03-28 16:59 ` Stanislav Fomichev
2025-03-28 21:55 ` Harshitha Ramamurthy
2025-04-01 0:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).