Change in osmo-bts[master]: add missing check of osmo_wqueue_enqueue() return value

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Mon Nov 19 12:05:17 UTC 2018


Stefan Sperling has submitted this change and it was merged. ( https://gerrit.osmocom.org/11783 )

Change subject: add missing check of osmo_wqueue_enqueue() return value
......................................................................

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
---
M src/osmo-bts-sysmo/l1_if.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index f682ffd..87cf25a 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -549,7 +549,11 @@
 		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

-- 
To view, visit https://gerrit.osmocom.org/11783
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5671ca364f31d98f2b28d028e7bf1797386de2ec
Gerrit-Change-Number: 11783
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181119/ce7e3562/attachment.html>


More information about the gerrit-log mailing list