octeontx2-af: debugsfs: fix pci device refcount leak
PATCH 1/1 octeontx2-af: debugsfs: fix pci device refcount leak
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put().
So before returning from rvu_dbg_rvu_pf_cgx_map_display() or cgx_print_dmac_flt(), pci_dev_put() is called to avoid refcount leak.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +3 -0
@@ -880,6 +880,8 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused)sprintf (lmac,"LMAC%d" , lmac_id);seq_printf (filp,"%s\t0x%x\t\tNIX%d\t\t%s\t%s\n" ,dev_name (&pdev->dev), pcifunc, blkid, cgx, lmac); + +pci_dev_put (pdev); }return 0 ; }
@@ -2566,6 +2568,7 @@ static int cgx_print_dmac_flt(struct seq_file *s, int lmac_id) } } +pci_dev_put (pdev);return 0 ; }
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 17 Nov 2022 20:46:58 +0800 you wrote:
As comment of
pci_get_domain_bus_and_slot()says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by callingpci_dev_put().So before returning from
rvu_dbg_rvu_pf_cgx_map_display()orcgx_print_dmac_flt(),pci_dev_put()is called to avoid refcount leak.[...]
Here is the summary with links:
- [net] octeontx2-af: debugsfs: fix pci device refcount leak
https://git.kernel.org/netdev/net/c/d66608803aa2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html