[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211109114736.GA16587@kili>
Date: Tue, 9 Nov 2021 14:47:36 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Jeroen de Borst <jeroendb@...gle.com>,
John Fraker <jfraker@...gle.com>
Cc: Catherine Sullivan <csully@...gle.com>,
David Awogbemila <awogbemila@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
Bailey Forrest <bcf@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
Yangchun Fu <yangchun@...gle.com>,
Tao Liu <xliutaox@...gle.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net] 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")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.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
Powered by blists - more mailing lists