From bd9973a64f0a3eafbb46929a4829ffaf48b8a3bb Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 22 Sep 2020 15:57:37 +0200 Subject: [PATCH] Free all MS TBFs when receiving GPRS Suspension Request Otherwise the TBFs are kept, and hence PCU will continue reserving resources and DL data queued will still be sent over the air, despite the MS not listening anymore on the PDCH. Change-Id: I4ae1c3706b2ed6e4d271cd16f7cd7f8937b84836 --- src/pcu_l1_if.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 21eacfdb..535fb705 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -49,6 +49,8 @@ extern "C" { #include #include #include +#include +#include // FIXME: move this, when changed from c++ to c. extern "C" { @@ -730,7 +732,11 @@ static int pcu_rx_pag_req(struct gsm_pcu_if_pag_req *pag_req) static int pcu_rx_susp_req(struct gsm_pcu_if_susp_req *susp_req) { + BTS *bts = BTS::main_bts(); struct bssgp_bvc_ctx *bctx = gprs_bssgp_pcu_current_bctx(); + GprsMs *ms; + struct gprs_rlcmac_dl_tbf *dl_tbf; + struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_ra_id ra_id; gsm48_parse_ra(&ra_id, susp_req->ra_id); @@ -738,6 +744,17 @@ static int pcu_rx_susp_req(struct gsm_pcu_if_susp_req *susp_req) LOGP(DL1IF, LOGL_INFO, "GPRS Suspend request received: TLLI=0x%08x RAI=%s\n", susp_req->tlli, osmo_rai_name(&ra_id)); + if ((ms = bts->ms_store().get_ms(susp_req->tlli))) { + /* We need to catch both pointers here since MS may become freed + after first tbf_free(dl_tbf) if only DL TBF was available */ + dl_tbf = ms->dl_tbf(); + ul_tbf = ms->ul_tbf(); + if (dl_tbf) + tbf_free(dl_tbf); + if (ul_tbf) + tbf_free(ul_tbf); + } + if (!bctx) return -1;