From 77c585cd28a4f9a5ed59f8bfd86ec8e0faeebd56 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 13 Dec 2023 12:22:53 +0100 Subject: [PATCH] discard pdu if TBS is null --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 ++++++++++ openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 1f76ef2825..202746ef26 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -707,6 +707,11 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id, dlsch_pdu->ldpcBaseGraph = get_BG(dlsch_pdu->TBS, dlsch_pdu->targetCodeRate); + if (dlsch_pdu->TBS == 0) { + LOG_E(MAC, "Invalid TBS = 0. Probably caused by missed detection of DCI\n"); + return -1; + } + int bw_tbslbrm = current_DL_BWP ? mac->sc_info.dl_bw_tbslbrm : dlsch_pdu->BWPSize; dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, 1); @@ -1136,6 +1141,11 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id, dlsch_pdu->ldpcBaseGraph = get_BG(dlsch_pdu->TBS, dlsch_pdu->targetCodeRate); + if (dlsch_pdu->TBS == 0) { + LOG_E(MAC, "Invalid TBS = 0. Probably caused by missed detection of DCI\n"); + return -1; + } + // TBS_LBRM according to section 5.4.2.1 of 38.212 AssertFatal(sc_info->maxMIMO_Layers_PDSCH != NULL, "Option with max MIMO layers not configured is not supported\n"); int nl_tbslbrm = *sc_info->maxMIMO_Layers_PDSCH < 4 ? *sc_info->maxMIMO_Layers_PDSCH : 4; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 354d6f0b88..93131212fd 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -739,7 +739,14 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->target_code_rate = mac->ul_harq_info[pid].R; pusch_config_pdu->pusch_data.tb_size = mac->ul_harq_info[pid].TBS; } + pusch_config_pdu->ldpcBaseGraph = get_BG(pusch_config_pdu->pusch_data.tb_size << 3, pusch_config_pdu->target_code_rate); + + if (pusch_config_pdu->pusch_data.tb_size == 0) { + LOG_E(MAC, "Invalid TBS = 0. Probably caused by missed detection of DCI\n"); + return -1; + } + return 0; }