From: Alvin Sun Date: Mon, 22 Jun 2026 10:44:59 +0800 Subject: [PATCH v3 5/6] rust: miscdevice: set fops.owner from driver module pointer MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260622-fix-fops-owner-v3-5-49d45cb37032@linux.dev> References: <20260622-fix-fops-owner-v3-0-49d45cb37032@linux.dev> In-Reply-To: <20260622-fix-fops-owner-v3-0-49d45cb37032@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann , Brendan Higgins , David Gow , Rae Moar , Breno Leitao , Jens Axboe Cc: rust-for-linux@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1782096299; l=933; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=XqlAKYyTcpktRZqbGKxCncze0Yay8QvqMz2MWsZrx6c=; b=gI7W0QWHpwLj3bG+T638uuriPi2CqLC3Fo+Ex/z/JTtCkwRe8LJi6L2BFmlk/TJ+LLtt+FGH1 V0h8jJtyIitCYLBooeYAzdGmvxMwNnRLN4BsGREZBUH61b0Kg6q0PxC X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 List-Id: B4 Relay Submissions Set the miscdevice fops owner field from the driver module pointer via the `this_module::()` helper, instead of defaulting to null. Signed-off-by: Alvin Sun --- rust/kernel/miscdevice.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs index 83ce50def5ac9..04fe4697ff564 100644 --- a/rust/kernel/miscdevice.rs +++ b/rust/kernel/miscdevice.rs @@ -26,10 +26,11 @@ mm::virt::VmaNew, prelude::*, seq_file::SeqFile, + this_module, types::{ ForeignOwnable, Opaque, // - }, + }, // }; use core::marker::PhantomData; @@ -430,6 +431,7 @@ impl MiscdeviceVTable { } else { None }, + owner: this_module::().as_ptr(), ..pin_init::zeroed() }; -- 2.43.0