lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250601195223.3388860-1-alok.a.tiwari@oracle.com>
Date: Sun,  1 Jun 2025 12:52:19 -0700
From: Alok Tiwari <alok.a.tiwari@...cle.com>
To: almasrymina@...gle.com, bcf@...gle.com, joshwash@...gle.com,
        willemb@...gle.com, pkaligineedi@...gle.com, pabeni@...hat.com,
        kuba@...nel.org, jeroendb@...gle.com, hramamurthy@...gle.com,
        andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
        netdev@...r.kernel.org
Cc: alok.a.tiwari@...cle.com
Subject: [QUERY] gve: gve_tx_free_rings_dqo() uses num_xdp_queues instead of num_xdp_rings

Hi,

In the function gve_tx_free_rings_dqo(), the number of TX rings to be
freed is currently calculated using:
for (i = 0; i < cfg->qcfg->num_queues + cfg->qcfg->num_xdp_queues; i++)

However, during allocation in gve_tx_alloc_rings_dqo(), the value
cfg->num_xdp_rings is used to determine how many XDP TX rings to
allocate. Although this value is set externally (typically from
cfg->qcfg->num_xdp_queues), the important point is that
cfg->num_xdp_rings is the actual count used during allocation.

Later, in gve_queues_start(), this same field (cfg->num_xdp_rings)
is used to populate priv->tx_cfg.num_xdp_queues.

Shouldn't gve_tx_free_rings_dqo() also use cfg->num_xdp_rings instead
of cfg->qcfg->num_xdp_queues, for consistency and correctness? Using
the same value throughout ensures that cleanup matches the actual
number of allocated rings, helping to avoid mismatches and potential
memory leaks.

This change would improve both clarity and correctness in the
resource management logic.

A proposed fix would be:
---
 drivers/net/ethernet/google/gve/gve_tx_dqo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/google/gve/gve_tx_dqo.c b/drivers/net/ethernet/google/gve/gve_tx_dqo.c
index 9d705d94b065..e7ee4fa7089c 100644
--- a/drivers/net/ethernet/google/gve/gve_tx_dqo.c
+++ b/drivers/net/ethernet/google/gve/gve_tx_dqo.c
@@ -424,7 +424,7 @@ void gve_tx_free_rings_dqo(struct gve_priv *priv,
 	if (!tx)
 		return;
 
-	for (i = 0; i < cfg->qcfg->num_queues + cfg->qcfg->num_xdp_queues; i++)
+	for (i = 0; i < cfg->qcfg->num_queues + cfg->qcfg->num_xdp_rings; i++)
 		gve_tx_free_ring_dqo(priv, &tx[i], cfg);
 
 	kvfree(tx);
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ