Commit 1c360cc1 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

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: 87a7f321 ("gve: Recover from queue stall due to missed IRQ")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b911192
...@@ -1137,7 +1137,7 @@ static void gve_tx_timeout(struct net_device *dev, unsigned int txqueue) ...@@ -1137,7 +1137,7 @@ static void gve_tx_timeout(struct net_device *dev, unsigned int txqueue)
goto reset; goto reset;
ntfy_idx = gve_tx_idx_to_ntfy(priv, txqueue); 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; goto reset;
block = &priv->ntfy_blocks[ntfy_idx]; block = &priv->ntfy_blocks[ntfy_idx];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment