Re: [PATCH] kobject_set_name_vargs memory leak

From: Sergey Senozhatsky
Date: Sun Jun 28 2009 - 09:39:12 EST


On (06/28/09 05:07), Eric W. Biederman wrote:
> Date: Sun, 28 Jun 2009 05:07:10 -0700
> From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
> To: Kay Sievers <kay.sievers@xxxxxxxx>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxx>,
> Greg KH <gregkh@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] kobject_set_name_vargs memory leak
> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
>
> Kay Sievers <kay.sievers@xxxxxxxx> writes:
>
> > On Sat, 2009-06-27 at 12:39 +0300, Sergey Senozhatsky wrote:
> >
> >> > >> Or something along those lines, I can't remember the exact reasoning
> >> > >> this early in the morning.
> >> > >>
> >> > >> Kay, do you remember?
> > [....]
> > Hmm, yes, I think there was only something to work around during the
> > transition from the static name array, which is gone now. At least I
> > can't see anything we need to care about with the current code.
> >
> > I guess, that would leak an allocated name, when it is set several times
> > in a row? Something like this?
>
> But setting a kobject's name several times in a row is a bug. You
> need to call kobject_rename if you are going to change the name.
>
Yes.

> So how about we fix the driver core not to do that. Stop treating fmt
> as a flag, and make it clear kobject_add should not be passed a name.
>
Sounds good.

Sergey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/