From fc2ff394e0a1b2325bdadaa0699bf8e8d0c716bb Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Thu, 15 Nov 2018 16:58:22 +0100 Subject: 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 --- src/osmo-bts-sysmo/l1_if.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3