Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 761ee3e9 authored by Ashish Kumar Dhanotiya's avatar Ashish Kumar Dhanotiya Committed by Gerrit - the friendly Code Review server
Browse files

wlan: Validate hdd context in hdd open and hdd hostapd open apis

Currently hdd open and hdd hostapd open apis does not
validate hdd context because of which there is a possibility that
these apis may end up using invalid hdd context which may lead to
undefined behavior.

To address above issue add a check to validate hdd context in hdd
open and hdd hostapd open apis.

Change-Id: Ia5bdd67e695b2f46ce798b8ca965a68004439c11
CRs-Fixed: 2809493
parent 5a770e47
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -190,12 +190,13 @@ int __hdd_hostapd_open (struct net_device *dev)
   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST,
                    pAdapter->sessionId, pAdapter->device_mode));
   if (NULL == pHddCtx)
   if (wlan_hdd_validate_context(pHddCtx))
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
         "%s: HDD context is Null", __func__);
         "%s: HDD context is Invalid", __func__);
      return -ENODEV;
   }

   status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
   while ( (NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status) )
   {
+2 −2
Original line number Diff line number Diff line
@@ -8235,10 +8235,10 @@ int __hdd_open(struct net_device *dev)
   pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
   MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST,
                    pAdapter->sessionId, pAdapter->device_mode));
   if (NULL == pHddCtx)
   if (wlan_hdd_validate_context(pHddCtx))
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
         "%s: HDD context is Null", __func__);
         "%s: HDD context is Invalid", __func__);
      return -ENODEV;
   }