* [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks
@ 2026-02-06 13:09 Bo Sun
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Bo Sun @ 2026-02-06 13:09 UTC (permalink / raw)
To: kuba, pabeni
Cc: gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel,
Bo Sun
Patch 1 fixes the RX/TX flow-control bitmap leaks in cgx_lmac_exit().
The leak was introduced in commit e740003874ed ("octeontx2-af: Flow
control resource management").
Patch 2 converts the existing kfree() for mac_to_index_bmap to
rvu_free_bitmap() for consistency with the alloc/free API pairing.
Changes in v2:
- Update patch 1 to use rvu_free_bitmap() instead of open-coding kfree()
- Add patch 2 to keep the alloc/free API pairing consistent
Bo Sun (2):
octeontx2-af: CGX: fix bitmap leaks
octeontx2-af: CGX: replace kfree() with rvu_free_bitmap()
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net v2 1/2] octeontx2-af: CGX: fix bitmap leaks
2026-02-06 13:09 [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks Bo Sun
@ 2026-02-06 13:09 ` Bo Sun
2026-02-07 12:17 ` Vadim Fedorenko
2026-02-09 7:58 ` Jijie Shao
2026-02-06 13:09 ` [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap() Bo Sun
2026-02-11 4:20 ` [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks patchwork-bot+netdevbpf
2 siblings, 2 replies; 8+ messages in thread
From: Bo Sun @ 2026-02-06 13:09 UTC (permalink / raw)
To: kuba, pabeni
Cc: gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, 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 42044cd810b1..fd4792e432bf 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);
+ rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
+ rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
kfree(lmac->name);
kfree(lmac);
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap()
2026-02-06 13:09 [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks Bo Sun
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
@ 2026-02-06 13:09 ` Bo Sun
2026-02-07 12:19 ` Vadim Fedorenko
2026-02-11 4:20 ` [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks patchwork-bot+netdevbpf
2 siblings, 1 reply; 8+ messages in thread
From: Bo Sun @ 2026-02-06 13:09 UTC (permalink / raw)
To: kuba, pabeni
Cc: gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel,
Bo Sun
mac_to_index_bmap is allocated with rvu_alloc_bitmap(), so free it
with rvu_free_bitmap() instead of open-coding kfree(.bmap) to keep
the alloc/free API pairing consistent.
Signed-off-by: Bo Sun <bo@mboxify.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index fd4792e432bf..29f5def796ba 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -1822,7 +1822,7 @@ static int cgx_lmac_exit(struct cgx *cgx)
continue;
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);
+ rvu_free_bitmap(&lmac->mac_to_index_bmap);
rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
kfree(lmac->name);
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 1/2] octeontx2-af: CGX: fix bitmap leaks
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
@ 2026-02-07 12:17 ` Vadim Fedorenko
2026-02-09 7:58 ` Jijie Shao
1 sibling, 0 replies; 8+ messages in thread
From: Vadim Fedorenko @ 2026-02-07 12:17 UTC (permalink / raw)
To: Bo Sun, kuba, pabeni
Cc: gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel,
stable
On 06/02/2026 13:09, 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>
> ---
> 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 42044cd810b1..fd4792e432bf 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);
> + rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
> + rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
> kfree(lmac->name);
> kfree(lmac);
> }
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap()
2026-02-06 13:09 ` [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap() Bo Sun
@ 2026-02-07 12:19 ` Vadim Fedorenko
2026-02-09 10:58 ` Bo Sun
0 siblings, 1 reply; 8+ messages in thread
From: Vadim Fedorenko @ 2026-02-07 12:19 UTC (permalink / raw)
To: Bo Sun, kuba, pabeni
Cc: gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel
On 06/02/2026 13:09, Bo Sun wrote:
> mac_to_index_bmap is allocated with rvu_alloc_bitmap(), so free it
> with rvu_free_bitmap() instead of open-coding kfree(.bmap) to keep
> the alloc/free API pairing consistent.
>
> Signed-off-by: Bo Sun <bo@mboxify.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> index fd4792e432bf..29f5def796ba 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> @@ -1822,7 +1822,7 @@ static int cgx_lmac_exit(struct cgx *cgx)
> continue;
> 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);
> + rvu_free_bitmap(&lmac->mac_to_index_bmap);
> rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
> rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
> kfree(lmac->name);
The code LGTM, but as Jakub metioned in v1, the cleanup should be
a separate patch targeting net-next.
On respin you can add:
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 1/2] octeontx2-af: CGX: fix bitmap leaks
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
2026-02-07 12:17 ` Vadim Fedorenko
@ 2026-02-09 7:58 ` Jijie Shao
1 sibling, 0 replies; 8+ messages in thread
From: Jijie Shao @ 2026-02-09 7:58 UTC (permalink / raw)
To: Bo Sun, kuba, pabeni
Cc: shaojijie, gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel,
stable
on 2026/2/6 21:09, 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>
> ---
> 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 42044cd810b1..fd4792e432bf 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);
> + rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
> + rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
Reviewed-by: Jijie Shao <shaojijie@huawei.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap()
2026-02-07 12:19 ` Vadim Fedorenko
@ 2026-02-09 10:58 ` Bo Sun
0 siblings, 0 replies; 8+ messages in thread
From: Bo Sun @ 2026-02-09 10:58 UTC (permalink / raw)
To: Vadim Fedorenko
Cc: kuba, pabeni, gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel
On 2026-02-07 20:19, Vadim Fedorenko wrote:
> On 06/02/2026 13:09, Bo Sun wrote:
>> mac_to_index_bmap is allocated with rvu_alloc_bitmap(), so free it
>> with rvu_free_bitmap() instead of open-coding kfree(.bmap) to keep
>> the alloc/free API pairing consistent.
>>
>> Signed-off-by: Bo Sun <bo@mboxify.com>
>> ---
>> drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
>> b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
>> index fd4792e432bf..29f5def796ba 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
>> @@ -1822,7 +1822,7 @@ static int cgx_lmac_exit(struct cgx *cgx)
>> continue;
>> 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);
>> + rvu_free_bitmap(&lmac->mac_to_index_bmap);
>> rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
>> rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
>> kfree(lmac->name);
>
> The code LGTM, but as Jakub metioned in v1, the cleanup should be
> a separate patch targeting net-next.
>
> On respin you can add:
> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Thanks. Will send the respin targeting net-next once it reopens.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks
2026-02-06 13:09 [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks Bo Sun
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
2026-02-06 13:09 ` [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap() Bo Sun
@ 2026-02-11 4:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-11 4:20 UTC (permalink / raw)
To: Bo Sun
Cc: kuba, pabeni, gakula, sgoutham, sbhatta, hkelam, horms, bbhushan2,
andrew+netdev, davem, edumazet, sumang, netdev, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 6 Feb 2026 21:09:23 +0800 you wrote:
> Patch 1 fixes the RX/TX flow-control bitmap leaks in cgx_lmac_exit().
> The leak was introduced in commit e740003874ed ("octeontx2-af: Flow
> control resource management").
> Patch 2 converts the existing kfree() for mac_to_index_bmap to
> rvu_free_bitmap() for consistency with the alloc/free API pairing.
>
> Changes in v2:
> - Update patch 1 to use rvu_free_bitmap() instead of open-coding kfree()
> - Add patch 2 to keep the alloc/free API pairing consistent
>
> [...]
Here is the summary with links:
- [net,v2,1/2] octeontx2-af: CGX: fix bitmap leaks
https://git.kernel.org/netdev/net/c/3def995c4ede
- [net,v2,2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap()
(no matching commit)
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] 8+ messages in thread
end of thread, other threads:[~2026-02-11 4:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 13:09 [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks Bo Sun
2026-02-06 13:09 ` [PATCH net v2 1/2] " Bo Sun
2026-02-07 12:17 ` Vadim Fedorenko
2026-02-09 7:58 ` Jijie Shao
2026-02-06 13:09 ` [PATCH net v2 2/2] octeontx2-af: CGX: replace kfree() with rvu_free_bitmap() Bo Sun
2026-02-07 12:19 ` Vadim Fedorenko
2026-02-09 10:58 ` Bo Sun
2026-02-11 4:20 ` [PATCH net v2 0/2] octeontx2-af: CGX: fix bitmap leaks 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