diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 6e290ee4e..765211767 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -401,6 +401,13 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap) else /* u.act_req used by PRIM_INFO_{ACTIVATE,DEACTIVATE,MODIFY} */ chan_nr = l1sap->u.info.u.act_req.chan_nr; lchan = get_lchan_by_chan_nr(trx, chan_nr); + if (OSMO_UNLIKELY(lchan == NULL)) { + LOGP(DL1C, LOGL_ERROR, + "Rx MPH-INFO.req (type=0x%02x) for non-existent lchan (%s)\n", + l1sap->u.info.type, rsl_chan_nr_str(chan_nr)); + rc = -ENODEV; + break; + } switch (l1sap->u.info.type) { case PRIM_INFO_ACT_CIPH: diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c index e0536d326..235c39930 100644 --- a/src/osmo-bts-virtual/l1_if.c +++ b/src/osmo-bts-virtual/l1_if.c @@ -356,6 +356,13 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap) else /* u.act_req used by PRIM_INFO_{ACTIVATE,DEACTIVATE,MODIFY} */ chan_nr = l1sap->u.info.u.act_req.chan_nr; lchan = get_lchan_by_chan_nr(trx, chan_nr); + if (OSMO_UNLIKELY(lchan == NULL)) { + LOGP(DL1C, LOGL_ERROR, + "Rx MPH-INFO.req (type=0x%02x) for non-existent lchan (%s)\n", + l1sap->u.info.type, rsl_chan_nr_str(chan_nr)); + rc = -ENODEV; + break; + } switch (l1sap->u.info.type) { case PRIM_INFO_ACT_CIPH: