[PATCH v3] wifi: brcmfmac: cyw: pass PMKID to firmware if present

Bogdan Nicolae posted 1 patch 1 month, 4 weeks ago
There is a newer version of this series
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH v3] wifi: brcmfmac: cyw: pass PMKID to firmware if present
Posted by Bogdan Nicolae 1 month, 4 weeks ago
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")
Cc: stable@vger.kernel.org
Signed-off-by: Bogdan Nicolae <bogdan.nicolae@gmail.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
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(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
index 873754be5..2c59b5e57 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
@@ -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
Re: [PATCH v3] wifi: brcmfmac: cyw: pass PMKID to firmware if present
Posted by Gokul Sivakumar 1 month, 4 weeks ago
On 08/03, Bogdan Nicolae wrote:
> 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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bogdan Nicolae <bogdan.nicolae@gmail.com>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> ---
> 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(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
> index 873754be5..2c59b5e57 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
> @@ -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 = {};

Need to fix the alignment here.

>     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);

also here.

>         auth_status.flags = cpu_to_le16(BRCMF_EXTAUTH_SUCCESS);
>     } else {
>         bphy_err(drvr, "External authentication failed: status=%d\n",
> --

Patch needs to pass the checkpatch.pl, before it can be submitted for review.

And need to follow these guidelines for linux wireless
https://wireless.docs.kernel.org/en/latest/en/developers/documentation/submittingpatches.html

Gokul