Re: [ 47/53] dca: check against empty dca_domains list before unregisterprovider

From: Jiri Slaby
Date: Thu Feb 28 2013 - 17:17:35 EST


On 02/28/2013 11:04 PM, Jiri Slaby wrote:
> On 02/27/2013 12:58 AM, Greg Kroah-Hartman wrote:
>> 3.0-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: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>>
>> ---
>> drivers/dca/dca-core.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> --- a/drivers/dca/dca-core.c
>> +++ b/drivers/dca/dca-core.c
>> @@ -409,6 +409,11 @@ void unregister_dca_provider(struct dca_
>>
>> spin_lock_irqsave(&dca_lock, flags);
>>
>> + if (list_empty(&dca_domains)) {
>> + raw_spin_unlock_irqrestore(&dca_lock, flags);
>
> Hi, this is an incorrect backport. It should be spin_unlock_irqrestore
> obviously...

Fix attached.

--
js
suse labs
From: Jiri Slaby <jslaby@xxxxxxx>
Subject: dca: check against empty dca_domains list before unregister provider fix
Patch-mainline: no, submitted on 28th Feb 2013

In 3.0.67, commit 7a9a20ea77e7508c795dead9ab2f6c98a617762d (dca: check
against empty dca_domains list before unregister provider), upstream
commit c419fcfd071cf34ba00f9f65282583772d2655e7, added a fail path to
unregister_dca_provider. It added there also a call to
raw_spin_unlock_irqrestore. But in 3.0, the lock is not raw, so this
results in:
drivers/dca/dca-core.c: In function 'unregister_dca_provider':
drivers/dca/dca-core.c:413: warning: passing argument 1 of '_raw_spin_unlock_irqrestore' from incompatible pointer type

Fix it by calling spin_unlock_irqrestore properly.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/dca/dca-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -410,7 +410,7 @@ void unregister_dca_provider(struct dca_
spin_lock_irqsave(&dca_lock, flags);

if (list_empty(&dca_domains)) {
- raw_spin_unlock_irqrestore(&dca_lock, flags);
+ spin_unlock_irqrestore(&dca_lock, flags);
return;
}