diff options
author | Aristeu Rozanski <aris@redhat.com> | 2013-12-05 10:37:56 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2013-12-21 07:26:57 -0500 |
commit | 90ed4988b8c030d65b41b7d13140e9376dc6ec5a (patch) | |
tree | 86cc49276f2f013355de12c9c18812582801d838 | |
parent | 8112c0cdf7b86f5917cdffcff4ffc477eaa62ed4 (diff) |
e752x_edac: Fix pci_dev usage count
In case the device 0, function 1 is not found using pci_get_device(),
pci_scan_single_device() will be used but, differently than
pci_get_device(), it allocates a pci_dev but doesn't does bump the usage
count on the pci_dev and after few module removals and loads the pci_dev
will be freed.
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Reviewed-by: mark gross <mark.gross@intel.com>
Link: http://lkml.kernel.org/r/20131205153755.GL4545@redhat.com
Signed-off-by: Borislav Petkov <bp@suse.de>
-rw-r--r-- | drivers/edac/e752x_edac.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c index 5fb01b03773a..92d54fa65f93 100644 --- a/drivers/edac/e752x_edac.c +++ b/drivers/edac/e752x_edac.c | |||
@@ -1182,9 +1182,11 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, | |||
1182 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, | 1182 | pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, |
1183 | pvt->dev_info->err_dev, pvt->bridge_ck); | 1183 | pvt->dev_info->err_dev, pvt->bridge_ck); |
1184 | 1184 | ||
1185 | if (pvt->bridge_ck == NULL) | 1185 | if (pvt->bridge_ck == NULL) { |
1186 | pvt->bridge_ck = pci_scan_single_device(pdev->bus, | 1186 | pvt->bridge_ck = pci_scan_single_device(pdev->bus, |
1187 | PCI_DEVFN(0, 1)); | 1187 | PCI_DEVFN(0, 1)); |
1188 | pci_dev_get(pvt->bridge_ck); | ||
1189 | } | ||
1188 | 1190 | ||
1189 | if (pvt->bridge_ck == NULL) { | 1191 | if (pvt->bridge_ck == NULL) { |
1190 | e752x_printk(KERN_ERR, "error reporting device not found:" | 1192 | e752x_printk(KERN_ERR, "error reporting device not found:" |