[PATCH 0/2] kobject: avoid to cleanup kobject after module is unloaded

From: Ming Lei
Date: Fri Nov 05 2021 - 02:38:28 EST


Hello,

The 1st patch improves CONFIG_DEBUG_KOBJECT_RELEASE, so that kobject
cleanup after unloading module can be triggered easily. With this patch,
'modprobe kset-example' can trigger the issue very quickly.

The 2nd patch fixes the issue of cleaning up object after module is
unloaded, since kobj->ktype and related callbacks are often allocated
as module static variable. We need to make sure kobject is really
cleaned up before freeing module. This issue is reported by Petr Mladek.


Ming Lei (2):
kobject: don't delay to cleanup module kobject
kobject: wait until kobject is cleaned up before freeing module

include/linux/kobject.h | 1 +
lib/kobject.c | 67 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)

--
2.31.1