]> 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)
committerJakub Kicinski <kuba@kernel.org>
Sat, 19 Nov 2022 03:40:14 +0000 (19:40 -0800)
commit9b4a6ca7e7c975a6cebef10832467a854c91a06d
tree7a4e36128af8d40f61ded688d7c5ada0d1d701dc
parent921619d468f65443142f14cff430da50bf260e7f
net: pch_gbe: fix pci device refcount leak while module exiting

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: f1b61d49a4c7 ("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>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c