]> git.baikalelectronics.ru Git - kernel.git/commit
net: pch_gbe: fix pci device refcount leak while module exiting
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 17 Nov 2022 13:51:48 +0000 (21:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:22:58 +0000 (11:22 +0100)
commit645ee7793dff17ff8a974bd045ff8945376e63a2
tree0d18f46fd09ea39d7885f1aa88f58db013d6e736
parenta43a1e6924641a41e7a4caffa928db980dd4a92a
net: pch_gbe: fix pci device refcount leak while module exiting

[ Upstream commit f2b75750f27d06f10fd09bb119bb9538a765d2b7 ]

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().

In pch_gbe_probe(), pci_get_domain_bus_and_slot() is called,
so in error path in probe() and remove() function, pci_dev_put()
should be called to avoid refcount leak. Compile tested only.

Fixes: 5c41bd3703ba ("net/pch_gbe: supports eg20t ptp clock")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221117135148.301014-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c