Add check to ensure context pointer is not NULL before dereferencing Change-Id: I737ae4d1e5aa07bcbbe612a93905a23fa857b90a CRs-fixed: 2669214
@@ -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");