mac80211: brcmfmac: backport remaining patches from the Linux 5.0
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / brcm / 331-v5.0-0001-brcmfmac-fix-roamoff-1-modparam.patch
1 From 8c892df41500469729e0d662816300196e4f463d Mon Sep 17 00:00:00 2001
2 From: Stijn Tintel <stijn@linux-ipv6.be>
3 Date: Tue, 4 Dec 2018 20:29:05 +0200
4 Subject: [PATCH] brcmfmac: fix roamoff=1 modparam
5
6 When the update_connect_param callback is set, nl80211 expects the flag
7 WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
8 only set when modparam roamoff=0, while the callback is set
9 unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
10 wiphy_register, which breaks brcmfmac.
11
12 Disable the update_connect_param callback when roamoff=0 to fix this.
13
14 Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
15 Cc: Stable <stable@vger.kernel.org> # 4.19+
16 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
17 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
18 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
19 ---
20 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 11 +++++++++--
21 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
22 .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
23 3 files changed, 11 insertions(+), 4 deletions(-)
24
25 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
26 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
27 @@ -5188,10 +5188,17 @@ static struct cfg80211_ops brcmf_cfg8021
28 .del_pmk = brcmf_cfg80211_del_pmk,
29 };
30
31 -struct cfg80211_ops *brcmf_cfg80211_get_ops(void)
32 +struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings)
33 {
34 - return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
35 + struct cfg80211_ops *ops;
36 +
37 + ops = kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
38 GFP_KERNEL);
39 +
40 + if (ops && settings->roamoff)
41 + ops->update_connect_params = NULL;
42 +
43 + return ops;
44 }
45
46 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
47 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
48 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
49 @@ -404,7 +404,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
50 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
51 s32 brcmf_cfg80211_up(struct net_device *ndev);
52 s32 brcmf_cfg80211_down(struct net_device *ndev);
53 -struct cfg80211_ops *brcmf_cfg80211_get_ops(void);
54 +struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
55 enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
56
57 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
58 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
59 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
60 @@ -1151,7 +1151,7 @@ int brcmf_attach(struct device *dev, str
61
62 brcmf_dbg(TRACE, "Enter\n");
63
64 - ops = brcmf_cfg80211_get_ops();
65 + ops = brcmf_cfg80211_get_ops(settings);
66 if (!ops)
67 return -ENOMEM;
68