rsl_data_request() check lchan pointer before access

fixup for commit 43aeeaf05a
'RSL chan_nr: replace OSMO_ASSERT with error handling'
I71ed6437c403a3f9336e17a94b4948fca295d853

Related: CID#236319
Related: SYS#5315 OS#4940
Change-Id: I873c1a27f9449a56c525984ea50bfcf6daa4b5f8
This commit is contained in:
Neels Hofmeyr 2021-06-13 18:12:39 +02:00 committed by neels
parent 56c91b09b1
commit 14e043fbcf
1 changed files with 7 additions and 5 deletions

View File

@ -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);