staging: wilc1000: fix a bug when unload driver
authorGlen Lee <glen.lee@atmel.com>
Fri, 18 Dec 2015 09:26:02 +0000 (18:26 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Dec 2015 22:45:59 +0000 (14:45 -0800)
kernel crashes when load and unload driver several times. I used git bisect to
track down and found that removing NULL setting caused the panic.
This reverts only related codes of the patch(a4ab1ade75a3).

Fixes: a4ab1ade75a3 ("staging: wilc1000: replace drvHandler and hWFIDrv with hif_drv")
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c

index 772d524bc2b40e7fd744420fd7881c52e1a56a28..36303c310c2c04da215fa1c251f0741670762a70 100644 (file)
@@ -1385,9 +1385,12 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
 
        hif_drv->usr_conn_req.ssid_len = 0;
        kfree(hif_drv->usr_conn_req.pu8ssid);
+       hif_drv->usr_conn_req.pu8ssid = NULL;
        kfree(hif_drv->usr_conn_req.pu8bssid);
+       hif_drv->usr_conn_req.pu8bssid = NULL;
        hif_drv->usr_conn_req.ies_len = 0;
        kfree(hif_drv->usr_conn_req.ies);
+       hif_drv->usr_conn_req.ies = NULL;
 
        eth_zero_addr(wilc_connected_ssid);
 
@@ -1641,9 +1644,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
                        strConnectInfo.pu8ReqIEs = NULL;
                        hif_drv->usr_conn_req.ssid_len = 0;
                        kfree(hif_drv->usr_conn_req.pu8ssid);
+                       hif_drv->usr_conn_req.pu8ssid = NULL;
                        kfree(hif_drv->usr_conn_req.pu8bssid);
+                       hif_drv->usr_conn_req.pu8bssid = NULL;
                        hif_drv->usr_conn_req.ies_len = 0;
                        kfree(hif_drv->usr_conn_req.ies);
+                       hif_drv->usr_conn_req.ies = NULL;
                } else if ((u8MacStatus == MAC_DISCONNECTED) &&
                           (hif_drv->hif_state == HOST_IF_CONNECTED)) {
                        PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n");
@@ -1677,9 +1683,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
 
                        hif_drv->usr_conn_req.ssid_len = 0;
                        kfree(hif_drv->usr_conn_req.pu8ssid);
+                       hif_drv->usr_conn_req.pu8ssid = NULL;
                        kfree(hif_drv->usr_conn_req.pu8bssid);
+                       hif_drv->usr_conn_req.pu8bssid = NULL;
                        hif_drv->usr_conn_req.ies_len = 0;
                        kfree(hif_drv->usr_conn_req.ies);
+                       hif_drv->usr_conn_req.ies = NULL;
 
                        if (join_req && join_req_drv == hif_drv) {
                                kfree(join_req);
@@ -2049,9 +2058,12 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
 
                hif_drv->usr_conn_req.ssid_len = 0;
                kfree(hif_drv->usr_conn_req.pu8ssid);
+               hif_drv->usr_conn_req.pu8ssid = NULL;
                kfree(hif_drv->usr_conn_req.pu8bssid);
+               hif_drv->usr_conn_req.pu8bssid = NULL;
                hif_drv->usr_conn_req.ies_len = 0;
                kfree(hif_drv->usr_conn_req.ies);
+               hif_drv->usr_conn_req.ies = NULL;
 
                if (join_req && join_req_drv == hif_drv) {
                        kfree(join_req);