]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Fix pci device refcount leak in ppr_notifier()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 18 Nov 2022 09:36:04 +0000 (17:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:29 +0000 (11:41 +0100)
commit1ee464c55f2a34bcf6d16bb9d09e1324ee50f317
tree2171cf3a49e38c0ebcadcbd556a2236b54c9f09f
parent97884bb4bb2df8b362e71662e1cccc7966a2feeb
iommu/amd: Fix pci device refcount leak in ppr_notifier()

[ Upstream commit 6cf0981c2233f97d56938d9d61845383d6eb227c ]

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(). So call it before returning from ppr_notifier()
to avoid refcount leak.

Fixes: 1b86b5d75cab ("iommu/amd: Don't copy GCR3 table root pointer")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221118093604.216371-1-yangyingliang@huawei.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd_iommu_v2.c