Skip to contentSkip to conversation

batman-adv: set .owner to THIS_MODULE

PATCH In review Taehee Yoo 2 participants 3 messages Nov 15, 2020 Batman advanced

lore
Share & tools
lore

Taehee Yoo

author
#0 lore raw

PATCH v3 1/1 batman-adv: set .owner to THIS_MODULE

If THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.

Fixes 9e466250ede3 ("batman-adv: Prefix bat_debugfs local static functions with batadv_")

---

v3:
- Separate from one big series

v2:
- Change headline
- Squash patches into per-driver/subsystem

 net/batman-adv/log.c | 1 +
 1 file changed, 1 insertion(+)
net/batman-adv/log.c +1 -0
index a67b2b091447..c0ca5fbe5b08 100644
@@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = {
 	.read           = batadv_log_read,
 	.poll           = batadv_log_poll,
 	.llseek         = no_llseek,
+	.owner          = THIS_MODULE,
 };
 
 /**
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 5 lines · On Sunday, 15 November 2020 11:30:04 CET Taehee Yoo wrote:

If THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.

Fixes 9e466250ede3 ("batman-adv: Prefix bat_debugfs local static functions with batadv_")

This Fixes: is bogus. The code was already present with the first commit c6c8fea29769 ("net: Add batman-adv meshing protocol"). I have now changed it before it was applied to the net branch.

Quoted 9 lines
 net/batman-adv/log.c | 1 +
 1 file changed, 1 insertion(+)
net/batman-adv/log.c +0 -0
index a67b2b091447..c0ca5fbe5b08 100644

net/batman-adv/log.c static const struct file_operations batadv_log_fops = { · line 186

Quoted 7 lines
net/batman-adv/log.c +1 -0
@@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = {
 	.read           = batadv_log_read,
 	.poll           = batadv_log_poll,
 	.llseek         = no_llseek,
+	.owner          = THIS_MODULE,
 };
 
 /**

General info: This causes a merge problem with the net-next branch [1] because the debugfs files were dropped in preparation of the Linux 5.11 release in 2021. I might rebase the currently pending patches for net-next to avoid this weird merge conflict.

Kind regards,
Sven

[1] https://git.open-mesh.org/linux-merge.git/shortlog/refs/heads/batadv/net-next

author
#2 lore raw
Quoted 1 line · Sven Eckelmann

Hi Sven

Quoted 33 lines · On Sunday, 15 November 2020 11:30:04 CET Taehee Yoo wrote:
Quoted 5 lines

If THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.

Fixes 9e466250ede3 ("batman-adv: Prefix bat_debugfs local static functions with batadv_")

This Fixes: is bogus. The code was already present with the first commit c6c8fea29769 ("net: Add batman-adv meshing protocol"). I have now changed it before it was applied to the net branch.

Quoted 9 lines
 net/batman-adv/log.c | 1 +
 1 file changed, 1 insertion(+)
net/batman-adv/log.c +0 -0
index a67b2b091447..c0ca5fbe5b08 100644

net/batman-adv/log.c static const struct file_operations batadv_log_fops = { · line 186

Quoted 7 lines
net/batman-adv/log.c +1 -0
@@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = {
      .read           = batadv_log_read,
      .poll           = batadv_log_poll,
      .llseek         = no_llseek,
+     .owner          = THIS_MODULE,
 };
 
 /**

General info: This causes a merge problem with the net-next branch [1] because the debugfs files were dropped in preparation of the Linux 5.11 release in 2021. I might rebase the currently pending patches for net-next to avoid this weird merge conflict.

Quoted 4 lines

Kind regards,
Sven

[1] https://git.open-mesh.org/linux-merge.git/shortlog/refs/heads/batadv/net-next

Thank you so much for fixing the Fixes tag and providing information. Thanks again,
Taehee Yoo