From f9a2e4f3d762db99ac76609753dface6b0ee84ce Mon Sep 17 00:00:00 2001 From: Alvin Sun Date: Tue, 11 Aug 2026 14:39:48 +0800 Subject: [PATCH] rust: miscdevice: set fops.owner from driver module pointer Set the miscdevice fops owner field from the driver module pointer via the `this_module::()` helper, instead of defaulting to null. Assisted-by: opencode:glm-5.2 Reviewed-by: Andreas Hindborg Reviewed-by: Gary Guo Acked-by: Danilo Krummrich Acked-by: Greg Kroah-Hartman Reviewed-by: Alice Ryhl Signed-off-by: Alvin Sun Link: https://patch.msgid.link/20260811-fix-fops-owner-v10-6-7e71776f9dbe@linux.dev Signed-off-by: Miguel Ojeda --- 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 83ce50def5ac..2a4329f98614 100644 --- a/rust/kernel/miscdevice.rs +++ b/rust/kernel/miscdevice.rs @@ -24,12 +24,13 @@ IovIterSource, // }, mm::virt::VmaNew, + module::this_module, prelude::*, seq_file::SeqFile, types::{ ForeignOwnable, Opaque, // - }, + }, // }; use core::marker::PhantomData; @@ -430,6 +431,7 @@ impl MiscdeviceVTable { } else { None }, + owner: this_module::().as_ptr(), ..pin_init::zeroed() };