On 11/18/26 1:55 AM, Ian Rogers wrote:
On Sun, Nov 8, 2026 at 2:39 PM Ian Rogers <[email protected]> wrote:In add_var(), a struct kobject is dynamically allocated with kzalloc_obj() and initialized with secvar_ktype. If kobject_add() or sysfs_create_file() fails, kobject_put(kobj) is called to clean up. However, secvar_ktype does not define a .release callback, which results in a memory leak of kobj (and a pr_debug warning in kobject_cleanup() when CONFIG_DEBUG_KOBJECT_RELEASE is enabled). Provide a secvar_release() callback that calls kfree(kobj). Fixes: bd5d9c743d38 ("powerpc: expose secure variables to userspace via sysfs") Signed-off-by: Ian Rogers <[email protected]>Gentle ping on this patch (moving PowerPC maintainers to To: in case this got buried in Cc:). Danilo offered to take the full 9-patch kobj_type::release __must_init series through the driver-core tree with subsystem ACKs, and this is one of the last two patches awaiting an Acked-by. Does this look okay to go via driver-core?
Sure Ian Acked-by: Madhavan Srinivasan <[email protected]>
Thanks, Ian--- arch/powerpc/kernel/secvar-sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c index 395399bbab2c..f3f6ac25ea78 100644 --- a/arch/powerpc/kernel/secvar-sysfs.c +++ b/arch/powerpc/kernel/secvar-sysfs.c @@ -126,7 +126,13 @@ static const struct attribute_group secvar_attr_group = { }; __ATTRIBUTE_GROUPS(secvar_attr); +static void secvar_release(struct kobject *kobj) +{ + kfree(kobj); +} + static const struct kobj_type secvar_ktype = { + .release = secvar_release, .sysfs_ops = &kobj_sysfs_ops, .default_groups = secvar_attr_groups, }; -- 2.56.0.455.g6c5a503b38-goog
