public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Reuben Farrelly <reuben-lkml@reub.net>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	arjan@infradead.org
Subject: Re: 2.6.16-rc1-mm1
Date: Wed, 18 Jan 2006 14:09:27 -0500	[thread overview]
Message-ID: <20060118190926.GB316@redhat.com> (raw)
In-Reply-To: <20060118032716.7f0d9b6a.akpm@osdl.org>

On Wed, Jan 18, 2006 at 03:27:16AM -0800, Andrew Morton wrote:

 > Well yes, that code is kfree()ing a locked mutex.  It's somewhat weird to
 > take a lock on a still-private object but whatever.  The code's legal
 > enough.
 > 
 > 
 > --- devel/drivers/cpufreq/cpufreq.c~cpufreq-mutex-locking-fix	2006-01-18 03:25:33.000000000 -0800
 > +++ devel-akpm/drivers/cpufreq/cpufreq.c	2006-01-18 03:25:55.000000000 -0800
 > @@ -674,6 +674,7 @@ err_out_driver_exit:
 >  		cpufreq_driver->exit(policy);
 >  
 >  err_out:
 > +	mutex_unlock(&policy->lock);
 >  	kfree(policy);
 >  

This looks odd, because we do this..

    mutex_unlock(&policy->lock);

    /* set default policy */

    ret = cpufreq_set_policy(&new_policy);
    if (ret) {
        dprintk("setting policy failed\n");
        goto err_out_unregister;
    }

	...

err_out_unregister:
    spin_lock_irqsave(&cpufreq_driver_lock, flags);
    for_each_cpu_mask(j, policy->cpus)
        cpufreq_cpu_data[j] = NULL;
    spin_unlock_irqrestore(&cpufreq_driver_lock, flags);

    kobject_unregister(&policy->kobj);
    wait_for_completion(&policy->kobj_unregister);

err_out_driver_exit:
    if (cpufreq_driver->exit)
        cpufreq_driver->exit(policy);

err_out:
    kfree(policy);


With the patch above we'll mutex_unlock twice.
Is that allowed ? It sounds wrong to me.

		Dave


  reply	other threads:[~2006-01-18 19:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-18  8:50 2.6.16-rc1-mm1 Andrew Morton
2006-01-18 10:45 ` [PATCH] mempolicy.c compile fix Dominik Karall
2006-01-18 10:55 ` 2.6.16-rc1-mm1 Dominik Karall
2006-01-18 13:19   ` snd_pcm_format_name() problems [Re: 2.6.16-rc1-mm1] Jiri Slaby
2006-01-18 11:10 ` 2.6.16-rc1-mm1 Reuben Farrelly
2006-01-18 11:27   ` 2.6.16-rc1-mm1 Andrew Morton
2006-01-18 19:09     ` Dave Jones [this message]
2006-01-18 21:40       ` 2.6.16-rc1-mm1 Andrew Morton
2006-01-18 21:56         ` 2.6.16-rc1-mm1 Dave Jones
2006-01-18 23:13       ` 2.6.16-rc1-mm1 Alan Cox
2006-01-18 23:37         ` 2.6.16-rc1-mm1 Dave Jones
2006-01-19  7:16         ` 2.6.16-rc1-mm1 Arjan van de Ven
2006-01-18 11:53 ` [PATCH] migrate_page_add mangled brackets during merge Andy Whitcroft
2006-01-18 12:00 ` 2.6.16-rc1-mm1 Grant Coady
2006-01-18 12:41 ` 2.6.16-rc1-mm1 Reuben Farrelly
2006-01-18 22:29 ` Wireless issues (was 2.6.16-rc1-mm1 Valdis.Kletnieks
2006-01-18 22:56   ` Andrew Morton
2006-01-19  7:33     ` Valdis.Kletnieks
2006-01-19  9:33       ` Wireless issues (was Re: 2.6.16-rc1-mm1) Dominik Brodowski
2006-01-19  1:05 ` [-mm patch] make pcmcia_release_{io,irq} static Adrian Bunk
2006-01-19 11:14   ` Dominik Brodowski
2006-01-19  3:11 ` 2.6.16-rc1-mm1: ia64 compile error Adrian Bunk
2006-01-19  3:27   ` Greg KH
2006-01-19  3:31   ` Mark Maule

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060118190926.GB316@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=reuben-lkml@reub.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox