public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] dca: missing unlock in unregister_dca_providers()
@ 2010-11-17  5:10 Dan Carpenter
  2010-11-19 22:59 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-11-17  5:10 UTC (permalink / raw)
  To: Maciej Sosnowski; +Cc: David S. Miller, linux-kernel, kernel-janitors

We return here with the lock held and IRQs disabled by mistake.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index b98c676..b4c95be 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -110,8 +110,10 @@ static void unregister_dca_providers(void)
 
 	/* at this point only one domain in the list is expected */
 	domain = list_first_entry(&dca_domains, struct dca_domain, node);
-	if (!domain)
+	if (!domain) {
+		spin_unlock_irqrestore(&dca_lock, flags);
 		return;
+	}
 
 	list_for_each_entry_safe(dca, _dca, &domain->dca_providers, node) {
 		list_del(&dca->node);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] dca: missing unlock in unregister_dca_providers()
  2010-11-17  5:10 [patch] dca: missing unlock in unregister_dca_providers() Dan Carpenter
@ 2010-11-19 22:59 ` Andrew Morton
  2010-11-20 18:10   ` [patch v2] dca: remove unneeded NULL check Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2010-11-19 22:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Maciej Sosnowski, David S. Miller, linux-kernel, kernel-janitors

On Wed, 17 Nov 2010 08:10:32 +0300
Dan Carpenter <error27@gmail.com> wrote:

> We return here with the lock held and IRQs disabled by mistake.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
> index b98c676..b4c95be 100644
> --- a/drivers/dca/dca-core.c
> +++ b/drivers/dca/dca-core.c
> @@ -110,8 +110,10 @@ static void unregister_dca_providers(void)
>  
>  	/* at this point only one domain in the list is expected */
>  	domain = list_first_entry(&dca_domains, struct dca_domain, node);
> -	if (!domain)
> +	if (!domain) {
> +		spin_unlock_irqrestore(&dca_lock, flags);
>  		return;
> +	}
>  
>  	list_for_each_entry_safe(dca, _dca, &domain->dca_providers, node) {
>  		list_del(&dca->node);

I think the code's just bogus, actually. 
list_first_entry(&dca_domains) can't return NULL.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch v2] dca: remove unneeded NULL check
  2010-11-19 22:59 ` Andrew Morton
@ 2010-11-20 18:10   ` Dan Carpenter
  2010-11-22 16:49     ` Sosnowski, Maciej
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-11-20 18:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Maciej Sosnowski, David S. Miller, linux-kernel, kernel-janitors

The return here doesn't release the locks or re-enable IRQs.  But as
Andrew Morton points out, domain is never NULL.  list_first_entry() 
essentially never returns NULL and also we already verified that the
list is not empty. 

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index b98c676..c461eda 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -110,8 +110,6 @@ static void unregister_dca_providers(void)
 
 	/* at this point only one domain in the list is expected */
 	domain = list_first_entry(&dca_domains, struct dca_domain, node);
-	if (!domain)
-		return;
 
 	list_for_each_entry_safe(dca, _dca, &domain->dca_providers, node) {
 		list_del(&dca->node);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [patch v2] dca: remove unneeded NULL check
  2010-11-20 18:10   ` [patch v2] dca: remove unneeded NULL check Dan Carpenter
@ 2010-11-22 16:49     ` Sosnowski, Maciej
  0 siblings, 0 replies; 4+ messages in thread
From: Sosnowski, Maciej @ 2010-11-22 16:49 UTC (permalink / raw)
  To: Dan Carpenter, Andrew Morton
  Cc: David S. Miller, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org

Dan Carpenter wrote:
> The return here doesn't release the locks or re-enable IRQs.  But as
> Andrew Morton points out, domain is never NULL.  list_first_entry()
> essentially never returns NULL and also we already verified that the
> list is not empty.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c index
> b98c676..c461eda 100644
> --- a/drivers/dca/dca-core.c
> +++ b/drivers/dca/dca-core.c
> @@ -110,8 +110,6 @@ static void unregister_dca_providers(void)
> 
>  	/* at this point only one domain in the list is expected */
>  	domain = list_first_entry(&dca_domains, struct dca_domain, node);
> -	if (!domain)
> -		return;
> 
>  	list_for_each_entry_safe(dca, _dca, &domain->dca_providers, node) {
>  		list_del(&dca->node);

Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-22 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17  5:10 [patch] dca: missing unlock in unregister_dca_providers() Dan Carpenter
2010-11-19 22:59 ` Andrew Morton
2010-11-20 18:10   ` [patch v2] dca: remove unneeded NULL check Dan Carpenter
2010-11-22 16:49     ` Sosnowski, Maciej

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox