From: Andreas Hindborg <a.hindborg@kernel.org>
To: Adarsh Das <adarshdas950@gmail.com>, adarshdas950@gmail.com
Cc: acourbot@nvidia.com, aliceryhl@google.com, axboe@kernel.dk,
bjorn3_gh@protonmail.com, boqun@kernel.org, dakr@kernel.org,
daniel.almeida@collabora.com, gary@garyguo.net,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
lossin@kernel.org, ojeda@kernel.org,
rust-for-linux@vger.kernel.org, tamird@kernel.org,
tmgross@umich.edu, work@onurozkan.dev
Subject: Re: [PATCH v2] rust: block: set GenDisk block_device_operations.owner to THIS_MODULE
Date: Thu, 06 Aug 2026 11:08:05 +0200 [thread overview]
Message-ID: <87bjbf4nwq.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <20260806083655.23161-1-adarshdas950@gmail.com>
"Adarsh Das" <adarshdas950@gmail.com> writes:
> GenDiskBuilder left block_device_operations.owner NULL. Pass the driver's
> ThisModule into GenDiskBuilder::build(), heap-allocate the operations
> table, and keep it alive until the gendisk is released via free_disk.
> Update rnull as the in-tree caller.
>
> v2:
> - Free fops in free_disk instead of GenDisk::drop to fix use-after-free
> when the device stays open after removal. (Sashiko)
> - Install the cleanup guard before fops allocation to avoid leaking gendisk
> on -ENOMEM. (Sashiko)
> - Link to v1: https://lore.kernel.org/all/20260805192020.107601-1-adarshdas950@gmail.com/
>
> Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
The reason `owner` is not set is that we want to keep the vtable const.
But with Alvins recent series [1], we should be able to set owner in
const context.
Can you rebase on his series and see if you can make it work in const context?
Best regards,
Andreas Hindborg
[1] https://lore.kernel.org/r/20260723-fix-fops-owner-v9-0-c1c3af7f7bcb@linux.dev
next prev parent reply other threads:[~2026-08-06 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 19:20 [PATCH] rust: block: set GenDisk block_device_operations.owner to THIS_MODULE Adarsh Das
2026-08-06 8:36 ` [PATCH v2] " Adarsh Das
2026-08-06 9:08 ` Andreas Hindborg [this message]
2026-08-06 10:40 ` [PATCH v3] " Adarsh Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bjbf4nwq.fsf@t14s.mail-host-address-is-not-set \
--to=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=adarshdas950@gmail.com \
--cc=aliceryhl@google.com \
--cc=axboe@kernel.dk \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox