linux/drivers/net/ethernet/google/gve
Jordan Rhee 75a9a46d67 gve: prevent ethtool ops after shutdown
A crash can occur if an ethtool operation is invoked
after shutdown() is called.

shutdown() is invoked during system shutdown to stop DMA operations
without performing expensive deallocations. It is discouraged to
unregister the netdev in this path, so the device may still be visible
to userspace and kernel helpers.

In gve, shutdown() tears down most internal data structures. If an
ethtool operation is dispatched after shutdown(), it will dereference
freed or NULL pointers, leading to a kernel panic. While graceful
shutdown normally quiesces userspace before invoking the reboot
syscall, forced shutdowns (as observed on GCP VMs) can still trigger
this path.

Fix by calling netif_device_detach() in shutdown().
This marks the device as detached so the ethtool ioctl handler
will skip dispatching operations to the driver.

Fixes: 974365e518 ("gve: Implement suspend/resume/shutdown")
Signed-off-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Jeroen de Borst <jeroendb@google.com>
Link: https://patch.msgid.link/20250818211245.1156919-1-jeroendb@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-08-19 18:04:07 -07:00
..
Makefile gve: Add initial PTP device support 2025-06-16 15:27:24 -07:00
gve.h gve: implement DQO RX datapath and control path for AF_XDP zero-copy 2025-07-22 11:35:49 +02:00
gve_adminq.c gve: Return error for unknown admin queue command 2025-06-17 18:02:29 -07:00
gve_adminq.h gve: Fix various typos and improve code comments 2025-06-17 18:02:28 -07:00
gve_buffer_mgmt_dqo.c gve: implement DQO RX datapath and control path for AF_XDP zero-copy 2025-07-22 11:35:49 +02:00
gve_desc.h gve: trivial spell fix Recive to Receive 2023-07-14 10:28:17 +01:00
gve_desc_dqo.h gve: Implement ndo_hwtstamp_get/set for RX timestamping 2025-06-16 15:27:24 -07:00
gve_dqo.h gve: implement DQO TX datapath for AF_XDP zero-copy 2025-07-22 11:35:49 +02:00
gve_ethtool.c gve: Fix various typos and improve code comments 2025-06-17 18:02:28 -07:00
gve_flow_rule.c gve: Add flow steering ethtool support 2024-06-25 17:48:33 -07:00
gve_main.c gve: prevent ethtool ops after shutdown 2025-08-19 18:04:07 -07:00
gve_ptp.c gve: Add support to query the nic clock 2025-06-16 15:27:24 -07:00
gve_register.h gve: Deprecate adminq_pfn for pci revision 0x1. 2023-11-29 08:32:36 -08:00
gve_rx.c gve: make IRQ handlers and page allocation NUMA aware 2025-07-09 19:22:36 -07:00
gve_rx_dqo.c gve: implement DQO RX datapath and control path for AF_XDP zero-copy 2025-07-22 11:35:49 +02:00
gve_tx.c gve: rename gve_xdp_xmit to gve_xdp_xmit_gqi 2025-06-21 14:26:23 +01:00
gve_tx_dqo.c gve: implement DQO TX datapath for AF_XDP zero-copy 2025-07-22 11:35:49 +02:00
gve_utils.c net: hold netdev instance lock during queue operations 2025-03-06 12:59:43 -08:00
gve_utils.h gve: Add header split data path 2024-03-04 10:03:32 +00:00