From 92ab495e37c8a3596c1d6a67a5448f499dab6f3d Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Wed, 22 Apr 2020 15:42:57 -0700 Subject: [PATCH] qcacld-3.0: Fix potential NULL pointer dereference Add check to ensure context pointer is not NULL before dereferencing Change-Id: I737ae4d1e5aa07bcbbe612a93905a23fa857b90a CRs-fixed: 2669214 --- core/sap/src/sap_module.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index e2ede6d9157a..26cdb601c18e 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -3004,6 +3004,11 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx) return 0; mac = cds_get_context(QDF_MODULE_ID_PE); + if (!mac) { + sap_err("Invalid MAC context"); + return 0; + } + if (ucfg_reg_get_curr_band(mac->pdev, &band) != QDF_STATUS_SUCCESS) { sap_err("Failed to get current band config"); return 0;