From 942799962e7792fb3cb7f6deefc8f3893e23cf45 Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Tue, 7 Jul 2020 13:32:09 -0700 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_power.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 31cefedba3b0..2065adc0c92d 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/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;