This is a note to let you know that I've just added the patch titled staging: rtl8712: fix race condition to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-rtl8712-fix-race-condition.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1422b526fba994cf05fd288a152106563b875fce Mon Sep 17 00:00:00 2001 From: Nam Cao <namcaov@xxxxxxxxx> Date: Mon, 31 Jul 2023 13:06:20 +0200 Subject: staging: rtl8712: fix race condition From: Nam Cao <namcaov@xxxxxxxxx> commit 1422b526fba994cf05fd288a152106563b875fce upstream. 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: syzbot+b08315e8cf5a78eed03c@xxxxxxxxxxxxxxxxxxxxxxxxx Closes: https://lore.kernel.org/linux-staging/000000000000d9d4560601b8e0d7@xxxxxxxxxx/T/#u Fixes: 8c213fa59199 ("staging: r8712u: Use asynchronous firmware loading") Cc: stable <stable@xxxxxxxxxx> Signed-off-by: Nam Cao <namcaov@xxxxxxxxx> Link: https://lore.kernel.org/r/20230731110620.116562-1-namcaov@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/rtl8712/os_intfs.c | 1 + drivers/staging/rtl8712/usb_intf.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -323,6 +323,7 @@ int r8712_init_drv_sw(struct _adapter *p mp871xinit(padapter); init_default_value(padapter); r8712_InitSwLeds(padapter); + mutex_init(&padapter->mutex_start); return ret; } --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -570,7 +570,6 @@ static int r871xu_drv_init(struct usb_in if (rtl871x_load_fw(padapter)) goto deinit_drv_sw; spin_lock_init(&padapter->lock_rx_ff0_filter); - mutex_init(&padapter->mutex_start); return 0; deinit_drv_sw: Patches currently in stable-queue which might be from namcaov@xxxxxxxxx are queue-5.10/staging-rtl8712-fix-race-condition.patch