kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] gve: DQO: Fix off by one in gve_rx_dqo()
@ 2021-06-29  8:25 Dan Carpenter
  2021-06-29 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-29  8:25 UTC (permalink / raw)
  To: Catherine Sullivan, Bailey Forrest
  Cc: Sagi Shahar, Jon Olson, David S. Miller, Jakub Kicinski,
	Willem de Bruijn, netdev, kernel-janitors

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>
---
 drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] gve: DQO: Fix off by one in gve_rx_dqo()
  2021-06-29  8:25 [PATCH net-next] gve: DQO: Fix off by one in gve_rx_dqo() Dan Carpenter
@ 2021-06-29 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-29 19:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: csully, bcf, sagis, jonolson, davem, kuba, willemb, netdev,
	kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 29 Jun 2021 11:25:13 +0300 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net-next] gve: DQO: Fix off by one in gve_rx_dqo()
    https://git.kernel.org/netdev/net-next/c/ecd89c02da85

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-29 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29  8:25 [PATCH net-next] gve: DQO: Fix off by one in gve_rx_dqo() Dan Carpenter
2021-06-29 19:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).