mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-13 11:07:46 +10:00
gve: prevent ethtool ops after shutdown
[ Upstream commit75a9a46d67
] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
748da80831
commit
ba51d73408
@ -2373,6 +2373,8 @@ static void gve_shutdown(struct pci_dev *pdev)
|
||||
struct gve_priv *priv = netdev_priv(netdev);
|
||||
bool was_up = netif_carrier_ok(priv->dev);
|
||||
|
||||
netif_device_detach(netdev);
|
||||
|
||||
rtnl_lock();
|
||||
if (was_up && gve_close(priv->dev)) {
|
||||
/* If the dev was up, attempt to close, if close fails, reset */
|
||||
|
Loading…
Reference in New Issue
Block a user