fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/31671 )

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

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
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
2 files changed, 26 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 6e290ee..7652117 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -401,6 +401,13 @@
                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 e0536d3..235c399 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -356,6 +356,13 @@
                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:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/31671
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I1a815c9675eebc16640b62308499dd784fc206bd
Gerrit-Change-Number: 31671
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to