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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Thu Nov 15 16:01:41 UTC 2018


Stefan Sperling has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/83/11783/1

diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index f682ffd..8657b79 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 -EAGAIN;
+	}
 	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: newchange
Gerrit-Change-Id: I5671ca364f31d98f2b28d028e7bf1797386de2ec
Gerrit-Change-Number: 11783
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181115/063da3bc/attachment.htm>


More information about the gerrit-log mailing list