[PATCH] arm64: kvm: ptdump: Initialize .owner fields of kvm_*_operations

Salah Triki posted 1 patch 9 months, 3 weeks ago
arch/arm64/kvm/ptdump.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] arm64: kvm: ptdump: Initialize .owner fields of kvm_*_operations
Posted by Salah Triki 9 months, 3 weeks ago
Initialize .owner fields of kvm_ptdump_guest_fops,
kvm_pgtable_range_fops and kvm_pgtable_levels_fops to THIS_MODULE in
order to prevent unloading the module while these operations are still
in use.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 arch/arm64/kvm/ptdump.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c
index e4a342e903e2..50f7d39333d6 100644
--- a/arch/arm64/kvm/ptdump.c
+++ b/arch/arm64/kvm/ptdump.c
@@ -185,6 +185,7 @@ static int kvm_ptdump_guest_close(struct inode *m, struct file *file)
 }
 
 static const struct file_operations kvm_ptdump_guest_fops = {
+	.owner		= THIS_MODULE,
 	.open		= kvm_ptdump_guest_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -244,6 +245,7 @@ static int kvm_pgtable_debugfs_close(struct inode *m, struct file *file)
 }
 
 static const struct file_operations kvm_pgtable_range_fops = {
+	.owner		= THIS_MODULE,
 	.open		= kvm_pgtable_range_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
@@ -251,6 +253,7 @@ static const struct file_operations kvm_pgtable_range_fops = {
 };
 
 static const struct file_operations kvm_pgtable_levels_fops = {
+	.owner		= THIS_MODULE,
 	.open		= kvm_pgtable_levels_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
-- 
2.34.1
Re: [PATCH] arm64: kvm: ptdump: Initialize .owner fields of kvm_*_operations
Posted by Marc Zyngier 9 months, 3 weeks ago
On Sun, 23 Feb 2025 15:08:44 +0000,
Salah Triki <salah.triki@gmail.com> wrote:
> 
> Initialize .owner fields of kvm_ptdump_guest_fops,
> kvm_pgtable_range_fops and kvm_pgtable_levels_fops to THIS_MODULE in
> order to prevent unloading the module while these operations are still
> in use.

Colour me curious, but what module are we talking about here?

	M.

-- 
Without deviation from the norm, progress is not possible.