From 81016f545520de13e92d0a88de1fd4914135237b Mon Sep 17 00:00:00 2001 From: Vinod Kumar Myadam Date: Tue, 27 Jun 2023 17:12:53 +0530 Subject: [PATCH] qcacld-3.0: Fix to accessing NULL pointer From userspace __wlan_hdd_cfg80211_get_usable_channel got called while WLAN is shutting down. HDD/OSIF should return failure but the reg_get_band_channel_list API is trying to access the pdev context from HDD which is NULL and leads to crash. Add check in __wlan_hdd_cfg80211_get_usable_channel if the wlan is shutdown with state DRIVER_MODULES_CLOSED and return. Change-Id: I856075d00f3ee2ed84f4b63c33a2a8ffb85ae646 CRs-Fixed: 3541271 --- drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c index 8531cf162dc0..25fb1a8edbc0 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c @@ -15570,6 +15570,11 @@ static int __wlan_hdd_cfg80211_get_usable_channel(struct wiphy *wiphy, if (0 != ret) return ret; + if (hdd_ctx->driver_status == DRIVER_MODULES_CLOSED) { + hdd_err("Driver Modules are closed"); + return -EINVAL; + } + res_msg = qdf_mem_malloc(NUM_CHANNELS * sizeof(*res_msg));