Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6e295a4 authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman
Browse files

EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper()



[ Upstream commit 9c8921555907f4d723f01ed2d859b66f2d14f08e ]

As the comment of pci_get_domain_bus_and_slot() says, it returns
a PCI device with refcount incremented, so it doesn't need to
call an extra pci_dev_get() in pci_get_dev_wrapper(), and the PCI
device needs to be put in the error path.

Fixes: d4dc89d0 ("EDAC, i10nm: Add a driver for Intel 10nm server processors")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarQiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20221128065512.3572550-1-yangyingliang@huawei.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d5c06dba
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -53,11 +53,10 @@ static struct pci_dev *pci_get_dev_wrapper(int dom, unsigned int bus,
	if (unlikely(pci_enable_device(pdev) < 0)) {
	if (unlikely(pci_enable_device(pdev) < 0)) {
		edac_dbg(2, "Failed to enable device %02x:%02x.%x\n",
		edac_dbg(2, "Failed to enable device %02x:%02x.%x\n",
			 bus, dev, fun);
			 bus, dev, fun);
		pci_dev_put(pdev);
		return NULL;
		return NULL;
	}
	}


	pci_dev_get(pdev);

	return pdev;
	return pdev;
}
}