[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331488109-13466-2-git-send-email-jiang.liu@huawei.com>
Date: Mon, 12 Mar 2012 01:48:25 +0800
From: Jiang Liu <liuj97@...il.com>
To: Yinghai Lu <yinghai@...nel.org>,
Jesse Barnes <jbarnes@...tuousgeek.org>,
Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Jiang Liu <jiang.liu@...wei.com>, Ashok Raj <ashok.raj@...el.com>,
Suresh Siddha <suresh.b.siddha@...el.com>,
Youquan Song <youquan.song@...el.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
chenkeping@...wei.com
Subject: [PATCH 1/5] Fix device reference count leakage in pci_dev_present()
This patch fixes a pci device reference count leakage issue in function
pci_dev_present().
Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
drivers/pci/search.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 9d75dc8..b572730 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -338,13 +338,13 @@ int pci_dev_present(const struct pci_device_id *ids)
WARN_ON(in_interrupt());
while (ids->vendor || ids->subvendor || ids->class_mask) {
found = pci_get_dev_by_id(ids, NULL);
- if (found)
- goto exit;
+ if (found) {
+ pci_dev_put(found);
+ return 1;
+ }
ids++;
}
-exit:
- if (found)
- return 1;
+
return 0;
}
EXPORT_SYMBOL(pci_dev_present);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists