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: <85a54ed5bd76a422165cc5ab532a680deb63ec93.1690904067.git.petr.tesarik.ext@huawei.com>
Date:   Tue,  1 Aug 2023 17:36:41 +0200
From:   Petr Tesarik <petrtesarik@...weicloud.com>
To:     Arend van Spriel <aspriel@...il.com>,
        Franky Lin <franky.lin@...adcom.com>,
        Hante Meuleman <hante.meuleman@...adcom.com>,
        Kalle Valo <kvalo@...nel.org>,
        Chi-hsien Lin <chi-hsien.lin@...ineon.com>,
        Ian Lin <ian.lin@...ineon.com>,
        Wright Feng <wright.feng@...ress.com>,
        Hector Martin <marcan@...can.st>,
        Prasanna Kerekoppa <prasanna.kerekoppa@...ress.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Ramesh Rangavittal <ramesh.rangavittal@...ineon.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Kees Cook <keescook@...omium.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Ryohei Kondo <ryohei.kondo@...ress.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Jason A. Donenfeld" <Jason@...c4.com>,
        "Darrick J. Wong" <djwong@...nel.org>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Brian Henriquez <brian.henriquez@...ress.com>,
        linux-wireless@...r.kernel.org (open list:BROADCOM BRCM80211
        IEEE802.11n WIRELESS DRIVER),
        brcm80211-dev-list.pdl@...adcom.com (open list:BROADCOM BRCM80211
        IEEE802.11n WIRELESS DRIVER),
        SHA-cyfmac-dev-list@...ineon.com (open list:BROADCOM BRCM80211
        IEEE802.11n WIRELESS DRIVER),
        linux-kernel@...r.kernel.org (open list)
Cc:     Roberto Sassu <roberto.sassu@...weicloud.com>, petr@...arici.cz
Subject: [PATCH v1 2/3] wifi: brcm80211: separate abort scan param prepare from actual scan

From: Petr Tesarik <petr.tesarik.ext@...wei.com>

Use a dedicated helper to prepare parameters for a scan abort, rather than
special-casing a NULL argument to brcmf_escan_prep().

Signed-off-by: Petr Tesarik <petr.tesarik.ext@...wei.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 49 ++++++++++---------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index de8a2e27f49c..3f4257fe76b3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1073,6 +1073,31 @@ static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2
 	       &params_v2_le->channel_list[0], params_size);
 }
 
+static void brcmf_escan_base_prep(struct brcmf_scan_params_v2_le *params_le)
+{
+	eth_broadcast_addr(params_le->bssid);
+
+	params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
+	params_le->bss_type = DOT11_BSSTYPE_ANY;
+	params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
+	params_le->channel_num = 0;
+	params_le->nprobes = cpu_to_le32(-1);
+	params_le->active_time = cpu_to_le32(-1);
+	params_le->passive_time = cpu_to_le32(-1);
+	params_le->home_time = cpu_to_le32(-1);
+	memset(&params_le->ssid_le, 0, sizeof(params_le->ssid_le));
+}
+
+static void brcmf_escan_abort_prep(struct brcmf_scan_params_v2_le *params_le)
+{
+	int length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE + sizeof(u16);
+
+	brcmf_escan_base_prep(params_le);
+	params_le->channel_num = cpu_to_le32(1);
+	params_le->channel_list[0] = cpu_to_le16(-1);
+	params_le->length = cpu_to_le16(length);
+}
+
 static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
 			     struct brcmf_scan_params_v2_le *params_le,
 			     struct cfg80211_scan_request *request)
@@ -1086,29 +1111,9 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
 	int length;
 	struct brcmf_ssid_le ssid_le;
 
-	eth_broadcast_addr(params_le->bssid);
-
+	brcmf_escan_base_prep(params_le);
 	length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
 
-	params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
-	params_le->bss_type = DOT11_BSSTYPE_ANY;
-	params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
-	params_le->channel_num = 0;
-	params_le->nprobes = cpu_to_le32(-1);
-	params_le->active_time = cpu_to_le32(-1);
-	params_le->passive_time = cpu_to_le32(-1);
-	params_le->home_time = cpu_to_le32(-1);
-	memset(&params_le->ssid_le, 0, sizeof(params_le->ssid_le));
-
-	/* Scan abort */
-	if (!request) {
-		length += sizeof(u16);
-		params_le->channel_num = cpu_to_le32(1);
-		params_le->channel_list[0] = cpu_to_le16(-1);
-		params_le->length = cpu_to_le16(length);
-		return;
-	}
-
 	n_ssids = request->n_ssids;
 	n_channels = request->n_channels;
 
@@ -1186,7 +1191,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
 		/* Do a scan abort to stop the driver's scan engine */
 		brcmf_dbg(SCAN, "ABORT scan in firmware\n");
 
-		brcmf_escan_prep(cfg, &params_v2_le, NULL);
+		brcmf_escan_abort_prep(&params_v2_le);
 
 		/* E-Scan (or anyother type) can be aborted by SCAN */
 		if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ