From 75be2a1a5957da991adf2cb531e62ff53b249a44 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 May 2025 12:53:14 +0200 Subject: [PATCH] When freeing UE contexts, check in both possible lists --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index e398da1eaf..698986354a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -2242,7 +2242,7 @@ void nr_release_ra_UE(gNB_MAC_INST *mac, rnti_t rnti) if (UE) { delete_nr_ue_data(UE, mac->common_channels, &UE_info->uid_allocator); } else { - LOG_W(NR_MAC,"Call to del rnti %04x, but not existing\n", rnti); + LOG_W(NR_MAC,"Call to release RA UE with rnti %04x, but not existing\n", rnti); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index a447d9f91c..898722342b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2621,6 +2621,8 @@ NR_UE_info_t *remove_UE_from_list(int list_size, NR_UE_info_t *list[list_size], { for (int i = 0; i < list_size; i++) { NR_UE_info_t *curr_UE = list[i]; + if (!curr_UE) + break; /* reached the end of the list */ if (curr_UE->rnti != rnti) continue; @@ -2629,7 +2631,6 @@ NR_UE_info_t *remove_UE_from_list(int list_size, NR_UE_info_t *list[list_size], list[list_size - 1] = NULL; return curr_UE; } - LOG_E(NR_MAC, "UE %04x to be removed not found in list\n", rnti); return NULL; } @@ -2735,8 +2736,10 @@ void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti) NR_SCHED_LOCK(&UE_info->mutex); NR_UE_info_t *UE = remove_UE_from_list(MAX_MOBILES_PER_GNB + 1, UE_info->connected_ue_list, rnti); NR_SCHED_UNLOCK(&UE_info->mutex); - - delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator); + if (UE) + delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator); + else + nr_release_ra_UE(nr_mac, rnti); } // all values passed to this function are in dB x10