Преглед изворни кода

qcacld-3.0: Fix NULL pointer and uninitialization issues

Fix NULL pointer and uninitialization issues.

Change-Id: I757b3b408f9ddc8716366a757ea2bf2bb7126a38
CRs-Fixed: 2162258
Amar Singhal пре 7 година
родитељ
комит
4c3fbb400e
3 измењених фајлова са 25 додато и 6 уклоњено
  1. 4 3
      core/wma/src/wma_dev_if.c
  2. 7 1
      core/wma/src/wma_features.c
  3. 14 2
      core/wma/src/wma_main.c

+ 4 - 3
core/wma/src/wma_dev_if.c

@@ -3733,7 +3733,7 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	struct wma_vdev_start_req req;
 	struct wma_target_req *msg;
 	uint8_t vdev_id = 0, peer_id;
-	void *peer;
+	void *peer = NULL;
 	QDF_STATUS status;
 	struct wma_txrx_node *iface;
 	int pps_val = 0;
@@ -4007,8 +4007,9 @@ send_final_rsp:
 	return;
 
 peer_cleanup:
-	wma_remove_peer(wma, add_bss->bssId, vdev_id, peer,
-			roam_synch_in_progress);
+	if (peer)
+		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer,
+				roam_synch_in_progress);
 send_fail_resp:
 	add_bss->status = QDF_STATUS_E_FAILURE;
 	if (!wma_is_roam_synch_in_progress(wma, vdev_id))

+ 7 - 1
core/wma/src/wma_features.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1228,6 +1228,12 @@ void wma_check_and_set_wake_timer(uint32_t time)
 	struct wma_txrx_node *iface;
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
+	if (!wma) {
+		WMA_LOGE("%s: WMA is closed",
+			__func__);
+		return;
+	}
+
 	if (!WMI_SERVICE_EXT_IS_ENABLED(wma->wmi_service_bitmap,
 		wma->wmi_service_ext_bitmap,
 		WMI_SERVICE_WOW_WAKEUP_BY_TIMER_PATTERN)) {

+ 14 - 2
core/wma/src/wma_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -5517,6 +5517,11 @@ bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel)
 	enum cds_band_type band;
 	bool status;
 
+	if (!wma_handle) {
+		WMA_LOGE("Invalid wma handle");
+		return false;
+	}
+
 	if (!WLAN_REG_IS_24GHZ_CH(channel))
 		band = CDS_BAND_5GHZ;
 	else
@@ -5882,7 +5887,14 @@ static void wma_init_wifi_pos_dma_rings(t_wma_handle *wma_handle,
 					uint8_t num_mac, void *buf)
 {
 	struct hif_softc *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
-	void *hal_soc = hif_get_hal_handle(hif_ctx);
+	void *hal_soc;
+
+	if (!hif_ctx) {
+		WMA_LOGE("invalid hif context");
+		return;
+	}
+
+	hal_soc = hif_get_hal_handle(hif_ctx);
 
 	wifi_pos_init_cir_cfr_rings(wma_handle->psoc, hal_soc, num_mac, buf);
 }