All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] gve: Fix off by one in gve_tx_timeout()
@ 2021-11-09 11:47 Dan Carpenter
  2021-11-09 14:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-11-09 11:47 UTC (permalink / raw)
  To: Jeroen de Borst, John Fraker
  Cc: Catherine Sullivan, David Awogbemila, David S. Miller,
	Jakub Kicinski, Willem de Bruijn, Bailey Forrest, Eric Dumazet,
	Yangchun Fu, Tao Liu, netdev, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/google/gve/gve_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 7647cd05b1d2..2c091c99b81b 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -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];
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] gve: Fix off by one in gve_tx_timeout()
  2021-11-09 11:47 [PATCH net] gve: Fix off by one in gve_tx_timeout() Dan Carpenter
@ 2021-11-09 14:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-09 14:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: jeroendb, jfraker, csully, awogbemila, davem, kuba, willemb, bcf,
	edumazet, yangchun, xliutaox, netdev, kernel-janitors

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-09 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 11:47 [PATCH net] gve: Fix off by one in gve_tx_timeout() Dan Carpenter
2021-11-09 14:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.