Re: [PATCH] kobject: name reference should not be lost when lackof memory error happens

From: Greg KH
Date: Sat Oct 09 2010 - 14:33:32 EST


On Sat, Oct 09, 2010 at 04:32:44PM +0200, Kay Sievers wrote:
> On Thu, Oct 7, 2010 at 19:53, Greg KH <greg@xxxxxxxxx> wrote:
> > On Thu, Oct 07, 2010 at 01:32:53PM +0300, Roman Tereshonkov wrote:
> >> If lack of memory error happens we must restore the old kobject name reference
> >
> > No, we can't do that, as the caller will not be expecting that to have
> > happened, right Kay?
> >
> > I think the code as-is is correct, your kobject is in an unknown state
> > and can't be used anymore.
>
> Yeah, we've been there several times already with no clear decision so far.
>
> Trying to set a kobject name twice seems like a serious bug.
>
> We should kill the old_name logic, and add a WARN() when kobj->name is
> already set when the function is called, I think.

Agreed, it will be interesting to see what is trying to do this :)

thanks,

greg k-h
--
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/