Преглед на файлове

qcacld-3.0: Fix null ptr dereference in hdd_set_power_save_offload_config

Currently, hdd_set_power_save_offload_config does not do null validation
for power usage before string comparison which can lead to null pointer
derefrence.

Add null pointer check for power usage in
hdd_set_power_save_offload_config.

Change-Id: I91eba2f5eb27aebf7451be58a6744634aaebd184
CRs-Fixed: 2423777
sheenam monga преди 6 години
родител
ревизия
70a83dacbf
променени са 1 файла, в които са добавени 9 реда и са изтрити 2 реда
  1. 9 2
      core/hdd/src/wlan_hdd_cfg.c

+ 9 - 2
core/hdd/src/wlan_hdd_cfg.c

@@ -561,11 +561,18 @@ static QDF_STATUS hdd_apply_cfg_ini(struct hdd_context *hdd_ctx,
 static void hdd_set_power_save_offload_config(struct hdd_context *hdd_ctx)
 {
 	uint32_t listen_interval = 0;
+	char *power_usage = NULL;
 
-	if (strcmp(ucfg_mlme_get_power_usage(hdd_ctx->psoc), "Min") == 0)
+	power_usage = ucfg_mlme_get_power_usage(hdd_ctx->psoc);
+	if (!power_usage) {
+		hdd_err("invalid power usage");
+		return;
+	}
+
+	if (strcmp(power_usage, "Min") == 0)
 		ucfg_mlme_get_bmps_min_listen_interval(hdd_ctx->psoc,
 						       &listen_interval);
-	else if (strcmp(ucfg_mlme_get_power_usage(hdd_ctx->psoc), "Max") == 0)
+	else if (strcmp(power_usage, "Max") == 0)
 		ucfg_mlme_get_bmps_max_listen_interval(hdd_ctx->psoc,
 						       &listen_interval);
 	/*