Skip to contentSkip to conversation

gve: Fix off by one in gve_tx_timeout()

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 9, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gve: Fix off by one in gve_tx_timeout()

The priv->ntfy_blocks[] has "priv->num_ntfy_blks" elements so this > needs to be >= to prevent an off by one bug. The priv->ntfy_blocks[] array is allocated in gve_alloc_notify_blocks().

Fixes 87a7f321bb6a ("gve: Recover from queue stall due to missed IRQ")
---
 drivers/net/ethernet/google/gve/gve_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_main.c +1 -1
index 7647cd05b1d2..2c091c99b81b 100644
@@ -1137,7 +1137,7 @@ static void gve_tx_timeout(struct net_device *dev, unsigned int txqueue)
 		goto reset;
 
 	ntfy_idx = gve_tx_idx_to_ntfy(priv, txqueue);
-	if (ntfy_idx > priv->num_ntfy_blks)
+	if (ntfy_idx >= priv->num_ntfy_blks)
 		goto reset;
 
 	block = &priv->ntfy_blocks[ntfy_idx];
Signature · 1 line
2.20.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 9 Nov 2021 14:47:36 +0300 you wrote:

The priv->ntfy_blocks[] has "priv->num_ntfy_blks" elements so this > needs to be >= to prevent an off by one bug. The priv->ntfy_blocks[] array is allocated in gve_alloc_notify_blocks().

Fixes 87a7f321bb6a ("gve: Recover from queue stall due to missed IRQ")

[...]

Here is the summary with links:
- [net] gve: Fix off by one in gve_tx_timeout()

    https://git.kernel.org/netdev/net/c/1c360cc1cc88

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html