Commit ecd89c02 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

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: 9b8dd5e5 ("gve: DQO: Add RX path")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66f1546d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -525,7 +525,7 @@ static int gve_rx_dqo(struct napi_struct *napi, struct gve_rx_ring *rx,
	struct gve_priv *priv = rx->gve;
	u16 buf_len;

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