114a3b3fe4a6862ca137021e56406a3af16e91ea
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / brcm / 100-brcmfmac-fix-roamoff-1-modparam.patch
1 From 22d319f2665dd3458d59c934fa0c8cf1b1d7227f Mon Sep 17 00:00:00 2001
2 From: Stijn Tintel <stijn@linux-ipv6.be>
3 Date: Sat, 10 Nov 2018 13:25:20 +0200
4 Subject: [PATCH wireless-drivers] 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 ---
19 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 11 +++++++++--
20 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
21 .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
22 3 files changed, 11 insertions(+), 4 deletions(-)
23
24 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
25 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
26 @@ -5188,10 +5188,17 @@ static struct cfg80211_ops brcmf_cfg8021
27 .del_pmk = brcmf_cfg80211_del_pmk,
28 };
29
30 -struct cfg80211_ops *brcmf_cfg80211_get_ops(void)
31 +struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings)
32 {
33 - return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
34 + struct cfg80211_ops *ops;
35 +
36 + ops = kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
37 GFP_KERNEL);
38 +
39 + if (ops && settings->roamoff)
40 + ops->update_connect_params = NULL;
41 +
42 + return ops;
43 }
44
45 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
46 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
47 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
48 @@ -404,7 +404,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
49 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
50 s32 brcmf_cfg80211_up(struct net_device *ndev);
51 s32 brcmf_cfg80211_down(struct net_device *ndev);
52 -struct cfg80211_ops *brcmf_cfg80211_get_ops(void);
53 +struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
54 enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
55
56 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
57 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
58 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
59 @@ -1151,7 +1151,7 @@ int brcmf_attach(struct device *dev, str
60
61 brcmf_dbg(TRACE, "Enter\n");
62
63 - ops = brcmf_cfg80211_get_ops();
64 + ops = brcmf_cfg80211_get_ops(settings);
65 if (!ops)
66 return -ENOMEM;
67