mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] wifi: mwifiex: synchronize scan cancellation state
@ 2026-10-28 13:58 Vishal Gupta
  2026-11-20 10:47 ` [PATCH v2] wifi: ath6kl: synchronize scan request completion Vishal Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Vishal Gupta @ 2026-10-28 13:58 UTC (permalink / raw)
  To: briannorris; +Cc: francesco, linux-wireless, linux-kernel, Vishal Gupta

Read and update scan_processing under mwifiex_cmd_lock so cancellation
cannot race with scan state changes. Skip scan completion when no scan
was active.

Signed-off-by: Vishal Gupta <vishal.gupta_1@philips.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 34 ++++++++++++---------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index bdd4b8465863b..c2c5738d8a3fa 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -2059,26 +2059,32 @@ void mwifiex_cancel_scan(struct mwifiex_adapter *adapter)
 {
 	struct mwifiex_private *priv;
 	int i;
+	bool cancel = false;
 
 	mwifiex_cancel_pending_scan_cmd(adapter);
 
+	spin_lock_bh(&adapter->mwifiex_cmd_lock);
 	if (adapter->scan_processing) {
-		spin_lock_bh(&adapter->mwifiex_cmd_lock);
 		adapter->scan_processing = false;
-		spin_unlock_bh(&adapter->mwifiex_cmd_lock);
-		for (i = 0; i < adapter->priv_num; i++) {
-			priv = adapter->priv[i];
-			if (priv->scan_request) {
-				struct cfg80211_scan_info info = {
-					.aborted = true,
-				};
+		cancel = true;
+	}
+	spin_unlock_bh(&adapter->mwifiex_cmd_lock);
 
-				mwifiex_dbg(adapter, INFO,
-					    "info: aborting scan\n");
-				cfg80211_scan_done(priv->scan_request, &info);
-				priv->scan_request = NULL;
-				priv->scan_aborting = false;
-			}
+	if (!cancel)
+		return;
+
+	for (i = 0; i < adapter->priv_num; i++) {
+		priv = adapter->priv[i];
+		if (priv->scan_request) {
+			struct cfg80211_scan_info info = {
+				.aborted = true,
+			};
+
+			mwifiex_dbg(adapter, INFO,
+				    "info: aborting scan\n");
+			cfg80211_scan_done(priv->scan_request, &info);
+			priv->scan_request = NULL;
+			priv->scan_aborting = false;
 		}
 	}
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 13:58 [PATCH 1/1] wifi: mwifiex: synchronize scan cancellation state Vishal Gupta
2026-11-20 10:47 ` [PATCH v2] wifi: ath6kl: synchronize scan request completion Vishal Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®