net: avoid to remove module when its debugfs is being used
Subsystems (24)
v2 cover net: avoid to remove module when its debugfs is being used
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(-)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 1/21 net: set .owner to THIS_MODULE
If THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
net/6lowpan/debugfs.c +1 -0
@@ -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,
net/batman-adv/log.c +1 -0
@@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = { .read = batadv_log_read, .poll = batadv_log_poll, .llseek = no_llseek, + .owner = THIS_MODULE, };/**
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=379653
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - FAIL
Output:
net: set .owner to THIS_MODULE
7: B1 Line exceeds max length (90>80): "Fixes: 9e466250ede3 ("batman-adv: Prefix bat_debugfs local static functions with batadv_")"
mac80211: set .owner to THIS_MODULE
15: B1 Line exceeds max length (84>80): "Fixes: e322c07f8371 ("mac80211: debugfs: improve airtime_flags handler readability")"
cfg80211: set .owner to THIS_MODULE
7: B1 Line exceeds max length (90>80): "Fixes: 1ac61302dcd1 ("mac80211/cfg80211: move wiphy specific debugfs entries to cfg80211")"
netdevsim: set .owner to THIS_MODULE
7: B1 Line exceeds max length (87>80): "Fixes: 82c93a87bf8b ("netdevsim: implement couple of testing devlink health reporters")" 9: B1 Line exceeds max length (85>80): "Fixes: 4418f862d675 ("netdevsim: implement support for devlink region and snapshots")"
wlcore: set .owner to THIS_MODULE
8: B1 Line exceeds max length (84>80): "Fixes: bcca1bbdd412 ("wlcore: add debugfs macro to help print fw statistics arrays")"
iwlwifi: set .owner to THIS_MODULE
7: B1 Line exceeds max length (83>80): "Fixes: 5ae212c9273d ("[PATCH] iwlwifi: add read rate scale table debugfs function")"
iwlegacy: set .owner to THIS_MODULE
7: B1 Line exceeds max length (87>80): "Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")" 8: B1 Line exceeds max length (96>80): "Fixes: 4bc85c1324aa ("Revert "iwlwifi: split the drivers for agn and legacy devices 3945/4965"")"
ath10k: set .owner to THIS_MODULE
9: B1 Line exceeds max length (84>80): "Fixes: 844fa5722712 ("ath10k: debugfs file to enable Bluetooth coexistence feature")" 11: B1 Line exceeds max length (85>80): "Fixes: cc61a1bbbc0e ("ath10k: enable debugfs provision to enable Peer Stats feature")"
wcn36xx: set .owner to THIS_MODULE
7: B1 Line exceeds max length (86>80): "Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")"
cw1200: set .owner to THIS_MODULE
7: B1 Line exceeds max length (85>80): "Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")"
b43legacy: set .owner to THIS_MODULE
7: B1 Line exceeds max length (89>80): "Fixes: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices")"
b43: set .owner to THIS_MODULE
7: B1 Line exceeds max length (83>80): "Fixes: e4d6b7951812 ("[B43]: add mac80211-based driver for modern BCM43xx devices")"
mwifiex: mwifiex: set .owner to THIS_MODULE
7: B1 Line exceeds max length (84>80): "Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")"
Bluetooth: set .owner to THIS_MODULE
8: B1 Line exceeds max length (87>80): "Fixes: 4b4113d6dbdb ("Bluetooth: Add debugfs entry for setting vendor diagnostic mode")" 9: B1 Line exceeds max length (87>80): "Fixes: 300acfdec916 ("Bluetooth: Introduce force_bredr_smp debugfs option for testing")" 12: B1 Line exceeds max length (89>80): "Fixes: 134c2a89af22 ("Bluetooth: Add debugfs entry to show Secure Connections Only mode")" 14: B1 Line exceeds max length (93>80): "Fixes: 6e07231a80de ("Bluetooth: Expose Secure Simple Pairing debug mode setting in debugfs")" 15: B1 Line exceeds max length (81>80): "Fixes: ac345813c4ac ("Bluetooth: Expose current identity information in debugfs")" 17: B1 Line exceeds max length (95>80): "Fixes: 6b8d4a6a0314 ("Bluetooth: 6LoWPAN: Use connected oriented channel instead of fixed one")"
##############################
Test: CheckBuildK - PASS
---
Regards,
Linux Bluetooth
PATCH v2 2/21 mac80211: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
net/mac80211/debugfs.c +7 -0
@@ -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) \
net/mac80211/debugfs_key.c +3 -0
@@ -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) \
net/mac80211/debugfs_netdev.c +1 -0
@@ -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) \
net/mac80211/debugfs_sta.c +2 -0
@@ -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) \
net/mac80211/rate.c +1 -0
@@ -225,6 +225,7 @@ const struct file_operations rcname_ops = { .read = rcname_read, .open = simple_open, .llseek = default_llseek, + .owner = THIS_MODULE, };#endif
net/mac80211/rc80211_minstrel_ht_debugfs.c +2 -0
@@ -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
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 3/21 cfg80211: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
net/wireless/debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/debugfs.c +2 -0
@@ -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) \
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 4/21 netdevsim: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
drivers/net/netdevsim/dev.c +2 -0
@@ -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)
drivers/net/netdevsim/health.c +1 -0
@@ -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)
drivers/net/netdevsim/udp_tunnels.c +1 -0
@@ -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,
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 5/21 ieee802154: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/ieee802154/ca8210.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ieee802154/ca8210.c +2 -1
@@ -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 */
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 6/21 i2400m: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wimax/i2400m/debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wimax/i2400m/debugfs.c +2 -0
@@ -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, };
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 7/21 wlcore: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wireless/ti/wlcore/debugfs.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ti/wlcore/debugfs.h +3 -0
@@ -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) \
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 8/21 wl1251: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wireless/ti/wl1251/debugfs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ti/wl1251/debugfs.c +4 -0
@@ -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)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 9/21 iwlwifi: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c +3 -0
@@ -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,
drivers/net/wireless/intel/iwlwifi/dvm/rs.c +3 -0
@@ -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,
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c +3 -0
@@ -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) \
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +1 -0
@@ -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,
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.h +3 -0
@@ -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, \ };
drivers/net/wireless/intel/iwlwifi/mvm/rs.c +3 -0
@@ -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,
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +3 -0
@@ -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 {
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 10/21 iwlegacy: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
drivers/net/wireless/intel/iwlegacy/3945-rs.c +1 -0
@@ -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
drivers/net/wireless/intel/iwlegacy/4965-rs.c +3 -0
@@ -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
drivers/net/wireless/intel/iwlegacy/debug.c +3 -0
@@ -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 *
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 11/21 rtlwifi: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/wireless/realtek/rtlwifi/debug.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtlwifi/debug.c +1 -0
@@ -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)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 12/21 ath11k: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(-)
drivers/net/wireless/ath/ath11k/debugfs.c +5 -2
@@ -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)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 13/21 ath10k: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(-)
drivers/net/wireless/ath/ath10k/debug.c +10 -5
@@ -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,
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 14/21 wcn36xx: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wireless/ath/wcn36xx/debug.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/wcn36xx/debug.c +2 -0
@@ -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) \
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 15/21 wil6210: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wireless/ath/wil6210/debugfs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/wil6210/debugfs.c +19 -0
@@ -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, };/*----------------*/
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 16/21 cw1200: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/wireless/st/cw1200/debug.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/st/cw1200/debug.c +1 -0
@@ -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)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 17/21 brcmfmac: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +1 -0
@@ -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)
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Arend Van Spriel
maintainerRe: [PATCH net v2 17/21] brcmfmac: set .owner to THIS_MODULE
Quoted 3 lines · Taehee Yoo
If
THIS_MODULEis 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
Re: [PATCH net v2 17/21] brcmfmac: set .owner to THIS_MODULE
Quoted 1 line · Arend Van Spriel
Hi Arend,
Thank you for the review!
Quoted 9 lines · Taehee Yoo
Quoted 4 lines
If
THIS_MODULEis 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
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 18/21 b43legacy: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/wireless/broadcom/b43legacy/debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43legacy/debugfs.c +1 -0
@@ -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), \
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 19/21 b43: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
drivers/net/wireless/broadcom/b43/debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43/debugfs.c +1 -0
@@ -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), \
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 20/21 mwifiex: mwifiex: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
v1 -> v2:
- Change headline
- Squash patches into per-driver/subsystem
drivers/net/wireless/marvell/mwifiex/debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/marvell/mwifiex/debugfs.c +3 -0
@@ -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, \ };
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 21/21 Bluetooth: set .owner to THIS_MODULE
In reply to Taehee YooIf THIS_MODULE is not set, the module would be removed while debugfs is being used.
It eventually makes kernel panic.
---
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(+)
net/bluetooth/6lowpan.c +1 -0
@@ -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 )
net/bluetooth/hci_core.c +2 -0
@@ -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)
net/bluetooth/hci_debugfs.c +6 -0
@@ -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,
net/bluetooth/selftest.c +1 -0
@@ -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 )
net/bluetooth/smp.c +2 -0
@@ -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,
Signature · 7 lines
2.17.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Jakub Kicinski
maintainerQuoted 7 lines · 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.
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 1 line · Jakub Kicinski
Hi Jakub,
Thank you for the review!
Quoted 11 lines · On Sat, 7 Nov 2020 17:21:31 +0000 Taehee Yoo wrote:
Quoted 7 lines
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.
Quoted 2 lines
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
Quoted 6 lines
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
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Johannes Berg
maintainerQuoted 6 lines · Jakub Kicinski
Quoted 5 lines · 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.
Quoted 7 lines
Quoted 2 lines
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 ;-)
Quoted 1 line
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
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k