staging: rtl8712: fix race condition
Subsystems (2)
PATCH 1/1 staging: rtl8712: fix race condition
In probe function, request_firmware_nowait() is called to load firmware asynchronously. At completion of firmware loading, register_netdev() is called. However, a mutex needed by netdev is initialized after the call to request_firmware_nowait(). Consequently, it can happen that register_netdev() is called before the driver is ready.
Move the mutex initialization into r8712_init_drv_sw(), which is called before request_firmware_nowait().
Reported-by [email protected]
Fixes 8c213fa59199 ("staging: r8712u: Use asynchronous firmware loading")
Signed-off-by Nam Cao <[email protected]>
--- drivers/staging/rtl8712/os_intfs.c | 1 + drivers/staging/rtl8712/usb_intf.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/os_intfs.c +1 -0
@@ -327,6 +327,7 @@ int r8712_init_drv_sw(struct _adapter *padapter)mp871xinit (padapter);init_default_value (padapter);r8712_InitSwLeds (padapter); +mutex_init (&padapter->mutex_start);return 0 ;
drivers/staging/rtl8712/usb_intf.c +0 -1
@@ -567,7 +567,6 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,if (rtl871x_load_fw (padapter)) goto deinit_drv_sw;init_completion (&padapter->rx_filter_ready); -mutex_init (&padapter->mutex_start);return 0 ; deinit_drv_sw:
Signature · 1 line
2.34.1