Ver Fonte

qcacld-3.0: Check for NULL pointer before de-referencing it

Pointer 'hif_ctx' returned from call to function 'cds_get_context'
may be NULL. Check for NULL pointer before de-referencing it.

Change-Id: I9d34d877783b35829faf2049c3c8c43519e12914
CRs-Fixed: 2726468
Srinivas Girigowda há 4 anos atrás
pai
commit
942799962e
1 ficheiros alterados com 6 adições e 0 exclusões
  1. 6 0
      core/hdd/src/wlan_hdd_power.c

+ 6 - 0
core/hdd/src/wlan_hdd_power.c

@@ -1778,6 +1778,9 @@ static int _wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
 	}
 
 	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (!hif_ctx)
+		return -EINVAL;
+
 	errno = __wlan_hdd_cfg80211_resume_wlan(wiphy);
 	hif_pm_runtime_put(hif_ctx, RTPM_ID_SUSPEND_RESUME);
 
@@ -2014,6 +2017,9 @@ static int _wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 	}
 
 	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (!hif_ctx)
+		return -EINVAL;
+
 	errno = hif_pm_runtime_get_sync(hif_ctx, RTPM_ID_SUSPEND_RESUME);
 	if (errno)
 		return errno;