Skip to contentSkip to conversation

wifi: brcmfmac: cyw: pass PMKID to firmware if present

PATCH Superseded Bogdan Nicolae 3 participants 3 messages Aug 7

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 wifi: brcmfmac: cyw: pass PMKID to firmware if present

Zero out auth_status on initialization. Otherwise, garbage will leak from the stack to the firmware (when ssid is less than 32 bytes and/or when params->pmkid is set). Then, pass the params->pmkid to the firmware (without it, the firmware caches a garbage PMKID on successful authentication and denies a subsequent association request that includes the PMKID).

Fixes 66f909308a7c ("wifi: brcmfmac: cyw: support external SAE authentication in station mode")

---
v5: Fixed line length > 80 chars
v4: Fixed indentation
v3: Added Fixes, Cc: stable, and Acked-by tags
v2: Split into a separate patch

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +4 -1
index 873754be5..2c59b5e57 100644
@@ -200,7 +200,7 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev,
 {
 	struct brcmf_if *ifp;
 	struct brcmf_pub *drvr;
-	struct brcmf_auth_req_status_le auth_status;
+	struct brcmf_auth_req_status_le auth_status = {};
 	int ret = 0;
 
 	brcmf_dbg(TRACE, "Enter\n");
@@ -208,6 +208,8 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev,
 	ifp = netdev_priv(dev);
 	drvr = ifp->drvr;
 	if (params->status == WLAN_STATUS_SUCCESS) {
+		if (params->pmkid)
+			memcpy(auth_status.pmkid, params->pmkid,
+			       WLAN_PMKID_LEN);
 		auth_status.flags = cpu_to_le16(BRCMF_EXTAUTH_SUCCESS);
 	} else {

bphy_err(drvr, "External authentication failed: status=%d\n",
--
2.55.0

maintainer
#1 lore raw
Quoted 10 lines · Bogdan Nicolae

Zero out auth_status on initialization. Otherwise, garbage will leak from the stack to the firmware (when ssid is less than 32 bytes and/or when params->pmkid is set). Then, pass the params->pmkid to the firmware (without it, the firmware caches a garbage PMKID on successful authentication and denies a subsequent association request that includes the PMKID).

Fixes 66f909308a7c ("wifi: brcmfmac: cyw: support external SAE authentication in station mode")

It looks good, but in patchwork it showed the patch could not be applied so I tried myself:

$ patch -p1 < ~/Downloads/v5-wifi-brcmfmac-cyw-pass-PMKID-to-firmware-if-present.diff
patching file drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
/usr/bin/patch: **** malformed patch at line 23:  		bphy_err(drvr, "External authentication failed: status=%d\n",

Been staring at it and not seeing the problem. Also checkpatch is not complaining. Look at the hexdump and the last line was missing a space before the tabs, but that was not the issue. The plot thickens...

Quoted 4 lines

---
v5: Fixed line length > 80 chars
v4: Fixed indentation
v3: Added Fixes, Cc: stable, and Acked-by tags

Contrary to this there is no CC: stable tag in this patch.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev,

Quoted 19 lines

v2: Split into a separate patch

  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +1 -1
index 873754be5..2c59b5e57 100644
@@ -200,7 +200,7 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev,
  {
  	struct brcmf_if *ifp;
  	struct brcmf_pub *drvr;
-	struct brcmf_auth_req_status_le auth_status;
+	struct brcmf_auth_req_status_le auth_status = {};
  	int ret = 0;
 
  	brcmf_dbg(TRACE, "Enter\n");
@@ -208,6 +208,8 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev,

It looks like you hand edited the patch but now the number of line is 9 and not 8. Not sure if Johannes wants to hand edit that, but it does apply once fixed.

Let's wait for Johannes to reply.

Regards,
Arend

Quoted 11 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +3 -1
  	ifp = netdev_priv(dev);
  	drvr = ifp->drvr;
  	if (params->status == WLAN_STATUS_SUCCESS) {
+		if (params->pmkid)
+			memcpy(auth_status.pmkid, params->pmkid,
+			       WLAN_PMKID_LEN);
  		auth_status.flags = cpu_to_le16(BRCMF_EXTAUTH_SUCCESS);
  	} else {
  		bphy_err(drvr, "External authentication failed: status=%d\n",
--

2.55.0

#2 lore raw
Quoted 4 lines · Arend van Spriel

It looks like you hand edited the patch but now the number of line is 9 and not 8. Not sure if Johannes wants to hand edit that, but it does apply once fixed.

Nope. Please send patches that apply, that way also the nipa bot can compile test them etc.

johannes