1 From 8b144dedb928e4e2f433a328d58f44c3c098d63e Mon Sep 17 00:00:00 2001
2 From: Larry Finger <Larry.Finger@lwfinger.net>
3 Date: Wed, 15 Dec 2021 11:11:05 -0600
4 Subject: rtlwifi: rtl8192cu: Fix WARNING when calling local_irq_restore() with interrupts enabled
6 From: Larry Finger <Larry.Finger@lwfinger.net>
8 commit 8b144dedb928e4e2f433a328d58f44c3c098d63e upstream.
10 Syzbot reports the following WARNING:
12 [200~raw_local_irq_restore() called with IRQs enabled
13 WARNING: CPU: 1 PID: 1206 at kernel/locking/irqflag-debug.c:10
14 warn_bogus_irq_restore+0x1d/0x20 kernel/locking/irqflag-debug.c:10
16 Hardware initialization for the rtl8188cu can run for as long as 350 ms,
17 and the routine may be called with interrupts disabled. To avoid locking
18 the machine for this long, the current routine saves the interrupt flags
19 and enables local interrupts. The problem is that it restores the flags
20 at the end without disabling local interrupts first.
22 This patch fixes commit a53268be0cb9 ("rtlwifi: rtl8192cu: Fix too long
25 Reported-by: syzbot+cce1ee31614c171f5595@syzkaller.appspotmail.com
26 Cc: stable@vger.kernel.org
27 Fixes: a53268be0cb9 ("rtlwifi: rtl8192cu: Fix too long disable of IRQs")
28 Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
29 Signed-off-by: Kalle Valo <kvalo@kernel.org>
30 Link: https://lore.kernel.org/r/20211215171105.20623-1-Larry.Finger@lwfinger.net
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 1 +
34 1 file changed, 1 insertion(+)
36 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
37 +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
38 @@ -1000,6 +1000,7 @@ int rtl92cu_hw_init(struct ieee80211_hw
42 + local_irq_disable();
43 local_irq_restore(flags);