summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-06-29 11:25:13 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-29 21:49:44 +0300
commitecd89c02da85f724a2d24bc5a7e28043cc24b5d7 (patch)
tree01e114b8af6a1b8944f3b5b7196df9df9631700d /drivers/net
parent66f1546dfd7debe50fc056a84b97f2a56c2d769d (diff)
downloadlinux-ecd89c02da85f724a2d24bc5a7e28043cc24b5d7.tar.xz
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: 9b8dd5e5ea48 ("gve: DQO: Add RX path") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/google/gve/gve_rx_dqo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c
index 8738db020061..77bb8227f89b 100644
--- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c
+++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c
@@ -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;