Skip to content

Commit af69009

Browse files
Sujith Manoharanlinvjw
authored andcommitted
ath9k: Fix crash on module unload
Make sure that any open relayfs files are closed before unregistering with mac80211, otherwise this crash is seen: [ 1331.097846] BUG: unable to handle kernel paging request at 6b6b6b8b [ 1331.098170] IP: [<c063d0d6>] debugfs_remove+0x26/0x80 [ 1331.098170] *pdpt = 000000002f9aa001 *pde = 0000000000000000 [ 1331.098170] Oops: 0000 [#1] PREEMPT SMP [ 1331.098170] Modules linked in: iptable_raw xt_CT nf_conntrack_ipv4 nf_defrag] [ 1331.098170] Pid: 4794, comm: rmmod Tainted: G WC 3.9.1+ #5 To Be Fi. [ 1331.098170] EIP: 0060:[<c063d0d6>] EFLAGS: 00010202 CPU: 0 [ 1331.098170] EIP is at debugfs_remove+0x26/0x80 [ 1331.098170] EAX: f2f3acd0 EBX: f2f3acd0 ECX: 00000006 EDX: f8622348 [ 1331.098170] ESI: 6b6b6b6b EDI: 00000001 EBP: ee251e1 ESP: ee251e0c [ 1331.098170] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 [ 1331.098170] CR0: 8005003b CR2: 6b6b6b8b CR3: 2e7b7000 CR4: 000007e0 [ 1331.098170] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 [ 1331.098170] DR6: ffff0ff0 DR7: 00000400 [ 1331.098170] Process rmmod (pid: 4794, ti=ee250000 task=efaa2560 task.ti=ee25) [ 1331.098170] Stack: [ 1331.098170] f241e170 0000000a ee251e1c f861394d ee251e28 c04e3088 f241e170 4 [ 1331.098170] c04e30f f45482b0 ee251e54 c04e3187 f25e86b0 ee251e54 f8618748 0 [ 1331.098170] 0000000a 00000001 ee251e68 f860065b f2509e20 f25085a0 f5b6e8a4 8 [ 1331.098170] Call Trace: [ 1331.098170] [<f861394d>] remove_buf_file_handler+0xd/0x20 [ath9k] [ 1331.098170] [<c04e3088>] relay_remove_buf+0x18/0x30 [ 1331.098170] [<c04e30fe>] relay_close_buf+0x2e/0x40 [ 1331.098170] [<c04e3187>] relay_close+0x77/0xf0 [ 1331.098170] [<f8618748>] ? dpd_exit+0x38/0x40 [ath9k] [ 1331.098170] [<f860065b>] ath9k_deinit_softc+0x8b/0xa0 [ath9k] [ 1331.098170] [<f86006b8>] ath9k_deinit_device+0x48/0x60 [ath9k] [ 1331.098170] [<f86107f1>] ath_pci_remove+0x31/0x50 [ath9k] [ 1331.098170] [<c06dbff8>] pci_device_remove+0x38/0xc0 [ 1331.098170] [<c079daa4>] __device_release_driver+0x64/0xc0 [ 1331.098170] [<c079db97>] driver_detach+0x97/0xa0 [ 1331.098170] [<c079cacc>] bus_remove_driver+0x6c/0xe0 [ 1331.098170] [<c079c197>] ? bus_put+0x17/0x20 [ 1331.098170] [<c079cae3>] ? bus_remove_driver+0x83/0xe0 [ 1331.098170] [<c079e709>] driver_unregister+0x49/0x80 [ 1331.098170] [<c06dc138>] pci_unregister_driver+0x18/0x80 [ 1331.098170] [<f8610602>] ath_pci_exit+0x12/0x20 [ath9k] [ 1331.098170] [<f8619ce0>] ath9k_exit+0x17/0x337 [ath9k] [ 1331.098170] [<c09e537d>] ? mutex_unlock+0xd/0x10 [ 1331.098170] [<c04bd36c>] sys_delete_module+0x17c/0x250 [ 1331.098170] [<c0540dc4>] ? do_munmap+0x244/0x2d0 [ 1331.098170] [<c0540e96>] ? vm_munmap+0x46/0x60 [ 1331.098170] [<c09e8dc4>] ? restore_all+0xf/0xf [ 1331.098170] [<c09ebf50>] ? __do_page_fault+0x4c0/0x4c0 [ 1331.098170] [<c04b18e4>] ? trace_hardirqs_on_caller+0xf4/0x180 [ 1331.098170] [<c09ef28d>] sysenter_do_call+0x12/0x38 [ 1331.098170] Code: 90 8d 74 26 00 55 89 e5 83 ec 08 89 1c 24 89 74 24 04 3e 82 [ 1331.098170] EIP: [<c063d0d6>] debugfs_remove+0x26/0x80 SS:ESP 0068:ee251e0c [ 1331.098170] CR2: 000000006b6b6b8b [ 1331.727971] ---[ end trace b5bb9f2066cef7f9 ]--- Cc: <[email protected]> Acked-by: Simon Wunderlich <[email protected]> Tested-by: Ben Greear <[email protected]> Signed-off-by: Sujith Manoharan <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent a01ae5b commit af69009

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

drivers/net/wireless/ath/ath9k/debug.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
20082008
WARN_ON(i != ATH9K_SSTATS_LEN);
20092009
}
20102010

2011+
void ath9k_deinit_debug(struct ath_softc *sc)
2012+
{
2013+
if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
2014+
relay_close(sc->rfs_chan_spec_scan);
2015+
sc->rfs_chan_spec_scan = NULL;
2016+
}
2017+
}
2018+
20112019
int ath9k_init_debug(struct ath_hw *ah)
20122020
{
20132021
struct ath_common *common = ath9k_hw_common(ah);

drivers/net/wireless/ath/ath9k/debug.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ struct ath9k_debug {
304304
};
305305

306306
int ath9k_init_debug(struct ath_hw *ah);
307+
void ath9k_deinit_debug(struct ath_softc *sc);
307308

308309
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
309310
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
@@ -339,6 +340,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
339340
return 0;
340341
}
341342

343+
static inline void ath9k_deinit_debug(struct ath_softc *sc)
344+
{
345+
}
346+
342347
static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
343348
enum ath9k_int status)
344349
{

drivers/net/wireless/ath/ath9k/init.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -906,14 +906,16 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
906906
if (!ath_is_world_regd(reg)) {
907907
error = regulatory_hint(hw->wiphy, reg->alpha2);
908908
if (error)
909-
goto unregister;
909+
goto debug_cleanup;
910910
}
911911

912912
ath_init_leds(sc);
913913
ath_start_rfkill_poll(sc);
914914

915915
return 0;
916916

917+
debug_cleanup:
918+
ath9k_deinit_debug(sc);
917919
unregister:
918920
ieee80211_unregister_hw(hw);
919921
rx_cleanup:
@@ -942,11 +944,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
942944
sc->dfs_detector->exit(sc->dfs_detector);
943945

944946
ath9k_eeprom_release(sc);
945-
946-
if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
947-
relay_close(sc->rfs_chan_spec_scan);
948-
sc->rfs_chan_spec_scan = NULL;
949-
}
950947
}
951948

952949
void ath9k_deinit_device(struct ath_softc *sc)
@@ -960,6 +957,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
960957

961958
ath9k_ps_restore(sc);
962959

960+
ath9k_deinit_debug(sc);
963961
ieee80211_unregister_hw(hw);
964962
ath_rx_cleanup(sc);
965963
ath9k_deinit_softc(sc);

0 commit comments

Comments
 (0)