[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1285877851.2180.8.camel@cowboy>
Date: Thu, 30 Sep 2010 16:17:31 -0400
From: Davidlohr Bueso <dave@....org>
To: Dave Jones <davej@...hat.com>
Cc: David Rientjes <rientjes@...gle.com>, cpufreq@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RESEND PATCH] cpufreq: unnecesary double free in
pcc_cpufreq_do_osc
On Thu, 2010-09-30 at 16:08 -0400, Dave Jones wrote:
> On Thu, Sep 30, 2010 at 01:02:54PM -0700, David Rientjes wrote:
> > > index 994230d..db7dc35 100644
> > > --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
> > > +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
> > > @@ -379,6 +379,8 @@ static int __init pcc_cpufreq_do_osc(acpi_handle *handle)
> > > if (!(supported & 0x1))
> > > return -ENODEV;
> > >
> > > + return ret;
> > > +
> > > out_free:
> > > kfree(output.pointer);
> > > return ret;
> >
> > Why is the kfree() unnecessary? acpi_evaluate_object() will allocate a
> > new output.pointer if it returns 0, so at this point in the code you would
> > now be leaking the buffer.
> >
> > Instead, it would probably be better to fix the existing memory leaks in
> > that function where we return -ENODEV without going to out_free when
> > output.length is non-zero.
>
> Oh, *duh*. That was subtle.
Yep, anyways, at least we got the correct "fix".
> You, and Pekka are of course correct. I'll merge up Pekka's patch.
>
> thanks,
>
> Dave
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists