lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191216170302.29543-55-Jerome.Pouiller@silabs.com>
Date:   Mon, 16 Dec 2019 17:04:00 +0000
From:   Jérôme Pouiller <Jerome.Pouiller@...abs.com>
To:     "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kalle Valo <kvalo@...eaurora.org>,
        "David S . Miller" <davem@...emloft.net>,
        Jérôme Pouiller <Jerome.Pouiller@...abs.com>
Subject: [PATCH 54/55] staging: wfx: implement cancel_hw_scan()

From: Jérôme Pouiller <jerome.pouiller@...abs.com>

The device provides an API to abort a scan request. Expose this feature
to mac80211.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@...abs.com>
---
 drivers/staging/wfx/main.c |  1 +
 drivers/staging/wfx/scan.c | 13 +++++++++++++
 drivers/staging/wfx/scan.h |  1 +
 drivers/staging/wfx/wfx.h  |  1 +
 4 files changed, 16 insertions(+)

diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index cf4bcb14a12d..45c9939b7e62 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -135,6 +135,7 @@ static const struct ieee80211_ops wfx_ops = {
 	.tx			= wfx_tx,
 	.conf_tx		= wfx_conf_tx,
 	.hw_scan		= wfx_hw_scan,
+	.cancel_hw_scan		= wfx_cancel_hw_scan,
 	.sta_add		= wfx_sta_add,
 	.sta_remove		= wfx_sta_remove,
 	.sta_notify		= wfx_sta_notify,
diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c
index dde2f8868147..24061d09c404 100644
--- a/drivers/staging/wfx/scan.c
+++ b/drivers/staging/wfx/scan.c
@@ -54,6 +54,7 @@ static int send_scan_req(struct wfx_vif *wvif,
 			break;
 	}
 	wfx_tx_lock_flush(wvif->wdev);
+	wvif->scan_abort = false;
 	reinit_completion(&wvif->scan_complete);
 	ret = hif_scan(wvif, req, start_idx, i - start_idx);
 	if (ret < 0)
@@ -68,6 +69,10 @@ static int send_scan_req(struct wfx_vif *wvif,
 		hif_stop_scan(wvif);
 		return -ETIMEDOUT;
 	}
+	if (wvif->scan_abort) {
+		dev_notice(wvif->wdev->dev, "scan abort\n");
+		return -ECONNABORTED;
+	}
 	return i - start_idx;
 }
 
@@ -115,6 +120,14 @@ int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	return 0;
 }
 
+void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
+
+	wvif->scan_abort = true;
+	hif_stop_scan(wvif);
+}
+
 void wfx_scan_complete(struct wfx_vif *wvif,
 		       const struct hif_ind_scan_cmpl *arg)
 {
diff --git a/drivers/staging/wfx/scan.h b/drivers/staging/wfx/scan.h
index b547f1927d72..bba9f15a9ff5 100644
--- a/drivers/staging/wfx/scan.h
+++ b/drivers/staging/wfx/scan.h
@@ -18,6 +18,7 @@ struct wfx_vif;
 void wfx_hw_scan_work(struct work_struct *work);
 int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		struct ieee80211_scan_request *req);
+void wfx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 void wfx_scan_complete(struct wfx_vif *wvif,
 		       const struct hif_ind_scan_cmpl *ind);
 
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index db433bee87af..0a3df382af03 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -127,6 +127,7 @@ struct wfx_vif {
 	struct mutex		scan_lock;
 	struct work_struct	scan_work;
 	struct completion	scan_complete;
+	bool			scan_abort;
 	struct ieee80211_scan_request *scan_req;
 
 	struct completion	set_pm_mode_complete;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ