From 8534982afe687443e87d5e2e3aa5e23ea82e0093 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 6 Sep 2018 16:42:10 +0200
Subject: [PATCH] bugfix: check that we are manipulating the structure for the
 correct RNTI

The bug popped up when one UE was doing TCP UL iperf and a second UE
attempted to connect. A crash of the eNB happened because we changed
the wrong NFAPI structure in a TTI where both UEs are scheduled.

Something like that.
---
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index f48cf50bce..16673b5c33 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -1514,7 +1514,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
             ul_req_index = 0;
             dlsch_flag = 0;
             for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
-              if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
+              if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE &&
+                 ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti){
                 dlsch_flag = 1;
                 LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
                 break;
@@ -1602,7 +1603,8 @@ schedule_ulsch_rnti(module_id_t module_idP,
             ul_req_index = 0;
             dlsch_flag = 0;
             for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
-              if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
+              if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE &&
+                 ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti){
                 dlsch_flag = 1;
                 LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
                 break;
-- 
GitLab