[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/9] dlm: Free dlm_ls in kobject release callback
- To: Ian Rogers <irogers@xxxxxxxxxx>
- From: Alexander Aring <aahringo@xxxxxxxxxx>
- Date: Mon, 2 Nov 2026 15:52:55 -0500
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References"
- Cc: Kees Cook <kees@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Miguel Ojeda <ojeda@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael@xxxxxxxxxx>, Danilo Krummrich <dakr@xxxxxxxxxx>, Nathan Chancellor <nathan@xxxxxxxxxx>, Nick Desaulniers <ndesaulniers@xxxxxxxxxx>, Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>, Christian König <christian.koenig@xxxxxxx>, Zhihao Cheng <chengzhihao1@xxxxxxxxxx>, Zhongqiu Han <zhongqiu.han@xxxxxxxxxxxxxxxx>, 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, David Teigland <teigland@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxx>
- Delivery-date: Tue, 03 Nov 2026 06:25:22 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi,
On Tue, Oct 27, 2026 at 6:39 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> struct dlm_ls embeds a struct kobject (ls_kobj), but dlm_ktype lacked a
> .release callback and dlm freed the lockspace structure directly via
> kfree(ls). With CONFIG_DEBUG_KOBJECT_RELEASE=y, freeing ls before the
> delayed kobject release runs causes a use-after-free, and unloading the
> module while the delayed release is pending results in an instruction
> page fault.
>
> Add a completion ls_kobj_done and dlm_ls_release() to complete it when
> the last kobject reference is dropped, waiting for it in free_lockspace()
> before kfree(ls) and in the new_lockspace() error path before module_put().
> Also delete the kobject via kobject_del() before stopping dlm_recoverd
> to close the window where concurrent sysfs writes could wake the stopped
> recovery task.
>
> Fixes: 3514faca19a6 ("kobject: remove struct kobj_type from struct kset")
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
A somewhat "big change" for just a debug functionality. Althrough I
agree we shout call "kobject_del()" early to avoid additional sysfs
changes during removal.
Acked-by: Alexander Aring <aahringo@xxxxxxxxxx>
Thanks.
- Alex
|