Skip to content

Commit

Permalink
gve: Fix off by one in gve_tx_timeout()
Browse files Browse the repository at this point in the history
[ Upstream commit 1c360cc ]

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: 87a7f32 ("gve: Recover from queue stall due to missed IRQ")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Nov 17, 2021
1 parent cf427bf commit e8cf4c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/google/gve/gve_main.c
Expand Up @@ -1132,7 +1132,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];
Expand Down

0 comments on commit e8cf4c9

Please sign in to comment.