2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 03:04:01 +08:00

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

This reverts commit 5cdb0ef614. Subsequent
changes make rework the driver code fixing the issue differently.

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Arend van Spriel 2019-07-11 11:05:06 +02:00 committed by Kalle Valo
parent fa9050927f
commit a84a60ccdd
7 changed files with 13 additions and 40 deletions

View File

@ -479,18 +479,11 @@ fail:
return -ENOMEM;
}
void brcmf_proto_bcdc_detach_pre_delif(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)
void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr)
{
struct brcmf_bcdc *bcdc = drvr->proto->pd;
drvr->proto->pd = NULL;
brcmf_fws_detach_post_delif(bcdc->fws);
brcmf_fws_detach(bcdc->fws);
kfree(bcdc);
}

View File

@ -7,16 +7,14 @@
#ifdef CONFIG_BRCMFMAC_PROTO_BCDC
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_post_delif(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state);
void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp,
bool success);
struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr);
#else
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_post_delif(struct brcmf_pub *drvr) {}
static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
#endif
#endif /* BRCMFMAC_BCDC_H */

View File

@ -1314,8 +1314,6 @@ void brcmf_detach(struct device *dev)
brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
brcmf_proto_detach_pre_delif(drvr);
/* make sure primary interface removed last */
for (i = BRCMF_MAX_IFS-1; i > -1; i--)
brcmf_remove_interface(drvr->iflist[i], false);
@ -1325,7 +1323,7 @@ void brcmf_detach(struct device *dev)
brcmf_bus_stop(drvr->bus_if);
brcmf_proto_detach_post_delif(drvr);
brcmf_proto_detach(drvr);
bus_if->drvr = NULL;
wiphy_free(drvr->wiphy);

View File

@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
return fws;
fail:
brcmf_fws_detach_pre_delif(fws);
brcmf_fws_detach_post_delif(fws);
brcmf_fws_detach(fws);
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)
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)
return;
if (fws->fws_wq)
destroy_workqueue(fws->fws_wq);
/* cleanup */
brcmf_fws_lock(fws);

View File

@ -7,8 +7,7 @@
#define FWSIGNAL_H_
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_post_delif(struct brcmf_fws_info *fws);
void brcmf_fws_detach(struct brcmf_fws_info *fws);
void brcmf_fws_debugfs_create(struct brcmf_pub *drvr);
bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws);
bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);

View File

@ -56,22 +56,16 @@ fail:
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");
if (drvr->proto) {
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)
brcmf_proto_msgbuf_detach(drvr);
kfree(drvr->proto);
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);
}

View File

@ -43,8 +43,7 @@ struct brcmf_proto {
int brcmf_proto_attach(struct brcmf_pub *drvr);
void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr);
void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr);
void brcmf_proto_detach(struct brcmf_pub *drvr);
static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
struct sk_buff *skb,