mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] gve: clear flow rule cache state when freeing its buffers
@ 2026-11-18  2:34 Zhao Li
  0 siblings, 0 replies; only message in thread
From: Zhao Li @ 2026-11-18  2:34 UTC (permalink / raw)
  To: Joshua Washington, Harshitha Ramamurthy, Andrew Lunn,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Willem de Bruijn, Jordan Rhee, Ankit Garg, Ziwei Xiao,
	Jeroen de Borst, Praveen Kaligineedi, Tim Hostetler,
	Przemek Kitszel, Matt Olson, netdev, linux-kernel

Freeing the flow-rule cache clears its pointers but retains the cached
counts and synchronization flag. A successful rule-reset command
invalidates the cache, but a failed reset does not. Recovery can then
allocate zeroed buffers while retaining a nonzero count and synced flag,
causing a later flow-rule query to return zeroed rules as if they were a
synchronized cache.

Clear the complete cache state after freeing its buffers so reallocation
always starts unsynchronized with zero cached entries.

Found by code review. Compile-tested with W=1.

AI assistance was used.

Fixes: 57718b60df9b ("gve: Add flow steering adminq commands")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
---
No new W=1, sparse or smatch warnings.

 drivers/net/ethernet/google/gve/gve_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 35cf0f06a0f2..747f5229d7ef 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -189,9 +189,8 @@ static void gve_free_flow_rule_caches(struct gve_priv *priv)
 	struct gve_flow_rules_cache *flow_rules_cache = &priv->flow_rules_cache;
 
 	kvfree(flow_rules_cache->rule_ids_cache);
-	flow_rules_cache->rule_ids_cache = NULL;
 	kvfree(flow_rules_cache->rules_cache);
-	flow_rules_cache->rules_cache = NULL;
+	memset(flow_rules_cache, 0, sizeof(*flow_rules_cache));
 }
 
 static int gve_alloc_rss_config_cache(struct gve_priv *priv)

base-commit: a2239d5dbbda3a61b6323df8836f605921a29f7f
-- 
2.56.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-18  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  2:34 [PATCH net] gve: clear flow rule cache state when freeing its buffers Zhao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®