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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:06 +0000 (17:41 +0100)
commit8af9450befbadca0097719d2388547e7388e006d
tree56ddd246a88c0bca468f2e3aee789f9cf373f684
parent251bcf6cfb353c634ee3d57fddb3a26849083c6b
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()

[ Upstream commit 3637a29ccbb6461b7268c5c5db525935d510afc6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c