Fix for crash while running rmmod of wlan driver in IBSS mode

During unloading wlan driver, pAdapter is not extracted for IBSS
mode and hence referring pAdapter pointer causes crash.

CRs-Fixed: 549029

Change-Id: I64d51df010aad89154d5b878712d39ef50dc112f
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index a76dc63..5a4e878 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4913,6 +4913,8 @@
       {
          pAdapter = hdd_get_adapter(pHddCtx,
                                     WLAN_HDD_INFRA_STATION);
+         if (pAdapter == NULL)
+            pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_IBSS);
       }
    }
    /* DeRegister with platform driver as client for Suspend/Resume */
@@ -4942,7 +4944,11 @@
    // we are about to Request Full Power, and since that is synchronized,
    // the expectation is that by the time Request Full Power has completed,
    // all scans will be cancelled.
-   hdd_abort_mac_scan( pHddCtx, pAdapter->sessionId);
+   if (NULL != pAdapter)
+      hdd_abort_mac_scan( pHddCtx, pAdapter->sessionId);
+   else
+       hddLog(VOS_TRACE_LEVEL_ERROR,
+           "%s: pAdapter is NULL, cannot Abort scan", __func__);
 
    //Stop the traffic monitor timer
    if ( VOS_TIMER_STATE_RUNNING ==