On 08.11.26 23:39, Ian Rogers wrote:
hypervisor_init() in drivers/base/hypervisor.c creates hypervisor_kobj with kobject_create_and_add() (which allocates a dynamic kobject using dynamic_kobj_ktype), and hypervisor_subsys_init() in drivers/xen/sys-hypervisor.c then overwrites hypervisor_kobj->ktype with &hyp_sysfs_kobj_type, which had no .release callback.Add hyp_sysfs_release() calling kfree(kobj) to preserve the dynamic kobject release behavior. Fixes: cff7e81b3dd7 ("xen: add /sys/hypervisor support") Signed-off-by: Ian Rogers <[email protected]> --- drivers/xen/sys-hypervisor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index 91923242a5ae..0e8a2cd69fd6 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c @@ -659,7 +659,13 @@ static const struct sysfs_ops hyp_sysfs_ops = { .store = hyp_sysfs_store, };+static void hyp_sysfs_release(struct kobject *kobj)+{ + kfree(kobj); +} + static const struct kobj_type hyp_sysfs_kobj_type = { + .release = hyp_sysfs_release, .sysfs_ops = &hyp_sysfs_ops, };
Wouldn't it make sense to have a common function for just kfree(kobj)? In your series there are 3 instances of .release just doing kfree(kobj). In case this is not wanted or with using the suggested common .release helper you can add my Reviewed-by: Juergen Gross <[email protected]> Juergen
OpenPGP_signature.asc
Description: OpenPGP digital signature
