diff options
author | Heikki Krogerus <[email protected]> | 2020-06-04 19:46:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2020-07-10 14:14:37 +0200 |
commit | 079ad2fb4bf9eba8a0aaab014b49705cd7f07c66 (patch) | |
tree | 0ff76c10601ebfc13f2444f0d81b2caf93927702 /drivers/usb/cdns3/cdns3-trace.h | |
parent | e5711945c6415ab847b39ef89003ef68f9435bc6 (diff) |
kobject: Avoid premature parent object freeing in kobject_cleanup()
If kobject_del() is invoked by kobject_cleanup() to delete the
target kobject, it may cause its parent kobject to be freed
before invoking the target kobject's ->release() method, which
effectively means freeing the parent before dealing with the
child entirely.
That is confusing at best and it may also lead to functional
issues if the callers of kobject_cleanup() are not careful enough
about the order in which these calls are made, so avoid the
problem by making kobject_cleanup() drop the last reference to
the target kobject's parent at the end, after invoking the target
kobject's ->release() method.
[ rjw: Rewrite the subject and changelog, make kobject_cleanup()
drop the parent reference only when __kobject_del() has been
called. ]
Reported-by: Naresh Kamboju <[email protected]>
Reported-by: kernel test robot <[email protected]>
Fixes: 7589238a8cf3 ("Revert "software node: Simplify software_node_release() function"")
Suggested-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Heikki Krogerus <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Link: https://lore.kernel.org/r/1908555.IiAGLGrh1Z@kreacher
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-trace.h')
0 files changed, 0 insertions, 0 deletions