osmo-bts-{trx,virtual}: check lchan against NULL in bts_model_l1sap_down()

Even though it's unlikely, get_lchan_by_chan_nr() *may* return NULL.

Change-Id: I1a815c9675eebc16640b62308499dd784fc206bd
Related: OS#1572
This commit is contained in:
Vadim Yanitskiy 2023-03-06 02:32:55 +07:00 committed by fixeria
parent 54840a203b
commit 69bca44a84
2 changed files with 14 additions and 0 deletions

View File

@ -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:

View File

@ -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: