[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 9/9] kobject: Require explicit initialization of struct kobj_type::release



On Sun Nov 8, 2026 at 11:39 PM CET, Ian Rogers wrote:
>  static const struct kobj_type cpuregs_kobj_type = {
> +     /*
> +      * Pre-existing: info->kobj is embedded in per-CPU cpu_data;
> +      * cpuid_cpu_offline() only calls kobject_del().
> +      */

All of these comments carry a “Pre-existing:” prefix, but that doesn’t
distinguish cases with broken lifetime management from those where the storage
remains valid despite the API misuse.

For example:

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> index ab14079d1c42..0847134a1391 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> @@ -797,6 +797,11 @@ static const struct sysfs_ops xcp_cfg_res_sysfs_ops = {
>  };
>  
>  static const struct kobj_type xcp_cfg_res_sysfs_ktype = {
> +     /*
> +      * Pre-existing: xcp_res is embedded in struct amdgpu_xcp_cfg
> +      * rather than freed individually by kobject_put().
> +      */
> +     .release = NULL,

Being embedded in another structure doesn't explain what guarantees that the
enclosing allocation outlives the kobject’s final cleanup.

Could you please drop the “Pre-existing:” prefix and make that distinction
explicit? For broken cases, describe the lifetime problem and mark it as needing
a follow-up fix. For cases where the lifetime is safe, explain what guarantees
that safety, while acknowledging that omitting release() still violates the
documented API contract.

Also, do you plan to follow up on those cases?

Thanks,
Danilo



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.