wilc1000: add missing unregister_netdev() in wilc_netdev_ifc_init()
Subsystems (3)
PATCH 1/1 wilc1000: add missing unregister_netdev() in wilc_netdev_ifc_init()
Fault injection test reports this issue:
kernel BUG at net/core/dev.c:10731!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
Call Trace: <TASK> wilc_netdev_ifc_init+0x19f/0x220 [wilc1000 884bf126e9e98af6a708f266a8dffd53f99e4bf5] wilc_cfg80211_init+0x30c/0x380 [wilc1000 884bf126e9e98af6a708f266a8dffd53f99e4bf5] wilc_bus_probe+0xad/0x2b0 [wilc1000_spi 1520a7539b6589cc6cde2ae826a523a33f8bacff] spi_probe+0xe4/0x140 really_probe+0x17e/0x3f0 __driver_probe_device+0xe3/0x170 driver_probe_device+0x49/0x120
The root case here is alloc_ordered_workqueue() fails, but cfg80211_unregister_netdevice() or unregister_netdev() not be called in error handling path. To fix add unregister_netdev goto lable to add the unregister operation in error handling path.
--- drivers/net/wireless/microchip/wilc1000/netdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +6 -1
@@ -980,7 +980,7 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, ndev->name);if (!wl->hif_workqueue) { ret = -ENOMEM ; - goto error; + goto unregister_netdev; } ndev->needs_free_netdev = true;
@@ -995,6 +995,11 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,return vif; +unregister_netdev: +if (rtnl_locked) +cfg80211_unregister_netdevice (ndev); +else +unregister_netdev (ndev); error:free_netdev (ndev);return ERR_PTR (ret);
Signature · 1 line
1.8.3.1
Re: [wireless] wifi: wilc1000: add missing unregister_netdev() in wilc_netdev_ifc_init()
Quoted 14 lines · Wang Yufen
Fault injection test reports this issue:
kernel BUG at
net/core/dev.c:10731!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTICall Trace: <TASK> wilc_netdev_ifc_init+0x19f/0x220 [wilc1000 884bf126e9e98af6a708f266a8dffd53f99e4bf5] wilc_cfg80211_init+0x30c/0x380 [wilc1000 884bf126e9e98af6a708f266a8dffd53f99e4bf5] wilc_bus_probe+0xad/0x2b0 [wilc1000_spi 1520a7539b6589cc6cde2ae826a523a33f8bacff] spi_probe+0xe4/0x140 really_probe+0x17e/0x3f0 __driver_probe_device+0xe3/0x170 driver_probe_device+0x49/0x120
Quoted 7 lines
The root case here is
alloc_ordered_workqueue()fails, butcfg80211_unregister_netdevice()orunregister_netdev()not be called in error handling path. To fix addunregister_netdevgoto lable to add the unregister operation in error handling path.Fixes 09ed8bfc5215 ("wilc1000: Rename workqueue from "WILC_wq" to "NETDEV-wq"")Signed-off-by Wang Yufen <[email protected]>
Patch applied to wireless-next.git, thanks.
2b88974ecb35 wifi: wilc1000: add missing unregister_netdev() in wilc_netdev_ifc_init()
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches