Re: [PATCH] kobject: name reference should not be lost when lack ofmemory error happens

From: Kay Sievers
Date: Sat Oct 09 2010 - 10:33:13 EST


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.

People must use kobject_rename() if they want a new name, like the
comment above kobject_set_name() says.

Kay
--
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/