Fix for segfault caused by freed csi_MeasConfig

This commit is contained in:
francescomani
2025-12-03 13:30:42 +01:00
committed by Robert Schmidt
parent 0e7e030907
commit aa7d3668e3
3 changed files with 11 additions and 5 deletions
@@ -3922,7 +3922,7 @@ bool nr_mac_check_ul_failure(gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ctrl_t *
return false;
}
void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE, int new_bwp_id)
void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, NR_UE_info_t *UE, int new_bwp_id)
{
DevAssert(UE->CellGroup != NULL);
NR_CellGroupConfig_t *cellGroup_for_UE = NULL;
@@ -3930,7 +3930,8 @@ void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_
AssertFatal(UE->current_DL_BWP.bwp_id == UE->current_UL_BWP.bwp_id, "We only support same BWP for UL and DL\n");
if (new_bwp_id == UE->current_DL_BWP.bwp_id)
LOG_E(NR_MAC, "Source BWP ID and target BWP ID are the same, can't perform switch\n");
else
else {
UE->sc_info.csi_MeasConfig = NULL; // to avoid segfault when freeing csi_MeasConfig in configDedicated
cellGroup_for_UE = update_cellGroupConfig_for_BWP_switch(UE->CellGroup,
&nrmac->radio_config,
UE->capability,
@@ -3938,6 +3939,7 @@ void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_
UE->uid,
UE->current_DL_BWP.bwp_id,
new_bwp_id);
}
}
uint8_t buf[2048];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
+1 -1
View File
@@ -478,7 +478,7 @@ void nr_mac_trigger_ul_failure(NR_UE_sched_ctrl_t *sched_ctrl, NR_SubcarrierSpac
void nr_mac_reset_ul_failure(NR_UE_sched_ctrl_t *sched_ctrl);
bool nr_mac_check_ul_failure(gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ctrl_t *sched_ctrl);
void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE, int new_bwp_id);
void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, NR_UE_info_t *UE, int new_bwp_id);
bool nr_mac_add_lcid(NR_UE_sched_ctrl_t *sched_ctrl, const nr_lc_config_t *c);
nr_lc_config_t *nr_mac_get_lc_config(NR_UE_sched_ctrl_t* sched_ctrl, int lcid);
+6 -2
View File
@@ -3367,10 +3367,14 @@ static NR_CSI_MeasConfig_t *get_csiMeasConfig(const NR_ServingCellConfig_t *conf
pdsch_Config = configDedicated->initialDownlinkBWP->pdsch_Config;
curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
} else {
NR_BWP_Downlink_t *bwp = configDedicated->downlinkBWP_ToAddModList->list.array[0];
NR_BWP_Downlink_t *bwp = NULL;
for (int i = 0; i < configDedicated->downlinkBWP_ToAddModList->list.count; i++) {
if (bwp_id == configDedicated->downlinkBWP_ToAddModList->list.array[i]->bwp_Id)
bwp = configDedicated->downlinkBWP_ToAddModList->list.array[i];
}
AssertFatal(bwp, "BWP ID doesn't match\n");
pdsch_Config = bwp->bwp_Dedicated->pdsch_Config;
curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
AssertFatal(bwp_id == bwp->bwp_Id, "BWP ID doesn't match\n");
}
const int pdsch_AntennaPorts =