Skip to content

Commit 40b8b82

Browse files
andy-shevgregkh
authored andcommitted
kobject: Restore old behaviour of kobject_del(NULL)
The commit 079ad2f ("kobject: Avoid premature parent object freeing in kobject_cleanup()") inadvertently dropped a possibility to call kobject_del() with NULL pointer. Restore the old behaviour. Fixes: 079ad2f ("kobject: Avoid premature parent object freeing in kobject_cleanup()") Cc: stable <[email protected]> Reported-by: Qu Wenruo <[email protected]> Cc: Heikki Krogerus <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4965b8c commit 40b8b82

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/kobject.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,12 @@ static void __kobject_del(struct kobject *kobj)
637637
*/
638638
void kobject_del(struct kobject *kobj)
639639
{
640-
struct kobject *parent = kobj->parent;
640+
struct kobject *parent;
641+
642+
if (!kobj)
643+
return;
641644

645+
parent = kobj->parent;
642646
__kobject_del(kobj);
643647
kobject_put(parent);
644648
}

0 commit comments

Comments
 (0)