The bitmap allocated with bitmap_zalloc() in otx2vf_probe() was not
released in otx2vf_remove(). Unbinding and rebinding the driver therefore
triggers a kmemleak warning:
unreferenced object (size 8):
backtrace:
bitmap_zalloc
otx2vf_probe
Call bitmap_free() in the remove path to fix the leak.
Fixes: efabce290151 ("octeontx2-pf: AF_XDP zero copy receive support")
Cc: stable@vger.kernel.org
Signed-off-by: Bo Sun <bo@mboxify.com>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index 7ebb6e656884..25381f079b97 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -854,6 +854,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
qmem_free(vf->dev, vf->dync_lmt);
otx2vf_vfaf_mbox_destroy(vf);
pci_free_irq_vectors(vf->pdev);
+ bitmap_free(vf->af_xdp_zc_qidx);
pci_set_drvdata(pdev, NULL);
free_netdev(netdev);
}
On Sat, Sep 27, 2025 at 03:15:04PM +0800, Bo Sun wrote:
> The bitmap allocated with bitmap_zalloc() in otx2vf_probe() was not
> released in otx2vf_remove(). Unbinding and rebinding the driver therefore
> triggers a kmemleak warning:
>
> unreferenced object (size 8):
> backtrace:
> bitmap_zalloc
> otx2vf_probe
>
> Call bitmap_free() in the remove path to fix the leak.
>
> Fixes: efabce290151 ("octeontx2-pf: AF_XDP zero copy receive support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bo Sun <bo@mboxify.com>
Reviewed-by: Simon Horman <horms@kernel.org>
For reference, as a fix for code present in net, this series
should be targeted at net, like this:
Subject: [PATCH net 1/2] ...
See: https://docs.kernel.org/process/maintainer-netdev.html
On 2025-09-29 18:11, Simon Horman wrote:
> On Sat, Sep 27, 2025 at 03:15:04PM +0800, Bo Sun wrote:
>> The bitmap allocated with bitmap_zalloc() in otx2vf_probe() was not
>> released in otx2vf_remove(). Unbinding and rebinding the driver
>> therefore
>> triggers a kmemleak warning:
>>
>> unreferenced object (size 8):
>> backtrace:
>> bitmap_zalloc
>> otx2vf_probe
>>
>> Call bitmap_free() in the remove path to fix the leak.
>>
>> Fixes: efabce290151 ("octeontx2-pf: AF_XDP zero copy receive support")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Bo Sun <bo@mboxify.com>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
> For reference, as a fix for code present in net, this series
> should be targeted at net, like this:
>
> Subject: [PATCH net 1/2] ...
>
> See: https://docs.kernel.org/process/maintainer-netdev.html
Thanks for pointing this out.
I’ll resend v2 for the net tree with the correct subject prefix.
Best regards,
Bo
On Mon, 29 Sep 2025 22:49:54 +0800 Bo Sun wrote: > I’ll resend v2 for the net tree with the correct subject prefix. Since you promised a v2 - could you also make sure you CC the people who signed off on the bad change? get_maintainer will point them out. Unless you know their address will bounce, in which case please mention that in the cover letter.
On 2025-09-30 09:53, Jakub Kicinski wrote: > On Mon, 29 Sep 2025 22:49:54 +0800 Bo Sun wrote: >> I’ll resend v2 for the net tree with the correct subject prefix. > > Since you promised a v2 - could you also make sure you CC the people > who signed off on the bad change? get_maintainer will point them out. > Unless you know their address will bounce, in which case please mention > that in the cover letter. Sure, I’ll CC all sign-off authors and everyone get_maintainer lists in v2.
© 2016 - 2026 Red Hat, Inc.