From 14e043fbcfcfbafd8088bf65c74ad916c1bba755 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 13 Jun 2021 18:12:39 +0200 Subject: [PATCH] rsl_data_request() check lchan pointer before access fixup for commit 43aeeaf05ad814ccab0e93227b1248a20302c8ec 'RSL chan_nr: replace OSMO_ASSERT with error handling' I71ed6437c403a3f9336e17a94b4948fca295d853 Related: CID#236319 Related: SYS#5315 OS#4940 Change-Id: I873c1a27f9449a56c525984ea50bfcf6daa4b5f8 --- src/osmo-bsc/abis_rsl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index ac8006d33..7525e310c 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -939,11 +939,7 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci) /* Chapter 8.3.1 */ int rsl_data_request(struct msgb *msg, uint8_t link_id) { - int chan_nr = gsm_lchan2chan_nr(msg->lchan, true); - if (chan_nr < 0) { - msgb_free(msg); - return chan_nr; - } + int chan_nr; if (msg->lchan == NULL) { LOGP(DRSL, LOGL_ERROR, "cannot send DATA REQUEST to unknown lchan\n"); @@ -951,6 +947,12 @@ int rsl_data_request(struct msgb *msg, uint8_t link_id) return -EINVAL; } + chan_nr = gsm_lchan2chan_nr(msg->lchan, true); + if (chan_nr < 0) { + msgb_free(msg); + return chan_nr; + } + rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, chan_nr, link_id, 1); msg->dst = rsl_chan_link(msg->lchan);