Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used
@ 2020-11-07 17:21 Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 01/21] net: set .owner to THIS_MODULE Taehee Yoo
                   ` (21 more replies)
  0 siblings, 22 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

When debugfs file is opened, its module should not be removed until
it's closed.
Because debugfs internally uses the module's data.
So, it could access freed memory.

In order to avoid panic, it just sets .owner to THIS_MODULE.
So that all modules will be held when its debugfs file is opened.

Test commands:
cat <<EOF > open.c
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
        int fd = open(argv[1], O_RDONLY);

        if(fd < 0) {
                printf("failed to open\n");
                return 1;
        }

        usleep(3000000);

        close(fd);
        return 0;
}
EOF
gcc -o open open.c
modprobe netdevsim
echo 1 > /sys/bus/netdevsim/new_device
./open /sys/kernel/debug/netdevsim/netdevsim1/take_snapshot &
modprobe -rv netdevsim

Splat looks like:
[   75.305876][  T662] BUG: unable to handle page fault for address: fffffbfff8096db4
[   75.308979][  T662] #PF: supervisor read access in kernel mode
[   75.311311][  T662] #PF: error_code(0x0000) - not-present page
[   75.313737][  T662] PGD 1237ee067 P4D 1237ee067 PUD 123612067 PMD 100ba7067 PTE 0
[   75.316858][  T662] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[   75.319389][  T662] CPU: 1 PID: 662 Comm: open Not tainted 5.10.0-rc2+ #785
[   75.322312][  T662] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[   75.326429][  T662] RIP: 0010:full_proxy_release+0xca/0x290
[   75.328712][  T662] Code: c1 ea 03 80 3c 02 00 0f 85 60 01 00 00 49 8d bc 24 80 00 00 00 4c 8b 73 28 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 71 01 00 00 49 8b 84 24 80 00 00 00 48 85 c0 0f
[   75.336716][  T662] RSP: 0018:ffff88800400fe48 EFLAGS: 00010a06
[   75.339153][  T662] RAX: dffffc0000000000 RBX: ffff88810139de00 RCX: ffff88810139de28
[   75.342419][  T662] RDX: 1ffffffff8096db4 RSI: ffff88810139de00 RDI: ffffffffc04b6da0
[   75.345629][  T662] RBP: ffff8881168342b0 R08: ffff8881168342b0 R09: ffff888110765300
[   75.348804][  T662] R10: ffff88800400fe88 R11: ffffed1022ac648a R12: ffffffffc04b6d20
[   75.352052][  T662] R13: ffff88810139de28 R14: ffff8881054a6d00 R15: ffff888110765300
[   75.355325][  T662] FS:  00007f937b80f4c0(0000) GS:ffff888118e00000(0000) knlGS:0000000000000000
[   75.358955][  T662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   75.361634][  T662] CR2: fffffbfff8096db4 CR3: 0000000004292002 CR4: 00000000003706e0
[   75.364847][  T662] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   75.368003][  T662] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   75.371259][  T662] Call Trace:
[   75.372655][  T662]  __fput+0x1ff/0x820
[   75.374316][  T662]  ? _raw_spin_unlock_irq+0x24/0x30
[   75.376454][  T662]  task_work_run+0xd3/0x170
[   75.378268][  T662]  exit_to_user_mode_prepare+0x14b/0x150
[   75.380586][  T662]  syscall_exit_to_user_mode+0x40/0x250
[   75.383015][  T662]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   75.385427][  T662] RIP: 0033:0x7f937b3159e4
[ ... ]

v1 -> v2:
 - Rebase
 - Squash patches into per-driver/subsystem

Taehee Yoo (21):
  net: set .owner to THIS_MODULE
  mac80211: set .owner to THIS_MODULE
  cfg80211: set .owner to THIS_MODULE
  netdevsim: set .owner to THIS_MODULE
  ieee802154: set .owner to THIS_MODULE
  i2400m: set .owner to THIS_MODULE
  wlcore: set .owner to THIS_MODULE
  wl1251: set .owner to THIS_MODULE
  iwlwifi: set .owner to THIS_MODULE
  iwlegacy: set .owner to THIS_MODULE
  rtlwifi: set .owner to THIS_MODULE
  ath11k: set .owner to THIS_MODULE
  ath10k: set .owner to THIS_MODULE
  wcn36xx: set .owner to THIS_MODULE
  wil6210: set .owner to THIS_MODULE
  cw1200: set .owner to THIS_MODULE
  brcmfmac: set .owner to THIS_MODULE
  b43legacy: set .owner to THIS_MODULE
  b43: set .owner to THIS_MODULE
  mwifiex: mwifiex: set .owner to THIS_MODULE
  Bluetooth: set .owner to THIS_MODULE

 drivers/net/ieee802154/ca8210.c               |  3 ++-
 drivers/net/netdevsim/dev.c                   |  2 ++
 drivers/net/netdevsim/health.c                |  1 +
 drivers/net/netdevsim/udp_tunnels.c           |  1 +
 drivers/net/wimax/i2400m/debugfs.c            |  2 ++
 drivers/net/wireless/ath/ath10k/debug.c       | 15 ++++++++++-----
 drivers/net/wireless/ath/ath11k/debugfs.c     |  7 +++++--
 drivers/net/wireless/ath/wcn36xx/debug.c      |  2 ++
 drivers/net/wireless/ath/wil6210/debugfs.c    | 19 +++++++++++++++++++
 drivers/net/wireless/broadcom/b43/debugfs.c   |  1 +
 .../net/wireless/broadcom/b43legacy/debugfs.c |  1 +
 .../broadcom/brcm80211/brcmfmac/core.c        |  1 +
 drivers/net/wireless/intel/iwlegacy/3945-rs.c |  1 +
 drivers/net/wireless/intel/iwlegacy/4965-rs.c |  3 +++
 drivers/net/wireless/intel/iwlegacy/debug.c   |  3 +++
 .../net/wireless/intel/iwlwifi/dvm/debugfs.c  |  3 +++
 drivers/net/wireless/intel/iwlwifi/dvm/rs.c   |  3 +++
 .../net/wireless/intel/iwlwifi/fw/debugfs.c   |  3 +++
 .../net/wireless/intel/iwlwifi/mvm/debugfs.c  |  1 +
 .../net/wireless/intel/iwlwifi/mvm/debugfs.h  |  3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c   |  3 +++
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |  3 +++
 .../net/wireless/marvell/mwifiex/debugfs.c    |  3 +++
 drivers/net/wireless/realtek/rtlwifi/debug.c  |  1 +
 drivers/net/wireless/st/cw1200/debug.c        |  1 +
 drivers/net/wireless/ti/wl1251/debugfs.c      |  4 ++++
 drivers/net/wireless/ti/wlcore/debugfs.h      |  3 +++
 net/6lowpan/debugfs.c                         |  1 +
 net/batman-adv/log.c                          |  1 +
 net/bluetooth/6lowpan.c                       |  1 +
 net/bluetooth/hci_core.c                      |  2 ++
 net/bluetooth/hci_debugfs.c                   |  6 ++++++
 net/bluetooth/selftest.c                      |  1 +
 net/bluetooth/smp.c                           |  2 ++
 net/mac80211/debugfs.c                        |  7 +++++++
 net/mac80211/debugfs_key.c                    |  3 +++
 net/mac80211/debugfs_netdev.c                 |  1 +
 net/mac80211/debugfs_sta.c                    |  2 ++
 net/mac80211/rate.c                           |  1 +
 net/mac80211/rc80211_minstrel_ht_debugfs.c    |  2 ++
 net/wireless/debugfs.c                        |  2 ++
 41 files changed, 117 insertions(+), 8 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 01/21] net: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 02/21] mac80211: " Taehee Yoo
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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_")
Fixes: 5609c185f24d ("6lowpan: iphc: add support for stateful compression")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 net/6lowpan/debugfs.c | 1 +
 net/batman-adv/log.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
index 1c140af06d52..2f791ccc783b 100644
--- a/net/6lowpan/debugfs.c
+++ b/net/6lowpan/debugfs.c
@@ -161,6 +161,7 @@ static const struct file_operations lowpan_ctx_pfx_fops = {
 	.write		= lowpan_ctx_pfx_write,
 	.llseek		= seq_lseek,
 	.release	= single_release,
+	.owner          = THIS_MODULE,
 };
 
 static void lowpan_dev_debugfs_ctx_init(struct net_device *dev,
diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
index a67b2b091447..c0ca5fbe5b08 100644
--- a/net/batman-adv/log.c
+++ b/net/batman-adv/log.c
@@ -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,
 };
 
 /**
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 02/21] mac80211: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 01/21] net: set .owner to THIS_MODULE Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 03/21] cfg80211: " Taehee Yoo
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: e9f207f0ff90 ("[MAC80211]: Add debugfs attributes.")
Fixes: 4b7679a561e5 ("mac80211: clean up rate control API")
Fixes: ec8aa669b839 ("mac80211: add the minstrel_ht rate control algorithm")
Fixes: 2cae0b6a70d6 ("mac80211: add new Minstrel-HT statistic output via csv")
Fixes: d0a77c6569ab ("mac80211: allow writing TX PN in debugfs")
Fixes: 8f20fc24986a ("[MAC80211]: embed key conf in key, fix driver interface")
Fixes: a75b4363eaaf ("mac80211: allow controlling aggregation manually")
Fixes: 9399b86c0e9a ("mac80211: add debug knobs for fair queuing")
Fixes: e322c07f8371 ("mac80211: debugfs: improve airtime_flags handler readability")
Fixes: 3ace10f5b5ad ("mac80211: Implement Airtime-based Queue Limit (AQL)")
Fixes: 276d9e82e06c ("mac80211: debugfs option to force TX status frames")
Fixes: 827b1fb44b7e ("mac80211: resume properly, add suspend/resume test")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 net/mac80211/debugfs.c                     | 7 +++++++
 net/mac80211/debugfs_key.c                 | 3 +++
 net/mac80211/debugfs_netdev.c              | 1 +
 net/mac80211/debugfs_sta.c                 | 2 ++
 net/mac80211/rate.c                        | 1 +
 net/mac80211/rc80211_minstrel_ht_debugfs.c | 2 ++
 6 files changed, 16 insertions(+)

diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 90470392fdaa..abbfc1bbdb8b 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -46,6 +46,7 @@ static const struct file_operations name## _ops = {			\
 	.read = name## _read,						\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_READONLY_FILE(name, fmt, value...)		\
@@ -148,6 +149,7 @@ static const struct file_operations aqm_ops = {
 	.read = aqm_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t airtime_flags_read(struct file *file,
@@ -201,6 +203,7 @@ static const struct file_operations airtime_flags_ops = {
 	.read = airtime_flags_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t aql_txq_limit_read(struct file *file,
@@ -282,6 +285,7 @@ static const struct file_operations aql_txq_limit_ops = {
 	.read = aql_txq_limit_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t force_tx_status_read(struct file *file,
@@ -334,6 +338,7 @@ static const struct file_operations force_tx_status_ops = {
 	.read = force_tx_status_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 #ifdef CONFIG_PM
@@ -354,6 +359,7 @@ static const struct file_operations reset_ops = {
 	.write = reset_write,
 	.open = simple_open,
 	.llseek = noop_llseek,
+	.owner = THIS_MODULE,
 };
 #endif
 
@@ -537,6 +543,7 @@ static const struct file_operations stats_ ##name## _ops = {		\
 	.read = stats_ ##name## _read,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_STATS_ADD(name)					\
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 98a713475e0f..d7c0c28045ef 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -30,6 +30,7 @@ static const struct file_operations key_ ##name## _ops = {		\
 	.read = key_##name##_read,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define KEY_OPS_W(name)							\
@@ -38,6 +39,7 @@ static const struct file_operations key_ ##name## _ops = {		\
 	.write = key_##name##_write,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define KEY_FILE(name, format)						\
@@ -53,6 +55,7 @@ static const struct file_operations key_ ##name## _ops = {		\
 	.read = key_conf_##name##_read,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define KEY_CONF_FILE(name, format)					\
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index fe8a7a87e513..8efa31ae7334 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -127,6 +127,7 @@ static const struct file_operations name##_ops = {			\
 	.write = (_write),						\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define _IEEE80211_IF_FILE_R_FN(name)					\
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 829dcad69c2c..9ce49346c32a 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -34,6 +34,7 @@ static const struct file_operations sta_ ##name## _ops = {		\
 	.read = sta_##name##_read,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define STA_OPS_RW(name)						\
@@ -42,6 +43,7 @@ static const struct file_operations sta_ ##name## _ops = {		\
 	.write = sta_##name##_write,					\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define STA_FILE(name, field, format)					\
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 45927202c71c..bbb691119a44 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -225,6 +225,7 @@ const struct file_operations rcname_ops = {
 	.read = rcname_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 #endif
 
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c
index bebb71917742..cdb51aa460a3 100644
--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
@@ -173,6 +173,7 @@ static const struct file_operations minstrel_ht_stat_fops = {
 	.read = minstrel_stats_read,
 	.release = minstrel_stats_release,
 	.llseek = no_llseek,
+	.owner = THIS_MODULE,
 };
 
 static char *
@@ -311,6 +312,7 @@ static const struct file_operations minstrel_ht_stat_csv_fops = {
 	.read = minstrel_stats_read,
 	.release = minstrel_stats_release,
 	.llseek = no_llseek,
+	.owner = THIS_MODULE,
 };
 
 void
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 03/21] cfg80211: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 01/21] net: set .owner to THIS_MODULE Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 02/21] mac80211: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 04/21] netdevsim: " Taehee Yoo
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 1ac61302dcd1 ("mac80211/cfg80211: move wiphy specific debugfs entries to cfg80211")
Fixes: 80a3511d70e8 ("cfg80211: add debugfs HT40 allow map")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 net/wireless/debugfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 76b845f68ac8..eb54c0ac4728 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -26,6 +26,7 @@ static const struct file_operations name## _ops = {			\
 	.read = name## _read,						\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
@@ -97,6 +98,7 @@ static const struct file_operations ht40allow_map_ops = {
 	.read = ht40allow_map_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 #define DEBUGFS_ADD(name)						\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 04/21] netdevsim: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (2 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 03/21] cfg80211: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 05/21] ieee802154: " Taehee Yoo
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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>
---

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

 drivers/net/netdevsim/dev.c         | 2 ++
 drivers/net/netdevsim/health.c      | 1 +
 drivers/net/netdevsim/udp_tunnels.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
index d07061417675..e7972e88ffe0 100644
--- a/drivers/net/netdevsim/dev.c
+++ b/drivers/net/netdevsim/dev.c
@@ -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)
diff --git a/drivers/net/netdevsim/health.c b/drivers/net/netdevsim/health.c
index 62958b238d50..21e2974660e7 100644
--- a/drivers/net/netdevsim/health.c
+++ b/drivers/net/netdevsim/health.c
@@ -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)
diff --git a/drivers/net/netdevsim/udp_tunnels.c b/drivers/net/netdevsim/udp_tunnels.c
index 6ab023acefd6..02dc3123eb6c 100644
--- a/drivers/net/netdevsim/udp_tunnels.c
+++ b/drivers/net/netdevsim/udp_tunnels.c
@@ -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,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 05/21] ieee802154: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (3 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 04/21] netdevsim: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 06/21] i2400m: " Taehee Yoo
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/ieee802154/ca8210.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 4eb64709d44c..d7b68c1279e6 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -2672,7 +2672,8 @@ static const struct file_operations test_int_fops = {
 	.open =           ca8210_test_int_open,
 	.release =        NULL,
 	.unlocked_ioctl = ca8210_test_int_ioctl,
-	.poll =           ca8210_test_int_poll
+	.poll =           ca8210_test_int_poll,
+	.owner =	  THIS_MODULE,
 };
 
 /* Init/Deinit */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 06/21] i2400m: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (4 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 05/21] ieee802154: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 07/21] wlcore: " Taehee Yoo
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: c71228caf91e ("i2400m: debugfs controls")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wimax/i2400m/debugfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 1c640b41ea4c..144f8a7e98af 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -87,6 +87,7 @@ const struct file_operations i2400m_rx_stats_fops = {
 	.read =		i2400m_rx_stats_read,
 	.write =	i2400m_rx_stats_write,
 	.llseek =	default_llseek,
+	.owner =	THIS_MODULE,
 };
 
 
@@ -140,6 +141,7 @@ const struct file_operations i2400m_tx_stats_fops = {
 	.read =		i2400m_tx_stats_read,
 	.write =	i2400m_tx_stats_write,
 	.llseek =	default_llseek,
+	.owner =	THIS_MODULE,
 };
 
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 07/21] wlcore: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (5 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 06/21] i2400m: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 08/21] wl1251: " Taehee Yoo
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: f5fc0f86b02a ("wl1271: add wl1271 driver files")
Fixes: bcca1bbdd412 ("wlcore: add debugfs macro to help print fw statistics arrays")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ti/wlcore/debugfs.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h
index b143293e694f..559c93543247 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.h
+++ b/drivers/net/wireless/ti/wlcore/debugfs.h
@@ -35,6 +35,7 @@ static const struct file_operations name## _ops = {			\
 	.read = name## _read,						\
 	.open = simple_open,						\
 	.llseek	= generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_ADD(name, parent)					\
@@ -68,6 +69,7 @@ static const struct file_operations sub## _ ##name## _ops = {		\
 	.read = sub## _ ##name## _read,					\
 	.open = simple_open,						\
 	.llseek	= generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_FWSTATS_FILE_ARRAY(sub, name, len, struct_type)		\
@@ -93,6 +95,7 @@ static const struct file_operations sub## _ ##name## _ops = {		\
 	.read = sub## _ ##name## _read,					\
 	.open = simple_open,						\
 	.llseek	= generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_FWSTATS_ADD(sub, name)					\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 08/21] wl1251: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (6 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 07/21] wlcore: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 09/21] iwlwifi: " Taehee Yoo
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 2f01a1f58889 ("wl12xx: add driver")
Fixes: b7339b1de0f7 ("wl1251: add tx queue status to debugfs")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ti/wl1251/debugfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/debugfs.c b/drivers/net/wireless/ti/wl1251/debugfs.c
index d48746e640cc..0a26cee0f287 100644
--- a/drivers/net/wireless/ti/wl1251/debugfs.c
+++ b/drivers/net/wireless/ti/wl1251/debugfs.c
@@ -35,6 +35,7 @@ static const struct file_operations name## _ops = {			\
 	.read = name## _read,						\
 	.open = simple_open,						\
 	.llseek	= generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_ADD(name, parent)					\
@@ -67,6 +68,7 @@ static const struct file_operations sub## _ ##name## _ops = {		\
 	.read = sub## _ ##name## _read,					\
 	.open = simple_open,						\
 	.llseek	= generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_FWSTATS_ADD(sub, name)				\
@@ -212,6 +214,7 @@ static const struct file_operations tx_queue_len_ops = {
 	.read = tx_queue_len_read,
 	.open = simple_open,
 	.llseek = generic_file_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf,
@@ -234,6 +237,7 @@ static const struct file_operations tx_queue_status_ops = {
 	.read = tx_queue_status_read,
 	.open = simple_open,
 	.llseek = generic_file_llseek,
+	.owner = THIS_MODULE,
 };
 
 static void wl1251_debugfs_delete_files(struct wl1251 *wl)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 09/21] iwlwifi: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (7 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 08/21] wl1251: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 10/21] iwlegacy: " Taehee Yoo
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 5ae212c9273d ("[PATCH] iwlwifi: add read rate scale table debugfs function")
Fixes: 0209dc11c769 ("[PATCH] iwlwifi: add debugfs rate scale stats")
Fixes: 712b6cf57a53 ("iwlwifi: Add debugfs to iwl core")
Fixes: 189a2b5942d6 ("iwlwifi: trigger event log from debugfs")
Fixes: 8ca151b568b6 ("iwlwifi: add the MVM driver")
Fixes: 757cf23b4b4b ("iwlwifi: mvm: add per rate tx stats")
Fixes: 2b55f43f8e47 ("iwlwifi: mvm: Add mem debugfs entry")
Fixes: 93b167c13a3a ("iwlwifi: runtime: sync FW and host clocks for logs")
Fixes: 38167459da50 ("iwlagn: show current rate scale data in debugfs")
Fixes: 87e5666c0722 ("iwlagn: transport handler can register debugfs entries")
Fixes: 16db88ba51d6 ("iwlagn: move dump_csr and dump_fh to transport layer")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c | 3 +++
 drivers/net/wireless/intel/iwlwifi/dvm/rs.c      | 3 +++
 drivers/net/wireless/intel/iwlwifi/fw/debugfs.c  | 3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 1 +
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h | 3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c      | 3 +++
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c  | 3 +++
 7 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
index 911049201838..a1022987eccf 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
@@ -34,6 +34,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {          \
 	.read = iwl_dbgfs_##name##_read,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_WRITE_FILE_OPS(name)                                    \
@@ -41,6 +42,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {          \
 	.write = iwl_dbgfs_##name##_write,                              \
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 
@@ -50,6 +52,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {          \
 	.read = iwl_dbgfs_##name##_read,                                \
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 static ssize_t iwl_dbgfs_sram_read(struct file *file,
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
index 548540dd0c0f..1518dead1e47 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
@@ -3172,6 +3172,7 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
 	.read = rs_sta_dbgfs_scale_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
 			char __user *user_buf, size_t count, loff_t *ppos)
@@ -3215,6 +3216,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
 	.read = rs_sta_dbgfs_stats_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
@@ -3241,6 +3243,7 @@ static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
 	.read = rs_sta_dbgfs_rate_scale_data_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static void rs_add_debugfs(void *priv, void *priv_sta,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
index 267ad4eddb5c..5f41c8587ac6 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
@@ -122,6 +122,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.open = _iwl_dbgfs_##name##_open,				\
 	.llseek = generic_file_llseek,					\
 	.release = _iwl_dbgfs_release,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define FWRT_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype)		\
@@ -150,6 +151,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.open = _iwl_dbgfs_##name##_open,				\
 	.llseek = generic_file_llseek,					\
 	.release = _iwl_dbgfs_release,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define _FWRT_DEBUGFS_WRITE_FILE_OPS(name, buflen, argtype)		\
@@ -160,6 +162,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.open = _iwl_dbgfs_##name##_open,				\
 	.llseek = generic_file_llseek,					\
 	.release = _iwl_dbgfs_release,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define FWRT_DEBUGFS_READ_FILE_OPS(name, bufsz)				\
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 3395c4675988..d4b9ef8b25ee 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -1981,6 +1981,7 @@ static const struct file_operations iwl_dbgfs_mem_ops = {
 	.write = iwl_dbgfs_mem_write,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h
index a83d252c0602..5bf4f7801b83 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h
@@ -63,6 +63,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.read = iwl_dbgfs_##name##_read,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 }
 
 #define MVM_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype)		\
@@ -87,6 +88,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.read = iwl_dbgfs_##name##_read,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define _MVM_DEBUGFS_WRITE_FILE_OPS(name, buflen, argtype)		\
@@ -95,4 +97,5 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.write = _iwl_dbgfs_##name##_write,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index ed7382e7ea17..853c3969c956 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3909,6 +3909,7 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
 	.read = rs_sta_dbgfs_scale_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
 			char __user *user_buf, size_t count, loff_t *ppos)
@@ -3956,6 +3957,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
 	.read = rs_sta_dbgfs_stats_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t rs_sta_dbgfs_drv_tx_stats_read(struct file *file,
@@ -4046,6 +4048,7 @@ static const struct file_operations rs_sta_dbgfs_drv_tx_stats_ops = {
 	.write = rs_sta_dbgfs_drv_tx_stats_write,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t iwl_dbgfs_ss_force_read(struct file *file,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index d2e69ad53b27..250b7883703c 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2476,6 +2476,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.read = iwl_dbgfs_##name##_read,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_WRITE_FILE_OPS(name)                                    \
@@ -2483,6 +2484,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {          \
 	.write = iwl_dbgfs_##name##_write,                              \
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 #define DEBUGFS_READ_WRITE_FILE_OPS(name)				\
@@ -2491,6 +2493,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {		\
 	.read = iwl_dbgfs_##name##_read,				\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
+	.owner = THIS_MODULE,						\
 };
 
 struct iwl_dbgfs_tx_queue_priv {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 10/21] iwlegacy: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (8 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 09/21] iwlwifi: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 11/21] rtlwifi: " Taehee Yoo
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")
Fixes: 4bc85c1324aa ("Revert "iwlwifi: split the drivers for agn and legacy devices 3945/4965"")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/intel/iwlegacy/3945-rs.c | 1 +
 drivers/net/wireless/intel/iwlegacy/4965-rs.c | 3 +++
 drivers/net/wireless/intel/iwlegacy/debug.c   | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
index b2478cbe558e..b86e8ddc6f76 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
@@ -836,6 +836,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
 	.read = il3945_sta_dbgfs_stats_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static void
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
index 9a491e5db75b..afe0b2121fc9 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
@@ -2669,6 +2669,7 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
 	.read = il4965_rs_sta_dbgfs_scale_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t
@@ -2714,6 +2715,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
 	.read = il4965_rs_sta_dbgfs_stats_table_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t
@@ -2742,6 +2744,7 @@ static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
 	.read = il4965_rs_sta_dbgfs_rate_scale_data_read,
 	.open = simple_open,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 static void
diff --git a/drivers/net/wireless/intel/iwlegacy/debug.c b/drivers/net/wireless/intel/iwlegacy/debug.c
index d998a3f1b056..67fae353038c 100644
--- a/drivers/net/wireless/intel/iwlegacy/debug.c
+++ b/drivers/net/wireless/intel/iwlegacy/debug.c
@@ -136,6 +136,7 @@ static const struct file_operations il_dbgfs_##name##_ops = {	\
 	.read = il_dbgfs_##name##_read,				\
 	.open = simple_open,					\
 	.llseek = generic_file_llseek,				\
+	.owner = THIS_MODULE,					\
 };
 
 #define DEBUGFS_WRITE_FILE_OPS(name)				\
@@ -144,6 +145,7 @@ static const struct file_operations il_dbgfs_##name##_ops = {	\
 	.write = il_dbgfs_##name##_write,			\
 	.open = simple_open,					\
 	.llseek = generic_file_llseek,				\
+	.owner = THIS_MODULE,					\
 };
 
 #define DEBUGFS_READ_WRITE_FILE_OPS(name)			\
@@ -154,6 +156,7 @@ static const struct file_operations il_dbgfs_##name##_ops = {	\
 	.read = il_dbgfs_##name##_read,				\
 	.open = simple_open,					\
 	.llseek = generic_file_llseek,				\
+	.owner = THIS_MODULE,					\
 };
 
 static const char *
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 11/21] rtlwifi: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (9 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 10/21] iwlegacy: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 12/21] ath11k: " Taehee Yoo
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 610247f46feb ("rtlwifi: Improve debugging by using debugfs")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/wireless/realtek/rtlwifi/debug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wireless/realtek/rtlwifi/debug.c
index 901cdfe3723c..c8ffd4ca9c09 100644
--- a/drivers/net/wireless/realtek/rtlwifi/debug.c
+++ b/drivers/net/wireless/realtek/rtlwifi/debug.c
@@ -69,6 +69,7 @@ static const struct file_operations file_ops_common = {
 	.read = seq_read,
 	.llseek = seq_lseek,
 	.release = single_release,
+	.owner = THIS_MODULE,
 };
 
 static int rtl_debug_get_mac_page(struct seq_file *m, void *v)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 12/21] ath11k: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (10 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 11/21] rtlwifi: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 13/21] ath10k: " Taehee Yoo
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ath/ath11k/debugfs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
index 1b914e67d314..bce9f9512833 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -593,7 +593,8 @@ static ssize_t ath11k_read_enable_extd_tx_stats(struct file *file,
 static const struct file_operations fops_extd_tx_stats = {
 	.read = ath11k_read_enable_extd_tx_stats,
 	.write = ath11k_write_enable_extd_tx_stats,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath11k_write_extd_rx_stats(struct file *file,
@@ -686,6 +687,7 @@ static const struct file_operations fops_extd_rx_stats = {
 	.read = ath11k_read_extd_rx_stats,
 	.write = ath11k_write_extd_rx_stats,
 	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static int ath11k_fill_bp_stats(struct ath11k_base *ab,
@@ -1047,7 +1049,8 @@ static ssize_t ath11k_write_simulate_radar(struct file *file,
 
 static const struct file_operations fops_simulate_radar = {
 	.write = ath11k_write_simulate_radar,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 int ath11k_debugfs_register(struct ath11k *ar)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 13/21] ath10k: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (11 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 12/21] ath11k: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 14/21] wcn36xx: " Taehee Yoo
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 90174455ae05 ("ath10k: add support to configure pktlog filter")
Fixes: 63fb32df9786 ("ath10k: add debugfs entry to configure quiet period")
Fixes: 844fa5722712 ("ath10k: debugfs file to enable Bluetooth coexistence feature")
Fixes: 348cd95c8196 ("ath10k: add debugfs entry to enable extended tx stats")
Fixes: cc61a1bbbc0e ("ath10k: enable debugfs provision to enable Peer Stats feature")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ath/ath10k/debug.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index e8250a665433..afde3d8048e8 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1911,7 +1911,8 @@ static ssize_t ath10k_read_pktlog_filter(struct file *file, char __user *ubuf,
 static const struct file_operations fops_pktlog_filter = {
 	.read = ath10k_read_pktlog_filter,
 	.write = ath10k_write_pktlog_filter,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath10k_write_quiet_period(struct file *file,
@@ -1955,7 +1956,8 @@ static ssize_t ath10k_read_quiet_period(struct file *file, char __user *ubuf,
 static const struct file_operations fops_quiet_period = {
 	.read = ath10k_read_quiet_period,
 	.write = ath10k_write_quiet_period,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath10k_write_btcoex(struct file *file,
@@ -2039,7 +2041,8 @@ static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf,
 static const struct file_operations fops_btcoex = {
 	.read = ath10k_read_btcoex,
 	.write = ath10k_write_btcoex,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath10k_write_enable_extd_tx_stats(struct file *file,
@@ -2094,7 +2097,8 @@ static ssize_t ath10k_read_enable_extd_tx_stats(struct file *file,
 static const struct file_operations fops_enable_extd_tx_stats = {
 	.read = ath10k_read_enable_extd_tx_stats,
 	.write = ath10k_write_enable_extd_tx_stats,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath10k_write_peer_stats(struct file *file,
@@ -2163,7 +2167,8 @@ static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf,
 static const struct file_operations fops_peer_stats = {
 	.read = ath10k_read_peer_stats,
 	.write = ath10k_write_peer_stats,
-	.open = simple_open
+	.open = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t ath10k_debug_fw_checksums_read(struct file *file,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 14/21] wcn36xx: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (12 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 13/21] ath10k: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 15/21] wil6210: " Taehee Yoo
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ath/wcn36xx/debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
index 389b5e7129a6..4b78be5c67e8 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -93,6 +93,7 @@ static const struct file_operations fops_wcn36xx_bmps = {
 	.open = simple_open,
 	.read  =       read_file_bool_bmps,
 	.write =       write_file_bool_bmps,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t write_file_dump(struct file *file,
@@ -134,6 +135,7 @@ static ssize_t write_file_dump(struct file *file,
 static const struct file_operations fops_wcn36xx_dump = {
 	.open = simple_open,
 	.write =       write_file_dump,
+	.owner = THIS_MODULE,
 };
 
 #define ADD_FILE(name, mode, fop, priv_data)		\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 15/21] wil6210: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (13 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 14/21] wcn36xx: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 16/21] cw1200: " Taehee Yoo
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 2be7d22f0625 ("wireless: add new wil6210 802.11ad 60GHz driver")
Fixes: 0b39aaf2f203 ("wil6210: Tx mgmt frame from debugfs")
Fixes: c5b3a6582b1e ("wil6210: Add support for setting RBUFCAP configuration")
Fixes: 3277213feb1b ("wil6210: ADDBA/DELBA flows")
Fixes: dc16427bbe65 ("wil6210: Add pmc debug mechanism memory management")
Fixes: 977c45ab5f41 ("wil6210: add debugfs to show PMC ring content")
Fixes: ff974e408334 ("wil6210: debugfs interface to send raw WMI command")
Fixes: c33407a8c504 ("wil6210: manual FW error recovery mode")
Fixes: a24a3d6abb97 ("wil6210: add TX latency statistics")
Fixes: 0c936b3c9633 ("wil6210: add support for link statistics")
Fixes: 10d599ad84a1 ("wil6210: add support for device led configuration")
Fixes: 12bace75704e ("wil6210: extract firmware capabilities from FW file")
Fixes: 13cd9f758a55 ("wil6210: extract firmware version from file header")
Fixes: fe9ee51e6a43 ("wil6210: add support for PCIe D3hot in system suspend")
Fixes: 96c93589e2df ("wil6210: initialize TX and RX enhanced DMA rings")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/ath/wil6210/debugfs.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 2d618f90afa7..799493739771 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -678,6 +678,7 @@ static const struct file_operations fops_ioblob = {
 	.read =		wil_read_file_ioblob,
 	.open =		simple_open,
 	.llseek =	default_llseek,
+	.owner =	THIS_MODULE,
 };
 
 static
@@ -729,6 +730,7 @@ static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
 static const struct file_operations fops_rxon = {
 	.write = wil_write_file_rxon,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static ssize_t wil_write_file_rbufcap(struct file *file,
@@ -767,6 +769,7 @@ static ssize_t wil_write_file_rbufcap(struct file *file,
 static const struct file_operations fops_rbufcap = {
 	.write = wil_write_file_rbufcap,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /* block ack control, write:
@@ -865,6 +868,7 @@ static const struct file_operations fops_back = {
 	.read = wil_read_back,
 	.write = wil_write_back,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /* pmc control, write:
@@ -941,12 +945,14 @@ static const struct file_operations fops_pmccfg = {
 	.read = wil_read_pmccfg,
 	.write = wil_write_pmccfg,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static const struct file_operations fops_pmcdata = {
 	.open		= simple_open,
 	.read		= wil_pmc_read,
 	.llseek		= wil_pmc_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static int wil_pmcring_seq_open(struct inode *inode, struct file *file)
@@ -959,6 +965,7 @@ static const struct file_operations fops_pmcring = {
 	.release	= single_release,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 /*---tx_mgmt---*/
@@ -996,6 +1003,7 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
 static const struct file_operations fops_txmgmt = {
 	.write = wil_write_file_txmgmt,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /* Write WMI command (w/o mbox header) to this file to send it
@@ -1039,6 +1047,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
 static const struct file_operations fops_wmi = {
 	.write = wil_write_file_wmi,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 static void wil_seq_print_skb(struct seq_file *s, struct sk_buff *skb)
@@ -1558,6 +1567,7 @@ static const struct file_operations fops_recovery = {
 	.read = wil_read_file_recovery,
 	.write = wil_write_file_recovery,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /*---------Station matrix------------*/
@@ -1836,6 +1846,7 @@ static const struct file_operations fops_tx_latency = {
 	.read		= seq_read,
 	.write		= wil_tx_latency_write,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 static void wil_link_stats_print_basic(struct wil6210_vif *vif,
@@ -1999,6 +2010,7 @@ static const struct file_operations fops_link_stats = {
 	.read		= seq_read,
 	.write		= wil_link_stats_write,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 static int
@@ -2053,6 +2065,7 @@ static const struct file_operations fops_link_stats_global = {
 	.read		= seq_read,
 	.write		= wil_link_stats_global_write,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 static ssize_t wil_read_file_led_cfg(struct file *file, char __user *user_buf,
@@ -2100,6 +2113,7 @@ static const struct file_operations fops_led_cfg = {
 	.read = wil_read_file_led_cfg,
 	.write = wil_write_file_led_cfg,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /* led_blink_time, write:
@@ -2165,6 +2179,7 @@ static const struct file_operations fops_led_blink_time = {
 	.read = wil_read_led_blink_time,
 	.write = wil_write_led_blink_time,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /*---------FW capabilities------------*/
@@ -2189,6 +2204,7 @@ static const struct file_operations fops_fw_capabilities = {
 	.release	= single_release,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 /*---------FW version------------*/
@@ -2215,6 +2231,7 @@ static const struct file_operations fops_fw_version = {
 	.release	= single_release,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
+	.owner		= THIS_MODULE,
 };
 
 /*---------suspend_stats---------*/
@@ -2275,6 +2292,7 @@ static const struct file_operations fops_suspend_stats = {
 	.read = wil_read_suspend_stats,
 	.write = wil_write_suspend_stats,
 	.open  = simple_open,
+	.owner = THIS_MODULE,
 };
 
 /*---------compressed_rx_status---------*/
@@ -2329,6 +2347,7 @@ static const struct file_operations fops_compressed_rx_status = {
 	.read = seq_read,
 	.write = wil_compressed_rx_status_write,
 	.llseek	= seq_lseek,
+	.owner = THIS_MODULE,
 };
 
 /*----------------*/
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 16/21] cw1200: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (14 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 15/21] wil6210: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 17/21] brcmfmac: " Taehee Yoo
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/wireless/st/cw1200/debug.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/st/cw1200/debug.c b/drivers/net/wireless/st/cw1200/debug.c
index 8686929c70df..bcb8757c34ae 100644
--- a/drivers/net/wireless/st/cw1200/debug.c
+++ b/drivers/net/wireless/st/cw1200/debug.c
@@ -355,6 +355,7 @@ static const struct file_operations fops_wsm_dumps = {
 	.open = simple_open,
 	.write = cw1200_wsm_dumps,
 	.llseek = default_llseek,
+	.owner = THIS_MODULE,
 };
 
 int cw1200_debug_init(struct cw1200_common *priv)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 17/21] brcmfmac: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (15 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 16/21] cw1200: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:41   ` Arend Van Spriel
  2020-11-07 17:21 ` [PATCH net v2 18/21] b43legacy: " Taehee Yoo
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 2f8c8e62cd50 ("brcmfmac: add "reset" debugfs entry for testing reset")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 3dd28f5fef19..a80b28189c99 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1188,6 +1188,7 @@ static const struct file_operations bus_reset_fops = {
 	.open	= simple_open,
 	.llseek	= no_llseek,
 	.write	= bus_reset_write,
+	.owner = THIS_MODULE,
 };
 
 static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 18/21] b43legacy: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (16 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 17/21] brcmfmac: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 19/21] b43: " Taehee Yoo
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/wireless/broadcom/b43legacy/debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/broadcom/b43legacy/debugfs.c b/drivers/net/wireless/broadcom/b43legacy/debugfs.c
index e7e4293c01f2..7c6e7cfeb822 100644
--- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c
+++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c
@@ -318,6 +318,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
 			.read	= b43legacy_debugfs_read,		\
 			.write	= b43legacy_debugfs_write,		\
 			.llseek = generic_file_llseek,			\
+			.owner = THIS_MODULE,				\
 		},						\
 		.file_struct_offset = offsetof(struct b43legacy_dfsentry, \
 					       file_##name),	\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 19/21] b43: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (17 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 18/21] b43legacy: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 20/21] mwifiex: mwifiex: " Taehee Yoo
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: e4d6b7951812 ("[B43]: add mac80211-based driver for modern BCM43xx devices")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v1 -> v2:
 - Change headline

 drivers/net/wireless/broadcom/b43/debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/broadcom/b43/debugfs.c b/drivers/net/wireless/broadcom/b43/debugfs.c
index 89a25aefb327..c0d51cb57b27 100644
--- a/drivers/net/wireless/broadcom/b43/debugfs.c
+++ b/drivers/net/wireless/broadcom/b43/debugfs.c
@@ -611,6 +611,7 @@ static ssize_t b43_debugfs_write(struct file *file,
 			.read	= b43_debugfs_read,		\
 			.write	= b43_debugfs_write,		\
 			.llseek = generic_file_llseek,		\
+			.owner = THIS_MODULE,			\
 		},						\
 		.file_struct_offset = offsetof(struct b43_dfsentry, \
 					       file_##name),	\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 20/21] mwifiex: mwifiex: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (18 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 19/21] b43: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 17:21 ` [PATCH net v2 21/21] Bluetooth: " Taehee Yoo
  2020-11-07 19:05 ` [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Jakub Kicinski
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 drivers/net/wireless/marvell/mwifiex/debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index dded92db1f37..641113260439 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -931,18 +931,21 @@ static const struct file_operations mwifiex_dfs_##name##_fops = {       \
 	.read = mwifiex_##name##_read,                                  \
 	.write = mwifiex_##name##_write,                                \
 	.open = simple_open,                                            \
+	.owner = THIS_MODULE,						\
 };
 
 #define MWIFIEX_DFS_FILE_READ_OPS(name)                                 \
 static const struct file_operations mwifiex_dfs_##name##_fops = {       \
 	.read = mwifiex_##name##_read,                                  \
 	.open = simple_open,                                            \
+	.owner = THIS_MODULE,						\
 };
 
 #define MWIFIEX_DFS_FILE_WRITE_OPS(name)                                \
 static const struct file_operations mwifiex_dfs_##name##_fops = {       \
 	.write = mwifiex_##name##_write,                                \
 	.open = simple_open,                                            \
+	.owner = THIS_MODULE,						\
 };
 
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH net v2 21/21] Bluetooth: set .owner to THIS_MODULE
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (19 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 20/21] mwifiex: mwifiex: " Taehee Yoo
@ 2020-11-07 17:21 ` Taehee Yoo
  2020-11-07 19:05 ` [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Jakub Kicinski
  21 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 17:21 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: ap420073, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

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

Fixes: 4b4148e9acc1 ("Bluetooth: Add support for setting DUT mode")
Fixes: 4b4113d6dbdb ("Bluetooth: Add debugfs entry for setting vendor diagnostic mode")
Fixes: 300acfdec916 ("Bluetooth: Introduce force_bredr_smp debugfs option for testing")
Fixes: 64dd374eac15 ("Bluetooth: Export SMP selftest result in debugfs")
Fixes: 0886aea6acd2 ("Bluetooth: Expose debug keys usage setting via debugfs")
Fixes: 134c2a89af22 ("Bluetooth: Add debugfs entry to show Secure Connections Only mode")
Fixes: b55d1abf568c ("Bluetooth: Expose quirks through debugfs")
Fixes: 6e07231a80de ("Bluetooth: Expose Secure Simple Pairing debug mode setting in debugfs")
Fixes: ac345813c4ac ("Bluetooth: Expose current identity information in debugfs")
Fixes: c2aa30db744d ("Bluetooth: debugfs option to unset MITM flag")
Fixes: 6b8d4a6a0314 ("Bluetooth: 6LoWPAN: Use connected oriented channel instead of fixed one")
Fixes: 6de50f9fdb60 ("Bluetooth: Export ECDH selftest result in debugfs")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

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

 net/bluetooth/6lowpan.c     | 1 +
 net/bluetooth/hci_core.c    | 2 ++
 net/bluetooth/hci_debugfs.c | 6 ++++++
 net/bluetooth/selftest.c    | 1 +
 net/bluetooth/smp.c         | 2 ++
 5 files changed, 12 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index cff4944d5b66..0936184f0813 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -1214,6 +1214,7 @@ static const struct file_operations lowpan_control_fops = {
 	.write		= lowpan_control_write,
 	.llseek		= seq_lseek,
 	.release	= single_release,
+	.owner		= THIS_MODULE,
 };
 
 static void disconnect_devices(void)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 502552d6e9af..dba8506202ff 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -116,6 +116,7 @@ static const struct file_operations dut_mode_fops = {
 	.read		= dut_mode_read,
 	.write		= dut_mode_write,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static ssize_t vendor_diag_read(struct file *file, char __user *user_buf,
@@ -172,6 +173,7 @@ static const struct file_operations vendor_diag_fops = {
 	.read		= vendor_diag_read,
 	.write		= vendor_diag_write,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static void hci_debugfs_create_basic(struct hci_dev *hdev)
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c
index 5e8af2658e44..c9a074da16dd 100644
--- a/net/bluetooth/hci_debugfs.c
+++ b/net/bluetooth/hci_debugfs.c
@@ -71,6 +71,7 @@ static const struct file_operations __name ## _fops = {			      \
 	.read		= __name ## _read,				      \
 	.write		= __name ## _write,				      \
 	.llseek		= default_llseek,				      \
+	.owner		= THIS_MODULE,					      \
 }									      \
 
 #define DEFINE_INFO_ATTRIBUTE(__name, __field)				      \
@@ -284,6 +285,7 @@ static const struct file_operations use_debug_keys_fops = {
 	.open		= simple_open,
 	.read		= use_debug_keys_read,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf,
@@ -302,6 +304,7 @@ static const struct file_operations sc_only_mode_fops = {
 	.open		= simple_open,
 	.read		= sc_only_mode_read,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 DEFINE_INFO_ATTRIBUTE(hardware_info, hw_info);
@@ -438,6 +441,7 @@ static const struct file_operations ssp_debug_mode_fops = {
 	.open		= simple_open,
 	.read		= ssp_debug_mode_read,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static int auto_accept_delay_set(void *data, u64 val)
@@ -726,6 +730,7 @@ static const struct file_operations force_static_address_fops = {
 	.read		= force_static_address_read,
 	.write		= force_static_address_write,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static int white_list_show(struct seq_file *f, void *ptr)
@@ -1117,6 +1122,7 @@ static const struct file_operations force_no_mitm_fops = {
 	.read		= force_no_mitm_read,
 	.write		= force_no_mitm_write,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 DEFINE_QUIRK_ATTRIBUTE(quirk_strict_duplicate_filter,
diff --git a/net/bluetooth/selftest.c b/net/bluetooth/selftest.c
index f71c6fa65fb3..445ea247061b 100644
--- a/net/bluetooth/selftest.c
+++ b/net/bluetooth/selftest.c
@@ -194,6 +194,7 @@ static const struct file_operations test_ecdh_fops = {
 	.open		= simple_open,
 	.read		= test_ecdh_read,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static int __init test_ecdh(void)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index bf4bef13d935..3b91f927aab5 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3407,6 +3407,7 @@ static const struct file_operations force_bredr_smp_fops = {
 	.read		= force_bredr_smp_read,
 	.write		= force_bredr_smp_write,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 int smp_register(struct hci_dev *hdev)
@@ -3751,6 +3752,7 @@ static const struct file_operations test_smp_fops = {
 	.open		= simple_open,
 	.read		= test_smp_read,
 	.llseek		= default_llseek,
+	.owner		= THIS_MODULE,
 };
 
 static int __init run_selftests(struct crypto_shash *tfm_cmac,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH net v2 17/21] brcmfmac: set .owner to THIS_MODULE
  2020-11-07 17:21 ` [PATCH net v2 17/21] brcmfmac: " Taehee Yoo
@ 2020-11-07 17:41   ` Arend Van Spriel
  2020-11-07 18:16     ` Taehee Yoo
  0 siblings, 1 reply; 27+ messages in thread
From: Arend Van Spriel @ 2020-11-07 17:41 UTC (permalink / raw)
  To: Taehee Yoo, davem, kuba, netdev
  Cc: David.Laight, johannes, nstange, derosier, kvalo, linux-wireless,
	wil6210, b43-dev, linux-bluetooth, michael.hennerich, linux-wpan,
	stefan, inaky.perez-gonzalez, linux-wimax, emmanuel.grumbach,
	luciano.coelho, stf_xl, pkshih, ath11k, ath10k, wcn36xx, merez,
	pizza, Larry.Finger, amitkarwar, ganapathi.bhat, huxinming820,
	marcel, johan.hedberg, alex.aring, jukka.rissanen, franky.lin,
	hante.meuleman, chung-hsien.hsu, wright.feng, chi-hsien.lin


[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

On November 7, 2020 6:25:15 PM Taehee Yoo <ap420073@gmail.com> wrote:

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

Is this really a valid concern in the context of debugs? I tend to say it 
is not. Whenever I am using debugs to debug my driver I make sure to avoid 
removing it.

Regards,
Arend



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4176 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH net v2 17/21] brcmfmac: set .owner to THIS_MODULE
  2020-11-07 17:41   ` Arend Van Spriel
@ 2020-11-07 18:16     ` Taehee Yoo
  0 siblings, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 18:16 UTC (permalink / raw)
  To: Arend Van Spriel
  Cc: David Miller, Jakub Kicinski, Netdev, David Laight,
	Johannes Berg, Nicolai Stange, derosier, Kalle Valo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, Luciano Coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, franky.lin, hante.meuleman, chung-hsien.hsu,
	wright.feng, chi-hsien.lin

On Sun, 8 Nov 2020 at 02:41, Arend Van Spriel
<arend.vanspriel@broadcom.com> wrote:
>

Hi Arend,
Thank you for the review!

> On November 7, 2020 6:25:15 PM Taehee Yoo <ap420073@gmail.com> wrote:
>
> > If THIS_MODULE is not set, the module would be removed while debugfs is
> > being used.
> > It eventually makes kernel panic.
>
> Is this really a valid concern in the context of debugs? I tend to say it
> is not. Whenever I am using debugs to debug my driver I make sure to avoid
> removing it.

I think getting rid of every scenario of the kernel panic is the
first priority thing.
So I'm sure that trying to avoid kernel panic is always valid even
in the debugging context.

Thanks a lot!
Taehee Yoo

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used
  2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
                   ` (20 preceding siblings ...)
  2020-11-07 17:21 ` [PATCH net v2 21/21] Bluetooth: " Taehee Yoo
@ 2020-11-07 19:05 ` Jakub Kicinski
  2020-11-07 19:52   ` Taehee Yoo
  2020-11-10  8:32   ` Johannes Berg
  21 siblings, 2 replies; 27+ messages in thread
From: Jakub Kicinski @ 2020-11-07 19:05 UTC (permalink / raw)
  To: Taehee Yoo
  Cc: davem, netdev, David.Laight, johannes, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

On Sat,  7 Nov 2020 17:21:31 +0000 Taehee Yoo wrote:
> When debugfs file is opened, its module should not be removed until
> it's closed.
> Because debugfs internally uses the module's data.
> So, it could access freed memory.
> 
> In order to avoid panic, it just sets .owner to THIS_MODULE.
> So that all modules will be held when its debugfs file is opened.

Hm, looks like some of the patches need to be revised because
.owner is already set in the ops, and a warning gets generated.

Also it'd be good to mention why Johannes's approach was abandoned.

When you repost please separate out all the patches for
drivers/net/wireless/ and send that to Kalle's wireless drivers tree.
Patch 1 needs to be split in two. Patches 2 and 3 would go via Johannes.
The wimax patch needs to go to staging (wimax code has been moved).
The remaining patches can be posted individually, not as a series.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used
  2020-11-07 19:05 ` [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Jakub Kicinski
@ 2020-11-07 19:52   ` Taehee Yoo
  2020-11-10  8:32   ` Johannes Berg
  1 sibling, 0 replies; 27+ messages in thread
From: Taehee Yoo @ 2020-11-07 19:52 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David Miller, Netdev, David Laight, Johannes Berg,
	Nicolai Stange, derosier, Kalle Valo, linux-wireless, wil6210,
	b43-dev, linux-bluetooth, michael.hennerich, linux-wpan, stefan,
	inaky.perez-gonzalez, linux-wimax, emmanuel.grumbach,
	Luciano Coelho, stf_xl, pkshih, ath11k, ath10k, wcn36xx, merez,
	pizza, Larry Finger, amitkarwar, ganapathi.bhat, huxinming820,
	marcel, johan.hedberg, alex.aring, jukka.rissanen,
	Arend Van Spriel, franky.lin, hante.meuleman, chung-hsien.hsu,
	wright.feng, chi-hsien.lin

On Sun, 8 Nov 2020 at 04:05, Jakub Kicinski <kuba@kernel.org> wrote:
>

Hi Jakub,
Thank you for the review!

> On Sat,  7 Nov 2020 17:21:31 +0000 Taehee Yoo wrote:
> > When debugfs file is opened, its module should not be removed until
> > it's closed.
> > Because debugfs internally uses the module's data.
> > So, it could access freed memory.
> >
> > In order to avoid panic, it just sets .owner to THIS_MODULE.
> > So that all modules will be held when its debugfs file is opened.
>
> Hm, looks like some of the patches need to be revised because
> .owner is already set in the ops, and a warning gets generated.

Thanks, I found my mistake via patchwork.
I will fix this problem.

>
> Also it'd be good to mention why Johannes's approach was abandoned.

I'm sorry about skipping the explanation of the situation,
Johannes sent RFC[1], which fixes this problem in the debugfs core logic.
I tested it and it actually avoids this problem well.
And I think there would be more discussion.
So, I thought this series' approach is reasonable right now.
I think setting .owner to THIS_MODULE is a common behavior and it
doesn't hurt our logic even if Johannes's approach is merged.
I'm expecting that both approaches of this series and Johannes are
doing separately.

[1] https://www.spinics.net/lists/linux-wireless/msg204171.html

>
> When you repost please separate out all the patches for
> drivers/net/wireless/ and send that to Kalle's wireless drivers tree.
> Patch 1 needs to be split in two. Patches 2 and 3 would go via Johannes.
> The wimax patch needs to go to staging (wimax code has been moved).
> The remaining patches can be posted individually, not as a series.

Okay, I will do this.

Thanks a lot!
Taehee Yoo

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used
  2020-11-07 19:05 ` [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Jakub Kicinski
  2020-11-07 19:52   ` Taehee Yoo
@ 2020-11-10  8:32   ` Johannes Berg
  1 sibling, 0 replies; 27+ messages in thread
From: Johannes Berg @ 2020-11-10  8:32 UTC (permalink / raw)
  To: Jakub Kicinski, Taehee Yoo
  Cc: davem, netdev, David.Laight, nstange, derosier, kvalo,
	linux-wireless, wil6210, b43-dev, linux-bluetooth,
	michael.hennerich, linux-wpan, stefan, inaky.perez-gonzalez,
	linux-wimax, emmanuel.grumbach, luciano.coelho, stf_xl, pkshih,
	ath11k, ath10k, wcn36xx, merez, pizza, Larry.Finger, amitkarwar,
	ganapathi.bhat, huxinming820, marcel, johan.hedberg, alex.aring,
	jukka.rissanen, arend.vanspriel, franky.lin, hante.meuleman,
	chung-hsien.hsu, wright.feng, chi-hsien.lin

On Sat, 2020-11-07 at 11:05 -0800, Jakub Kicinski wrote:
> On Sat,  7 Nov 2020 17:21:31 +0000 Taehee Yoo wrote:
> > When debugfs file is opened, its module should not be removed until
> > it's closed.
> > Because debugfs internally uses the module's data.
> > So, it could access freed memory.
> > 
> > In order to avoid panic, it just sets .owner to THIS_MODULE.
> > So that all modules will be held when its debugfs file is opened.
> 
> Hm, looks like some of the patches need to be revised because
> .owner is already set in the ops, and a warning gets generated.
> 
> Also it'd be good to mention why Johannes's approach was abandoned.

Well, I had two.

One was awful, and worked in all cases.

The other was less awful, and didn't work in all cases.

I think both gave Al Viro hives ;-)

> Patch 1 needs to be split in two. Patches 2 and 3 would go via Johannes.

FWIW, I'm happy for you to take patches 2 and 3 as well, but I guess if
patch 1 needs to be split there's a resend coming anyway, so then I'll
be happy to take the patches 2/3 from a separate set.

johannes



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, back to index

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-07 17:21 [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 01/21] net: set .owner to THIS_MODULE Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 02/21] mac80211: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 03/21] cfg80211: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 04/21] netdevsim: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 05/21] ieee802154: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 06/21] i2400m: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 07/21] wlcore: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 08/21] wl1251: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 09/21] iwlwifi: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 10/21] iwlegacy: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 11/21] rtlwifi: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 12/21] ath11k: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 13/21] ath10k: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 14/21] wcn36xx: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 15/21] wil6210: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 16/21] cw1200: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 17/21] brcmfmac: " Taehee Yoo
2020-11-07 17:41   ` Arend Van Spriel
2020-11-07 18:16     ` Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 18/21] b43legacy: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 19/21] b43: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 20/21] mwifiex: mwifiex: " Taehee Yoo
2020-11-07 17:21 ` [PATCH net v2 21/21] Bluetooth: " Taehee Yoo
2020-11-07 19:05 ` [PATCH net v2 00/21] net: avoid to remove module when its debugfs is being used Jakub Kicinski
2020-11-07 19:52   ` Taehee Yoo
2020-11-10  8:32   ` Johannes Berg

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git