1 From 7acf04a0ae2adf5d3e9de9adeec3129e74bf6ef2 Mon Sep 17 00:00:00 2001
2 From: Arend van Spriel <arend.vanspriel@broadcom.com>
3 Date: Thu, 11 Jul 2019 11:05:06 +0200
4 Subject: [PATCH 1/7] Revert "brcmfmac: fix NULL pointer derefence during USB
7 This reverts commit 5cdb0ef6144f47440850553579aa923c20a63f23. Subsequent
8 changes make rework the driver code fixing the issue differently.
10 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
12 .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 11 ++---------
13 .../wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 6 ++----
14 .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +---
15 .../broadcom/brcm80211/brcmfmac/fwsignal.c | 16 ++++------------
16 .../broadcom/brcm80211/brcmfmac/fwsignal.h | 3 +--
17 .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 10 ++--------
18 .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 3 +--
19 7 files changed, 13 insertions(+), 40 deletions(-)
21 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
22 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
23 @@ -479,18 +479,11 @@ fail:
27 -void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr)
29 - struct brcmf_bcdc *bcdc = drvr->proto->pd;
31 - brcmf_fws_detach_pre_delif(bcdc->fws);
34 -void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr)
35 +void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
37 struct brcmf_bcdc *bcdc = drvr->proto->pd;
39 drvr->proto->pd = NULL;
40 - brcmf_fws_detach_post_delif(bcdc->fws);
41 + brcmf_fws_detach(bcdc->fws);
44 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
45 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h
48 #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC
49 int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
50 -void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr);
51 -void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr);
52 +void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
53 void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
54 void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
56 struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr);
58 static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
59 -static void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) {};
60 -static inline void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) {}
61 +static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
64 #endif /* BRCMFMAC_BCDC_H */
65 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
66 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
67 @@ -1335,8 +1335,6 @@ void brcmf_detach(struct device *dev)
69 brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
71 - brcmf_proto_detach_pre_delif(drvr);
73 /* make sure primary interface removed last */
74 for (i = BRCMF_MAX_IFS-1; i > -1; i--)
75 brcmf_remove_interface(drvr->iflist[i], false);
76 @@ -1346,7 +1344,7 @@ void brcmf_detach(struct device *dev)
78 brcmf_bus_stop(drvr->bus_if);
80 - brcmf_proto_detach_post_delif(drvr);
81 + brcmf_proto_detach(drvr);
84 wiphy_free(drvr->wiphy);
85 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
86 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
87 @@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach(
91 - brcmf_fws_detach_pre_delif(fws);
92 - brcmf_fws_detach_post_delif(fws);
93 + brcmf_fws_detach(fws);
97 -void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws)
98 +void brcmf_fws_detach(struct brcmf_fws_info *fws)
103 - destroy_workqueue(fws->fws_wq);
104 - fws->fws_wq = NULL;
108 -void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws)
113 + destroy_workqueue(fws->fws_wq);
117 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
118 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
122 struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr);
123 -void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws);
124 -void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws);
125 +void brcmf_fws_detach(struct brcmf_fws_info *fws);
126 void brcmf_fws_debugfs_create(struct brcmf_pub *drvr);
127 bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws);
128 bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
129 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
130 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
131 @@ -56,22 +56,16 @@ fail:
135 -void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr)
136 +void brcmf_proto_detach(struct brcmf_pub *drvr)
138 brcmf_dbg(TRACE, "Enter\n");
141 if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
142 - brcmf_proto_bcdc_detach_post_delif(drvr);
143 + brcmf_proto_bcdc_detach(drvr);
144 else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF)
145 brcmf_proto_msgbuf_detach(drvr);
151 -void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr)
153 - if (drvr->proto && drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
154 - brcmf_proto_bcdc_detach_pre_delif(drvr);
156 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
157 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
158 @@ -43,8 +43,7 @@ struct brcmf_proto {
161 int brcmf_proto_attach(struct brcmf_pub *drvr);
162 -void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr);
163 -void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr);
164 +void brcmf_proto_detach(struct brcmf_pub *drvr);
166 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,