linux/drivers/staging/wilc1000
Aditya Shankar 1d4f1d53e1 Staging: wilc1000: Fix kernel Oops on opening the device
Commit 2518ac59eb ("staging: wilc1000: Replace kthread with workqueue
for host interface") adds an unconditional destroy_workqueue() on the
wilc's "hif_workqueue" soon after its creation thereby rendering
it unusable. It then further attempts to queue work onto this
non-existing hif_worqueue and results in:

Unable to handle kernel NULL pointer dereference at virtual address 00000010
pgd = de478000
[00000010] *pgd=3eec0831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in: wilc1000_sdio(C) wilc1000(C)
CPU: 0 PID: 825 Comm: ifconfig Tainted: G         C      4.8.0-rc8+ #37
Hardware name: Atmel SAMA5
task: df56f800 task.stack: deeb0000
PC is at __queue_work+0x90/0x284
LR is at __queue_work+0x58/0x284
pc : [<c0126bb0>]    lr : [<c0126b78>]    psr: 600f0093
sp : deeb1aa0  ip : def22d78  fp : deea6000
r10: 00000000  r9 : c0a08150  r8 : c0a2f058
r7 : 00000001  r6 : dee9b600  r5 : def22d74  r4 : 00000000
r3 : 00000000  r2 : def22d74  r1 : 07ffffff  r0 : 00000000
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
...
[<c0127060>] (__queue_work) from [<c0127298>] (queue_work_on+0x34/0x40)
[<c0127298>] (queue_work_on) from [<bf0076b4>] (wilc_enqueue_cmd+0x54/0x64 [wilc1000])
[<bf0076b4>] (wilc_enqueue_cmd [wilc1000]) from [<bf0082b4>] (wilc_set_wfi_drv_handler+0x48/0x70 [wilc1000])
[<bf0082b4>] (wilc_set_wfi_drv_handler [wilc1000]) from [<bf00509c>] (wilc_mac_open+0x214/0x250 [wilc1000])
[<bf00509c>] (wilc_mac_open [wilc1000]) from [<c04fde98>] (__dev_open+0xb8/0x11c)
[<c04fde98>] (__dev_open) from [<c04fe128>] (__dev_change_flags+0x94/0x158)
[<c04fe128>] (__dev_change_flags) from [<c04fe204>] (dev_change_flags+0x18/0x48)
[<c04fe204>] (dev_change_flags) from [<c0557d5c>] (devinet_ioctl+0x6b4/0x788)
[<c0557d5c>] (devinet_ioctl) from [<c04e40a0>] (sock_ioctl+0x154/0x2cc)
[<c04e40a0>] (sock_ioctl) from [<c01b16e0>] (do_vfs_ioctl+0x9c/0x878)
[<c01b16e0>] (do_vfs_ioctl) from [<c01b1ef0>] (SyS_ioctl+0x34/0x5c)
[<c01b1ef0>] (SyS_ioctl) from [<c0107520>] (ret_fast_syscall+0x0/0x3c)
Code: e5932004 e1520006 01a04003 0affffff (e5943010)
---[ end trace b612328adaa6bf20 ]---

This fix removes the unnecessary call to destroy_workqueue() while opening
the device to avoid the above kernel panic. The deinit routine already
does a good job of terminating the workqueue when no longer needed.

Reported-by: Nicolas Ferre <Nicolas.Ferre@microchip.com>
Fixes: 2518ac59eb ("staging: wilc1000: Replace kthread with workqueue for host interface")
Cc: stable@vger.kernel.org # 4.8+
Signed-off-by: Aditya Shankar <Aditya.Shankar@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-17 09:14:55 +02:00
..
coreconfigurator.c staging: wilc1000: fix a couple of memory leaks 2016-03-22 22:27:36 -04:00
coreconfigurator.h Staging: wilc1000: Remove struct typedef 2016-09-13 15:13:16 +02:00
host_interface.c Staging: wilc1000: Fix kernel Oops on opening the device 2016-10-17 09:14:55 +02:00
host_interface.h staging: wilc1000: remove unused struct set_mac_addr 2016-06-25 14:38:49 -07:00
Kconfig staging: wilc1000: removes WIRELESS_EXT 2016-03-28 07:30:36 -07:00
linux_mon.c staging: wilc1000: Remove camel case in variable names. 2016-03-28 07:30:36 -07:00
linux_wlan.c Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
Makefile staging: wilc1000: message_queue: Move code to host interface 2016-06-25 14:39:53 -07:00
TODO drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00
wilc_debugfs.c staging: wilc1000: fix sparse warning: symbol was not declared. Should it be static? 2016-09-27 13:02:06 +02:00
wilc_sdio.c staging: wilc1000: fix spelling mistake: "interupts" -> "interrupts" 2016-06-25 14:38:49 -07:00
wilc_spi.c staging: wilc1000: wilc_spi: Remove unnecessary blank lines 2016-10-02 17:19:51 +02:00
wilc_wfi_cfgoperations.c Staging: wilc1000: constify cfg80211_ops structures 2016-09-27 13:02:06 +02:00
wilc_wfi_cfgoperations.h Staging: wilc1000: Remove unused function WILC_WFI_update_stats 2016-02-20 14:43:48 -08:00
wilc_wfi_netdevice.h drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00
wilc_wlan_cfg.c staging: wilc1000: Replaced comparison to NULL statements 2016-03-28 07:30:36 -07:00
wilc_wlan_cfg.h staging: wilc1000: wilc_wlan_cfg_init: changes unused argument 2016-02-22 11:48:19 -08:00
wilc_wlan_if.h drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00
wilc_wlan.c staging: wilc1000: remove unnecessary braces 2016-10-02 17:19:51 +02:00
wilc_wlan.h drivers: wilc1000: remove references to semaphores 2016-08-21 17:27:16 +02:00