2018-12-04 18:36:38

by Stijn Tintel

[permalink] [raw]
Subject: [PATCH wireless-drivers] brcmfmac: fix roamoff=1 modparam

When the update_connect_param callback is set, nl80211 expects the flag
WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
only set when modparam roamoff=0, while the callback is set
unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
wiphy_register, which breaks brcmfmac.

Disable the update_connect_param callback when roamoff=0 to fix this.

Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
Cc: Stable <[email protected]> # 4.19+
Signed-off-by: Jonas Gorski <[email protected]>
Signed-off-by: Stijn Tintel <[email protected]>
---
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 11 +++++++++--
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
.../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 7f0a5bade70a..c0e3ae7bf2ae 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5196,10 +5196,17 @@ static struct cfg80211_ops brcmf_cfg80211_ops = {
.del_pmk = brcmf_cfg80211_del_pmk,
};

-struct cfg80211_ops *brcmf_cfg80211_get_ops(void)
+struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings)
{
- return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
+ struct cfg80211_ops *ops;
+
+ ops = kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
GFP_KERNEL);
+
+ if (ops && settings->roamoff)
+ ops->update_connect_params = NULL;
+
+ return ops;
}

struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index a4aec0004e4f..9a6287f084a9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -404,7 +404,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
s32 brcmf_cfg80211_up(struct net_device *ndev);
s32 brcmf_cfg80211_down(struct net_device *ndev);
-struct cfg80211_ops *brcmf_cfg80211_get_ops(void);
+struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);

struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index b1f702faff4f..860a4372cb56 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1130,7 +1130,7 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)

brcmf_dbg(TRACE, "Enter\n");

- ops = brcmf_cfg80211_get_ops();
+ ops = brcmf_cfg80211_get_ops(settings);
if (!ops)
return -ENOMEM;

--
2.18.1



2018-12-13 13:46:07

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH wireless-drivers] brcmfmac: fix roamoff=1 modparam

Stijn Tintel <[email protected]> wrote:

> When the update_connect_param callback is set, nl80211 expects the flag
> WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
> only set when modparam roamoff=0, while the callback is set
> unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
> wiphy_register, which breaks brcmfmac.
>
> Disable the update_connect_param callback when roamoff=0 to fix this.
>
> Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
> Cc: Stable <[email protected]> # 4.19+
> Signed-off-by: Jonas Gorski <[email protected]>
> Signed-off-by: Stijn Tintel <[email protected]>

Should this go to 4.20? Arend?

--
https://patchwork.kernel.org/patch/10712383/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2018-12-13 16:03:26

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH wireless-drivers] brcmfmac: fix roamoff=1 modparam

Kalle Valo <[email protected]> writes:

> Stijn Tintel <[email protected]> wrote:
>
>> When the update_connect_param callback is set, nl80211 expects the flag
>> WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
>> only set when modparam roamoff=0, while the callback is set
>> unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
>> wiphy_register, which breaks brcmfmac.
>>
>> Disable the update_connect_param callback when roamoff=0 to fix this.
>>
>> Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
>> Cc: Stable <[email protected]> # 4.19+
>> Signed-off-by: Jonas Gorski <[email protected]>
>> Signed-off-by: Stijn Tintel <[email protected]>
>
> Should this go to 4.20? Arend?

I talked with Arend offline and we concluded to push this to -next.

--
Kalle Valo

2018-12-20 06:48:16

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH wireless-drivers] brcmfmac: fix roamoff=1 modparam

Stijn Tintel <[email protected]> wrote:

> When the update_connect_param callback is set, nl80211 expects the flag
> WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
> only set when modparam roamoff=0, while the callback is set
> unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
> wiphy_register, which breaks brcmfmac.
>
> Disable the update_connect_param callback when roamoff=0 to fix this.
>
> Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
> Cc: Stable <[email protected]> # 4.19+
> Signed-off-by: Jonas Gorski <[email protected]>
> Signed-off-by: Stijn Tintel <[email protected]>

Patch applied to wireless-drivers-next.git, thanks.

8c892df41500 brcmfmac: fix roamoff=1 modparam

--
https://patchwork.kernel.org/patch/10712383/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches