Re: [PATCH v3 2/9] powerpc/secvar: Add missing kobject release callback to secvar_ktype
From: Madhavan Srinivasan
Date: Wed Nov 18 2026 - 06:28:23 EST
On 11/18/26 1:55 AM, Ian Rogers wrote:
On Sun, Nov 8, 2026 at 2:39 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:Sure Ian
In add_var(), a struct kobject is dynamically allocated withGentle ping on this patch (moving PowerPC maintainers to To: in case
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 <irogers@xxxxxxxxxx>
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?
Acked-by: Madhavan Srinivasan <maddy@xxxxxxxxxxxxx>
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