MA-7253 bcmdhd: avoid null interface before update tx status
authorHaoran Wang <b50027@freescale.com>
Wed, 25 Nov 2015 08:48:11 +0000 (16:48 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:40 +0000 (14:49 -0500)
Avoid to access the null interface before update tx status.

This patch workaround to fix the panic when the p2p connection
disconnect in the p2p stress test. The interface will be
released during the disconnect process.

Fixed coding style issue by Aisheng.

Acked-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Haoran Wang <b50027@freescale.com>
(cherry picked from commit 4e093820e74a83d86f3bb0dadc1054e3ddb8248c)

drivers/net/wireless/bcmdhd/dhd_linux.c

index 37a786a..2e23e29 100644 (file)
@@ -2135,6 +2135,8 @@ dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success)
        dhd_info_t *dhd = (dhd_info_t *)(dhdp->info);
        struct ether_header *eh;
        uint16 type;
+       uint datalen;
+       dhd_if_t *ifp;
 
        dhd_prot_hdrpull(dhdp, NULL, txp, NULL, NULL);
 
@@ -2146,9 +2148,12 @@ dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success)
 
 #ifdef PROP_TXSTATUS
        if (dhdp->wlfc_state && (dhdp->proptxstatus_mode != WLFC_FCMODE_NONE)) {
-               dhd_if_t *ifp = dhd->iflist[DHD_PKTTAG_IF(PKTTAG(txp))];
-               uint datalen  = PKTLEN(dhd->pub.osh, txp);
+               ifp = dhd->iflist[DHD_PKTTAG_IF(PKTTAG(txp))];
+               /* if the interface is released somewhere just return */
+               if (ifp == NULL)
+                       return;
 
+               datalen  = PKTLEN(dhd->pub.osh, txp);
                if (success) {
                        dhd->pub.tx_packets++;
                        ifp->stats.tx_packets++;