Просмотр исходного кода

qcacld-3.0: Fix OOB read in scan_id get

In wma_extscan_find_unique_scan_ids() the TLV structures
for param_buf are pulled from the WMI message.
wma_extscan_find_unique_scan_ids parses the data (param_buf)
which is obtained from the firmware.
This parsing logic of rssi_list does not consider the
size of the list and thus results in an OOB access.

Fix is loop for the num_rssi_list and not the num of entries

Change-Id: Icf79b59a17b66ac858222b79589641787022572d
CRs-Fixed: 2316805
gaurank kathpalia 6 лет назад
Родитель
Сommit
e5f6690a60
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      core/wma/src/wma_scan_roam.c

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

@@ -3973,7 +3973,7 @@ static int wma_extscan_find_unique_scan_ids(const u_int8_t *cmd_param_info)
 	/* Find the unique number of scan_id's for grouping */
 	prev_scan_id = src_rssi->scan_cycle_id;
 	scan_ids_cnt = 1;
-	for (i = 1; i < event->num_entries_in_page; i++) {
+	for (i = 1; i < param_buf->num_rssi_list; i++) {
 		src_rssi++;
 
 		if (prev_scan_id != src_rssi->scan_cycle_id) {
@@ -4017,7 +4017,7 @@ static int wma_fill_num_results_per_scan_id(const u_int8_t *cmd_param_info,
 	t_scan_id_grp->flags = src_rssi->flags;
 	t_scan_id_grp->buckets_scanned = src_rssi->buckets_scanned;
 	t_scan_id_grp->num_results = 1;
-	for (i = 1; i < event->num_entries_in_page; i++) {
+	for (i = 1; i < param_buf->num_rssi_list; i++) {
 		src_rssi++;
 		if (prev_scan_id == src_rssi->scan_cycle_id) {
 			t_scan_id_grp->num_results++;
@@ -4090,7 +4090,8 @@ static int wma_group_num_bss_to_scan_id(const u_int8_t *cmd_param_info,
 		}
 
 		ap = &t_scan_id_grp->ap[0];
-		for (j = 0; j < t_scan_id_grp->num_results; j++) {
+		for (j = 0; j < QDF_MIN(t_scan_id_grp->num_results,
+					param_buf->num_bssid_list); j++) {
 			ap->channel = src_hotlist->channel;
 			ap->ts = WMA_MSEC_TO_USEC(src_rssi->tstamp);
 			ap->rtt = src_hotlist->rtt;