bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 19 Nov 2022 07:02:02 +0000 (15:02 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 22 Nov 2022 12:32:26 +0000 (13:32 +0100)
commit3637a29ccbb6461b7268c5c5db525935d510afc6
tree8d064967314dc3efda66bb8fcfd17f8c300cfc45
parent53270fb0fd77fe786d8c07a0793981d797836b93
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()

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(). Call pci_dev_put() before returning from
bnx2x_vf_is_pcie_pending() to avoid refcount leak.

Fixes: b56e9670ffa4 ("bnx2x: Prepare device and initialize VF database")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20221119070202.1407648-1-yangyingliang@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c