Commit a84a60cc authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo

Revert "brcmfmac: fix NULL pointer derefence during USB disconnect"

This reverts commit 5cdb0ef6. Subsequent
changes make rework the driver code fixing the issue differently.
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent fa905092
...@@ -479,18 +479,11 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) ...@@ -479,18 +479,11 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
return -ENOMEM; return -ENOMEM;
} }
void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
{
struct brcmf_bcdc *bcdc = drvr->proto->pd;
brcmf_fws_detach_pre_delif(bcdc->fws);
}
void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr)
{ {
struct brcmf_bcdc *bcdc = drvr->proto->pd; struct brcmf_bcdc *bcdc = drvr->proto->pd;
drvr->proto->pd = NULL; drvr->proto->pd = NULL;
brcmf_fws_detach_post_delif(bcdc->fws); brcmf_fws_detach(bcdc->fws);
kfree(bcdc); kfree(bcdc);
} }
...@@ -7,16 +7,14 @@ ...@@ -7,16 +7,14 @@
#ifdef CONFIG_BRCMFMAC_PROTO_BCDC #ifdef CONFIG_BRCMFMAC_PROTO_BCDC
int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr); void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state); void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
bool success); bool success);
struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr); struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr);
#else #else
static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
static void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) {}; static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
static inline void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) {}
#endif #endif
#endif /* BRCMFMAC_BCDC_H */ #endif /* BRCMFMAC_BCDC_H */
...@@ -1314,8 +1314,6 @@ void brcmf_detach(struct device *dev) ...@@ -1314,8 +1314,6 @@ void brcmf_detach(struct device *dev)
brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
brcmf_proto_detach_pre_delif(drvr);
/* make sure primary interface removed last */ /* make sure primary interface removed last */
for (i = BRCMF_MAX_IFS-1; i > -1; i--) for (i = BRCMF_MAX_IFS-1; i > -1; i--)
brcmf_remove_interface(drvr->iflist[i], false); brcmf_remove_interface(drvr->iflist[i], false);
...@@ -1325,7 +1323,7 @@ void brcmf_detach(struct device *dev) ...@@ -1325,7 +1323,7 @@ void brcmf_detach(struct device *dev)
brcmf_bus_stop(drvr->bus_if); brcmf_bus_stop(drvr->bus_if);
brcmf_proto_detach_post_delif(drvr); brcmf_proto_detach(drvr);
bus_if->drvr = NULL; bus_if->drvr = NULL;
wiphy_free(drvr->wiphy); wiphy_free(drvr->wiphy);
......
...@@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr) ...@@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
return fws; return fws;
fail: fail:
brcmf_fws_detach_pre_delif(fws); brcmf_fws_detach(fws);
brcmf_fws_detach_post_delif(fws);
return ERR_PTR(rc); return ERR_PTR(rc);
} }
void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws) void brcmf_fws_detach(struct brcmf_fws_info *fws)
{ {
if (!fws) if (!fws)
return; return;
if (fws->fws_wq) {
destroy_workqueue(fws->fws_wq);
fws->fws_wq = NULL;
}
}
void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws) if (fws->fws_wq)
{ destroy_workqueue(fws->fws_wq);
if (!fws)
return;
/* cleanup */ /* cleanup */
brcmf_fws_lock(fws); brcmf_fws_lock(fws);
......
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
#define FWSIGNAL_H_ #define FWSIGNAL_H_
struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr); struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr);
void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws); void brcmf_fws_detach(struct brcmf_fws_info *fws);
void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws);
void brcmf_fws_debugfs_create(struct brcmf_pub *drvr); void brcmf_fws_debugfs_create(struct brcmf_pub *drvr);
bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws); bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws);
bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
......
...@@ -56,22 +56,16 @@ int brcmf_proto_attach(struct brcmf_pub *drvr) ...@@ -56,22 +56,16 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
return -ENOMEM; return -ENOMEM;
} }
void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr) void brcmf_proto_detach(struct brcmf_pub *drvr)
{ {
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
if (drvr->proto) { if (drvr->proto) {
if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
brcmf_proto_bcdc_detach_post_delif(drvr); brcmf_proto_bcdc_detach(drvr);
else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF) else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF)
brcmf_proto_msgbuf_detach(drvr); brcmf_proto_msgbuf_detach(drvr);
kfree(drvr->proto); kfree(drvr->proto);
drvr->proto = NULL; drvr->proto = NULL;
} }
} }
void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr)
{
if (drvr->proto && drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
brcmf_proto_bcdc_detach_pre_delif(drvr);
}
...@@ -43,8 +43,7 @@ struct brcmf_proto { ...@@ -43,8 +43,7 @@ struct brcmf_proto {
int brcmf_proto_attach(struct brcmf_pub *drvr); int brcmf_proto_attach(struct brcmf_pub *drvr);
void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr); void brcmf_proto_detach(struct brcmf_pub *drvr);
void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr);
static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
struct sk_buff *skb, struct sk_buff *skb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment