Skip to content

Commit b817047

Browse files
gbhat-marvellKalle Valo
authored andcommitted
mwifiex: handle race during mwifiex_usb_disconnect
Race condition is observed during rmmod of mwifiex_usb: 1. The rmmod thread will call mwifiex_usb_disconnect(), download SHUTDOWN command and do wait_event_interruptible_timeout(), waiting for response. 2. The main thread will handle the response and will do a wake_up_interruptible(), unblocking rmmod thread. 3. On getting unblocked, rmmod thread will make rx_cmd.urb = NULL in mwifiex_usb_free(). 4. The main thread will try to resubmit rx_cmd.urb in mwifiex_usb_submit_rx_urb(), which is NULL. To fix, wait for main thread to complete before calling mwifiex_usb_free(). Signed-off-by: Ganapathi Bhat <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 618fd1e commit b817047

File tree

1 file changed

+3
-0
lines changed
  • drivers/net/wireless/marvell/mwifiex

1 file changed

+3
-0
lines changed

drivers/net/wireless/marvell/mwifiex/usb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf)
644644
MWIFIEX_FUNC_SHUTDOWN);
645645
}
646646

647+
if (adapter->workqueue)
648+
flush_workqueue(adapter->workqueue);
649+
647650
mwifiex_usb_free(card);
648651

649652
mwifiex_dbg(adapter, FATAL,

0 commit comments

Comments
 (0)