netdevsim: set .owner to THIS_MODULE
authorTaehee Yoo <ap420073@gmail.com>
Sun, 15 Nov 2020 10:30:41 +0000 (10:30 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Nov 2020 22:08:59 +0000 (14:08 -0800)
If THIS_MODULE is not set, the module would be removed while debugfs is
being used.
It eventually makes kernel panic.

Fixes: 82c93a87bf8b ("netdevsim: implement couple of testing devlink health reporters")
Fixes: 424be63ad831 ("netdevsim: add UDP tunnel port offload support")
Fixes: 4418f862d675 ("netdevsim: implement support for devlink region and snapshots")
Fixes: d3cbb907ae57 ("netdevsim: add ACL trap reporting cookie as a metadata")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://lore.kernel.org/r/20201115103041.30701-1-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/dev.c
drivers/net/netdevsim/health.c
drivers/net/netdevsim/udp_tunnels.c

index d070614..e7972e8 100644 (file)
@@ -96,6 +96,7 @@ static const struct file_operations nsim_dev_take_snapshot_fops = {
        .open = simple_open,
        .write = nsim_dev_take_snapshot_write,
        .llseek = generic_file_llseek,
+       .owner = THIS_MODULE,
 };
 
 static ssize_t nsim_dev_trap_fa_cookie_read(struct file *file,
@@ -188,6 +189,7 @@ static const struct file_operations nsim_dev_trap_fa_cookie_fops = {
        .read = nsim_dev_trap_fa_cookie_read,
        .write = nsim_dev_trap_fa_cookie_write,
        .llseek = generic_file_llseek,
+       .owner = THIS_MODULE,
 };
 
 static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
index 62958b2..21e2974 100644 (file)
@@ -261,6 +261,7 @@ static const struct file_operations nsim_dev_health_break_fops = {
        .open = simple_open,
        .write = nsim_dev_health_break_write,
        .llseek = generic_file_llseek,
+       .owner = THIS_MODULE,
 };
 
 int nsim_dev_health_init(struct nsim_dev *nsim_dev, struct devlink *devlink)
index 6ab023a..02dc312 100644 (file)
@@ -124,6 +124,7 @@ static const struct file_operations nsim_udp_tunnels_info_reset_fops = {
        .open = simple_open,
        .write = nsim_udp_tunnels_info_reset_write,
        .llseek = generic_file_llseek,
+       .owner = THIS_MODULE,
 };
 
 int nsim_udp_tunnels_info_create(struct nsim_dev *nsim_dev,