All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reto Schneider <code@reto-schneider.ch>
To: linux-wireless@vger.kernel.org
Cc: Larry.Finger@lwfinger.net, Reto Schneider <code@reto-schneider.ch>
Subject: [PATCH 1/3] rtl8192cu: Fix deadlock
Date: Mon, 22 Jun 2020 15:21:11 +0200	[thread overview]
Message-ID: <20200622132113.14508-2-code@reto-schneider.ch> (raw)
In-Reply-To: <20200622132113.14508-1-code@reto-schneider.ch>

Prevent code from calling itself indirectly, causing the driver to hang
and consume 100% CPU.

Without this fix, the following script can bring down a single CPU
system:
```
while true; do
  rmmod rtl8192cu
  modprobe rtl8192cu
done
```

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
---
 drivers/net/wireless/realtek/rtlwifi/usb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index c66c6dc00378..d3bbfc0171f6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -680,8 +680,10 @@ static void _rtl_usb_cleanup_rx(struct ieee80211_hw *hw)
 	tasklet_kill(&rtlusb->rx_work_tasklet);
 	cancel_work_sync(&rtlpriv->works.lps_change_work);
 
-	flush_workqueue(rtlpriv->works.rtl_wq);
-	destroy_workqueue(rtlpriv->works.rtl_wq);
+	if (rtlpriv->works.rtl_wq) {
+		destroy_workqueue(rtlpriv->works.rtl_wq);
+		rtlpriv->works.rtl_wq = NULL;
+	}
 
 	skb_queue_purge(&rtlusb->rx_queue);
 
-- 
2.20.1


  reply	other threads:[~2020-06-22 13:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 13:21 [PATCH 0/3] rtl8192cu: Fixes for leaks and deadlock Reto Schneider
2020-06-22 13:21 ` Reto Schneider [this message]
2020-06-22 18:01   ` [PATCH 1/3] rtl8192cu: Fix deadlock Larry Finger
2020-06-23  9:20     ` Kalle Valo
2020-07-15 10:37   ` [PATCH 1/3] rtlwifi: " Kalle Valo
2020-06-22 13:21 ` [PATCH 2/3] rtl8192cu: Prevent leaking urb Reto Schneider
2020-06-22 13:21 ` [PATCH 3/3] rtl8192cu: Free ieee80211_hw if probing fails Reto Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200622132113.14508-2-code@reto-schneider.ch \
    --to=code@reto-schneider.ch \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.