summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Sosnowski <maciej.sosnowski@intel.com>2012-05-23 19:27:07 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-28 18:59:06 +0400
commit62fb8fe993f3a9060d75bc3d8b6eb9d153d8238c (patch)
tree95dbe745aaedc7bac66987cf4b90cdf5280424d1
parentb9bf60ac3e3779d4ffa03daceebf59df7b46c224 (diff)
downloadlinux-62fb8fe993f3a9060d75bc3d8b6eb9d153d8238c.tar.xz
dca: check against empty dca_domains list before unregister provider
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@huawei.com> Tested-by: Gaohuai Han <hangaohuai@huawei.com> Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Dan Williams <djbw@fb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dca/dca-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index bc6f5faa1e9e..819dfda88236 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);