lkml.org 
[lkml]   [2020]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] kobject: send KOBJ_REMOVE uevent when the object is removed from sysfs
On Sun, May 24, 2020 at 8:34 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> It is possible for a KOBJ_REMOVE uevent to be sent to userspace way
> after the files are actually gone from sysfs, due to how reference
> counting for kobjects work. This should not be a problem, but it would
> be good to properly send the information when things are going away, not
> at some later point in time in the future.
>
> Before this move, if a kobject's parent was torn down before the child,

^^^^ And this is the root of the problem and what has to be fixed.

> when the call to kobject_uevent() happened, the parent walk to try to
> reconstruct the full path of the kobject could be a total mess and cause
> crashes. It's not good to try to tear down a kobject tree from top
> down, but let's at least try to not to crash if a user does so.

One can try, but if we keep proper reference counting then kobject
core should take care of actually releasing objects in the right
order. I do not think you should keep this patch, and instead see if
we can push call to kobject_put(kobj->parent) into kobject_cleanup().

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2020-05-26 00:50    [W:0.104 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site