Skip to contentSkip to conversation

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

PATCH In review Salah Triki 2 participants 2 messages Feb 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: kvm: ptdump: Initialize .owner fields of kvm_*_operations

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.

---
 arch/arm64/kvm/ptdump.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/kvm/ptdump.c +3 -0
index e4a342e903e2..50f7d39333d6 100644
@@ -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,
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 5 lines · Salah Triki

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.
Signature · 1 line
Without deviation from the norm, progress is not possible.