[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
- To: "Ian Rogers" <irogers@xxxxxxxxxx>
- From: "Danilo Krummrich" <dakr@xxxxxxxxxx>
- Date: Wed, 18 Nov 2026 22:11:20 +0100
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=k20260515 header.d=kernel.org header.i="@kernel.org" header.h="Date:Cc:To:From:Subject:References:In-Reply-To"
- Cc: "Greg Kroah-Hartman" <gregkh@xxxxxxxxxxxxxxxxxxx>, "Kees Cook" <kees@xxxxxxxxxx>, "Miguel Ojeda" <ojeda@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael@xxxxxxxxxx>, "Madhavan Srinivasan" <maddy@xxxxxxxxxxxxx>, "Michael Ellerman" <mpe@xxxxxxxxxxxxxx>, "Nicholas Piggin" <npiggin@xxxxxxxxx>, "Christophe Leroy" <chleroy@xxxxxxxxxx>, "Nayna Jain" <nayna@xxxxxxxxxxxxx>, "Srish Srinivasan" <ssrish@xxxxxxxxxxxxx>, "Mimi Zohar" <zohar@xxxxxxxxxxxxx>, "Yoshinori Sato" <ysato@xxxxxxxxxxxxxxxxxxxx>, "Rich Felker" <dalias@xxxxxxxx>, "John Paul Adrian Glaubitz" <glaubitz@xxxxxxxxxxxxxxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, "Oleksandr Tyshchenko" <oleksandr_tyshchenko@xxxxxxxx>, "Nathan Chancellor" <nathan@xxxxxxxxxx>, "Nick Desaulniers" <ndesaulniers@xxxxxxxxxx>, "Viresh Kumar" <viresh.kumar@xxxxxxxxxx>, "Zhongqiu Han" <zhongqiu.han@xxxxxxxxxxxxxxxx>, "Alexander Aring" <aahringo@xxxxxxxxxx>, "Felix Kuehling" <felix.kuehling@xxxxxxx>, Christian König <christian.koenig@xxxxxxx>, "Zhihao Cheng" <chengzhihao1@xxxxxxxxxx>, "Sumanth Korikkar" <sumanthk@xxxxxxxxxxxxx>, "Bill Wendling" <morbo@xxxxxxxxxx>, "Justin Stitt" <justinstitt@xxxxxxxxxx>, <driver-core@xxxxxxxxxxxxxxx>, <llvm@xxxxxxxxxxxxxxx>, <linux-hardening@xxxxxxxxxxxxxxx>, <linux-fsdevel@xxxxxxxxxxxxxxx>, <linux-doc@xxxxxxxxxxxxxxx>, <linux-acpi@xxxxxxxxxxxxxxx>, <linux-pm@xxxxxxxxxxxxxxx>, <linuxppc-dev@xxxxxxxxxxxxxxxx>, <linux-sh@xxxxxxxxxxxxxxx>, <linux-s390@xxxxxxxxxxxxxxx>, <gfs2@xxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-mtd@xxxxxxxxxxxxxxxxxxx>, <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>, <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
- Delivery-date: Wed, 18 Nov 2026 21:11:40 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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
|