Skip to content

Commit ecd89c0

Browse files
Dan Carpenterdavem330
authored andcommitted
gve: DQO: Fix off by one in gve_rx_dqo()
The rx->dqo.buf_states[] array is allocated in gve_rx_alloc_ring_dqo() and it has rx->dqo.num_buf_states so this > needs to >= to prevent an out of bounds access. Fixes: 9b8dd5e ("gve: DQO: Add RX path") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 66f1546 commit ecd89c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/google/gve/gve_rx_dqo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static int gve_rx_dqo(struct napi_struct *napi, struct gve_rx_ring *rx,
525525
struct gve_priv *priv = rx->gve;
526526
u16 buf_len;
527527

528-
if (unlikely(buffer_id > rx->dqo.num_buf_states)) {
528+
if (unlikely(buffer_id >= rx->dqo.num_buf_states)) {
529529
net_err_ratelimited("%s: Invalid RX buffer_id=%u\n",
530530
priv->dev->name, buffer_id);
531531
return -EINVAL;

0 commit comments

Comments
 (0)