* [PATCH net 0/1] octeontx2-af: CGX: fix bitmap leaks
@ 2025-10-20 14:31 Bo Sun
2025-10-20 14:31 ` [PATCH net 1/1] " Bo Sun
0 siblings, 1 reply; 4+ messages in thread
From: Bo Sun @ 2025-10-20 14:31 UTC (permalink / raw)
To: kuba, pabeni
Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta,
andrew+netdev, davem, edumazet, netdev, linux-kernel, Bo Sun
This patch frees the RX/TX flow-control bitmaps in cgx_lmac_exit().
The leak was introduced in commit e740003874ed ("octeontx2-af:Flow
control resource management") and should be back-ported to stable.
Bo Sun (1):
octeontx2-af: CGX: fix bitmap leaks
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 ++
1 file changed, 2 insertions(+)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/1] octeontx2-af: CGX: fix bitmap leaks
2025-10-20 14:31 [PATCH net 0/1] octeontx2-af: CGX: fix bitmap leaks Bo Sun
@ 2025-10-20 14:31 ` Bo Sun
2025-10-20 15:45 ` Alexander Lobakin
2025-10-23 1:22 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Bo Sun @ 2025-10-20 14:31 UTC (permalink / raw)
To: kuba, pabeni
Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta,
andrew+netdev, davem, edumazet, netdev, linux-kernel, Bo Sun,
stable
The RX/TX flow-control bitmaps (rx_fc_pfvf_bmap and tx_fc_pfvf_bmap)
are allocated by cgx_lmac_init() but never freed in cgx_lmac_exit().
Unbinding and rebinding the driver therefore triggers kmemleak:
unreferenced object (size 16):
backtrace:
rvu_alloc_bitmap
cgx_probe
Free both bitmaps during teardown.
Fixes: e740003874ed ("octeontx2-af: Flow control resource management")
Cc: stable@vger.kernel.org
Signed-off-by: Bo Sun <bo@mboxify.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index ec0e11c77cbf..f56e6782c4de 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -1823,6 +1823,8 @@ static int cgx_lmac_exit(struct cgx *cgx)
cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, false);
cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, true);
kfree(lmac->mac_to_index_bmap.bmap);
+ kfree(lmac->rx_fc_pfvf_bmap.bmap);
+ kfree(lmac->tx_fc_pfvf_bmap.bmap);
kfree(lmac->name);
kfree(lmac);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 1/1] octeontx2-af: CGX: fix bitmap leaks
2025-10-20 14:31 ` [PATCH net 1/1] " Bo Sun
@ 2025-10-20 15:45 ` Alexander Lobakin
2025-10-23 1:22 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Alexander Lobakin @ 2025-10-20 15:45 UTC (permalink / raw)
To: Bo Sun
Cc: kuba, pabeni, sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta,
andrew+netdev, davem, edumazet, netdev, linux-kernel, stable
From: Bo Sun <bo@mboxify.com>
Date: Mon, 20 Oct 2025 22:31:12 +0800
> The RX/TX flow-control bitmaps (rx_fc_pfvf_bmap and tx_fc_pfvf_bmap)
> are allocated by cgx_lmac_init() but never freed in cgx_lmac_exit().
> Unbinding and rebinding the driver therefore triggers kmemleak:
>
> unreferenced object (size 16):
> backtrace:
> rvu_alloc_bitmap
> cgx_probe
>
> Free both bitmaps during teardown.
>
> Fixes: e740003874ed ("octeontx2-af: Flow control resource management")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bo Sun <bo@mboxify.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> index ec0e11c77cbf..f56e6782c4de 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> @@ -1823,6 +1823,8 @@ static int cgx_lmac_exit(struct cgx *cgx)
> cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, false);
> cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, true);
> kfree(lmac->mac_to_index_bmap.bmap);
> + kfree(lmac->rx_fc_pfvf_bmap.bmap);
> + kfree(lmac->tx_fc_pfvf_bmap.bmap);
> kfree(lmac->name);
> kfree(lmac);
> }
Thanks,
Olek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net 1/1] octeontx2-af: CGX: fix bitmap leaks
2025-10-20 14:31 ` [PATCH net 1/1] " Bo Sun
2025-10-20 15:45 ` Alexander Lobakin
@ 2025-10-23 1:22 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-10-23 1:22 UTC (permalink / raw)
To: Bo Sun
Cc: pabeni, sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta,
andrew+netdev, davem, edumazet, netdev, linux-kernel, stable
On Mon, 20 Oct 2025 22:31:12 +0800 Bo Sun wrote:
> The RX/TX flow-control bitmaps (rx_fc_pfvf_bmap and tx_fc_pfvf_bmap)
> are allocated by cgx_lmac_init() but never freed in cgx_lmac_exit().
> Unbinding and rebinding the driver therefore triggers kmemleak:
>
> unreferenced object (size 16):
> backtrace:
> rvu_alloc_bitmap
> cgx_probe
>
> Free both bitmaps during teardown.
>
> Fixes: e740003874ed ("octeontx2-af: Flow control resource management")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bo Sun <bo@mboxify.com>
Looks like rvu_free_bitmap() exists. We should probably use it?
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> index ec0e11c77cbf..f56e6782c4de 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> @@ -1823,6 +1823,8 @@ static int cgx_lmac_exit(struct cgx *cgx)
> cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, false);
> cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, true);
> kfree(lmac->mac_to_index_bmap.bmap);
> + kfree(lmac->rx_fc_pfvf_bmap.bmap);
> + kfree(lmac->tx_fc_pfvf_bmap.bmap);
> kfree(lmac->name);
> kfree(lmac);
> }
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-23 1:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 14:31 [PATCH net 0/1] octeontx2-af: CGX: fix bitmap leaks Bo Sun
2025-10-20 14:31 ` [PATCH net 1/1] " Bo Sun
2025-10-20 15:45 ` Alexander Lobakin
2025-10-23 1:22 ` Jakub Kicinski
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).