[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120227194038.GA11448@elte.hu>
Date: Mon, 27 Feb 2012 20:40:38 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Namhyung Kim <namhyung@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Namhyung Kim <namhyung.kim@....com>,
Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH] hw breakpoint: Fix possible memory leak
* Namhyung Kim <namhyung@...il.com> wrote:
> 2012-02-27 (월), 12:56 +0100, Ingo Molnar:
> > * Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> >
> > > On Mon, 2012-02-27 at 11:44 +0100, Ingo Molnar wrote:
> > > > I edited that code earlier today - is the form below OK, or can
> > > > you see a simpler method? It's not yet pushed out so can still
> > > > edit it.
> > >
> > > I think something like the below should do, but then I didn't really
> > > think much about it, my thoughts went like:
> > >
> > > ... *shees* that's ugly
> > > ... that error path already does a loop
> > > ... what the problem is!? -- reread changelog
> > > ... err_cpu == cpu is placed wrong!
> > >
> > >
> > > So I replied and marked read.. waiting to either hear if there's a good
> > > reason to do ugly or find a new (tested) patch in my inbox.. :-)
> > >
> > > ---
> > > kernel/events/hw_breakpoint.c | 4 ++--
> > > 1 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> > > index b0309f7..3330022 100644
> > > --- a/kernel/events/hw_breakpoint.c
> > > +++ b/kernel/events/hw_breakpoint.c
> > > @@ -658,10 +658,10 @@ int __init init_hw_breakpoint(void)
> > >
> > > err_alloc:
> > > for_each_possible_cpu(err_cpu) {
> > > - if (err_cpu == cpu)
> > > - break;
> > > for (i = 0; i < TYPE_MAX; i++)
> > > kfree(per_cpu(nr_task_bp_pinned[i], cpu));
> > > + if (err_cpu == cpu)
> > > + break;
> > > }
> >
> > Looks a lot nicer - I'll wait for an updated patch.
> >
> > Thanks,
> >
> > Ingo
>
> Ingo, do you want me to resend? If so, I really don't know how
> to give the credit to Peter in this case.
Just mention it in the changelog that this solution was his
idea. It was you who did most of the work: found the bug, wrote
the patch, wrote the changelog and tested the final patch ;-)
Thanks,
Ingo
--
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