aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-11-15 16:58:22 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-11-19 12:21:05 +0100
commitfc2ff394e0a1b2325bdadaa0699bf8e8d0c716bb (patch)
treea75d495ace4c9edc1e171bea02762ea297339963
parent20284c4dbcf62e04cd53543fdd0779b6a10e3cff (diff)
add missing check of osmo_wqueue_enqueue() return value
The return value of osmo_wqueue_enqueue() isn't checked. This can result in a memory leak if the message cannot be enqueued. Log an error an free the message upon failure, as done elsewhere. Change-Id: I5671ca364f31d98f2b28d028e7bf1797386de2ec Related: CID#57662
-rw-r--r--src/osmo-bts-sysmo/l1_if.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index f682ffdd..87cf25a0 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -549,7 +549,11 @@ static int ph_tch_req(struct gsm_bts_trx *trx, struct msgb *msg,
empty_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr);
}
/* send message to DSP's queue */
- osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg);
+ if (osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg) != 0) {
+ LOGPFN(DL1P, LOGL_ERROR, u32Fn, "MQ_L1_WRITE queue full. Dropping msg.\n");
+ msgb_free(nmsg);
+ return -ENOBUFS;
+ }
if (dtx_is_first_p1(lchan))
dtx_dispatch(lchan, E_FIRST);
else