]> git.baikalelectronics.ru Git - kernel.git/commit
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>
Thu, 8 Dec 2022 10:22:59 +0000 (11:22 +0100)
commitea47bffa4a21f93e98d9b874b91a293c7faabacc
tree3f464b42350f2728c74873ddac2950552c603773
parent28b2c70adda6a47baccefdd98ffdd32b22de8395
bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()

[ Upstream commit af8e5ad4c14f6e6541eecc150187e349a93dbeb6 ]

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: fffee62ad6e4 ("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