aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-06-13 18:12:39 +0200
committerneels <nhofmeyr@sysmocom.de>2021-06-18 09:58:14 +0000
commit14e043fbcfcfbafd8088bf65c74ad916c1bba755 (patch)
treec25d82d01e36d4422885ef49e51b81daee2af231
parent56c91b09b1a6dd48cbe85c5ebda37dbe248f4461 (diff)
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
-rw-r--r--src/osmo-bsc/abis_rsl.c12
1 files 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);