]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
dca: check against empty dca_domains list before unregister provider
authorMaciej Sosnowski <maciej.sosnowski@intel.com>
Wed, 23 May 2012 15:27:07 +0000 (17:27 +0200)
committerDan Williams <djbw@fb.com>
Tue, 18 Dec 2012 22:25:19 +0000 (14:25 -0800)
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.

Cc: <stable@vger.kernel.org>
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>
drivers/dca/dca-core.c

index bc6f5faa1e9ee692242a58c88b76932da114f15b..819dfda8823623fb8c7741f4ed299626393db044 100644 (file)
@@ -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);