[PATCH 081/139] dca: check against empty dca_domains list before unregister provider

From: Luis Henriques
Date: Thu Feb 28 2013 - 10:05:08 EST


3.5.7.7 -stable review patch. If anyone has any objections, please let me know.

------------------

From: Maciej Sosnowski <maciej.sosnowski@xxxxxxxxx>

commit c419fcfd071cf34ba00f9f65282583772d2655e7 upstream.

When providers get blocked unregister_dca_providers() is called ending up
with dca_providers and dca_domain lists emptied. Dca should be prevented from
trying to unregister any provider if dca_domain list is found empty.

Reported-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
Tested-by: Gaohuai Han <hangaohuai@xxxxxxxxxx>
Signed-off-by: Maciej Sosnowski <maciej.sosnowski@xxxxxxxxx>
Signed-off-by: Dan Williams <djbw@xxxxxx>
Signed-off-by: Luis Henriques <luis.henriques@xxxxxxxxxxxxx>
---
drivers/dca/dca-core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index bc6f5fa..819dfda 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -420,6 +420,11 @@ void unregister_dca_provider(struct dca_provider *dca, struct device *dev)

raw_spin_lock_irqsave(&dca_lock, flags);

+ if (list_empty(&dca_domains)) {
+ raw_spin_unlock_irqrestore(&dca_lock, flags);
+ return;
+ }
+
list_del(&dca->node);

pci_rc = dca_pci_rc_from_dev(dev);
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/