fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30329 )
Change subject: mobile: gsm48_rr_set_mode(): check rc of rsl_dec_chan_nr() ......................................................................
mobile: gsm48_rr_set_mode(): check rc of rsl_dec_chan_nr()
The rsl_dec_chan_nr() may fail to decode RSL channel number, so the 'ch_type' variable would be uninitialized. Let's check rc.
Change-Id: I9ab18bdaf41a29fcd32a7060668ef9db07b8cf7e Related: OS#5599 --- M src/host/layer23/src/mobile/gsm48_rr.c 1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/29/30329/1
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 6092835..e7722f1 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -3427,9 +3427,16 @@ { struct gsm48_rrlayer *rr = &ms->rrlayer; uint8_t ch_type, ch_subch, ch_ts; + int rc; + + /* Decode RSL channel number */ + rc = rsl_dec_chan_nr(chan_nr, &ch_type, &ch_subch, &ch_ts); + if (rc) { + LOGP(DRR, LOGL_ERROR, "Couldn't decode RSL channel number\n"); + return -EINVAL; + }
/* only apply mode to TCH/F or TCH/H */ - rsl_dec_chan_nr(chan_nr, &ch_type, &ch_subch, &ch_ts); if (ch_type != RSL_CHAN_Bm_ACCHs && ch_type != RSL_CHAN_Lm_ACCHs) return -ENOTSUP;