Skip to contentSkip to conversation

FAILED: patch "[PATCH] staging: rtl8712: fix race condition" failed to apply to 4.19-stable tree

PATCH [email protected] 1 participant 1 message Sep 2, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x 1422b526fba994cf05fd288a152106563b875fce
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023090202-caddie-slang-9a89@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 1422b526fba994cf05fd288a152106563b875fce Mon Sep 17 00:00:00 2001
From: Nam Cao <[email protected]>
Date: Mon, 31 Jul 2023 13:06:20 +0200
Subject: [PATCH] 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().

drivers/staging/rtl8712/os_intfs.c +1 -0
index a2f3645be0cc..b18e6d9c832b 100644
@@ -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
index 37364d3101e2..df05213f922f 100644
@@ -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: