From jerlbeck at sysmocom.de Fri May 22 09:11:20 2015 From: jerlbeck at sysmocom.de (Jacob Erlbeck) Date: Fri, 22 May 2015 11:11:20 +0200 Subject: [PATCH 1/3] write_queue: Check the result of osmo_wqueue_enqueue and free In-Reply-To: <1432262554-6455-1-git-send-email-holger@moiji-mobile.com> References: <1432262554-6455-1-git-send-email-holger@moiji-mobile.com> Message-ID: <555EF2B8.6030206@sysmocom.de> Hi Holger, The three patches look good and I have pushed them to master. Jacob -- - Jacob Erlbeck http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte From holger at moiji-mobile.com Fri May 22 02:50:36 2015 From: holger at moiji-mobile.com (Holger Hans Peter Freyther) Date: Fri, 22 May 2015 02:50:36 -0000 Subject: [PATCH 2/2] misc: Update the email address to point to the current ML In-Reply-To: <1432262614-6849-1-git-send-email-holger@moiji-mobile.com> References: <1432262614-6849-1-git-send-email-holger@moiji-mobile.com> Message-ID: <1432262614-6849-2-git-send-email-holger@moiji-mobile.com> We have unified all PS related communication to the osmocom-net-gprs mailinglist, update configure.ac to point there. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3b2f380..876f7d4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script AC_INIT([osmo-pcu], m4_esyscmd([./git-version-gen .tarball-version]), - [osmocom-pcu at lists.osmocom.org]) + [osmocom-net-gprs at lists.osmocom.org]) AM_INIT_AUTOMAKE([dist-bzip2]) AC_CONFIG_TESTDIR(tests) -- 2.3.5 From holger at moiji-mobile.com Fri May 22 02:50:36 2015 From: holger at moiji-mobile.com (Holger Hans Peter Freyther) Date: Fri, 22 May 2015 02:50:36 -0000 Subject: [PATCH 1/3] write_queue: Check the result of osmo_wqueue_enqueue and free Message-ID: <1432262554-6455-1-git-send-email-holger@moiji-mobile.com> The write_queue is designed to have a maximum amount of pending messages and will refuse to take new messages when it has been reached. The caller can decide if it wants to flush the queue and add the message again, create a log. But in all cases the ownership of the msgb has not been transferred. Fix the potential memory leak in the failure situation. --- src/openbts_sock.cpp | 5 ++++- src/sysmo_l1_if.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/openbts_sock.cpp b/src/openbts_sock.cpp index 2d9cae4..5e6f16c 100644 --- a/src/openbts_sock.cpp +++ b/src/openbts_sock.cpp @@ -79,7 +79,10 @@ struct l1fwd_hdl *l1fh = talloc_zero(NULL, struct l1fwd_hdl); int pcu_sock_send(struct msgb *msg) { - osmo_wqueue_enqueue(&l1fh->udp_wq, msg); + if (osmo_wqueue_enqueue(&l1fh->udp_wq, msg) != 0) { + LOGP(DPCU, LOGL_ERROR, "PCU write queue full. Dropping message.\n"); + msgb_free(msg); + } return 0; } diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c index bef680e..c0721b8 100644 --- a/src/sysmo_l1_if.c +++ b/src/sysmo_l1_if.c @@ -36,7 +36,10 @@ static int l1if_req_pdch(struct femtol1_hdl *fl1h, struct msgb *msg) { struct osmo_wqueue *wqueue = &fl1h->write_q[MQ_PDTCH_WRITE]; - osmo_wqueue_enqueue(wqueue, msg); + if (osmo_wqueue_enqueue(wqueue, msg) != 0) { + LOGP(DL1IF, LOGL_ERROR, "PDTCH queue full. dropping message.\n"); + msgb_free(msg); + } return 0; } @@ -324,7 +327,10 @@ int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn, /* transmit */ - osmo_wqueue_enqueue(&fl1h->write_q[MQ_PDTCH_WRITE], msg); + if (osmo_wqueue_enqueue(&fl1h->write_q[MQ_PDTCH_WRITE], msg) != 0) { + LOGP(DL1IF, LOGL_ERROR, "PDTCH queue full. dropping message.\n"); + msgb_free(msg); + } return 0; } -- 2.3.5 From holger at moiji-mobile.com Fri May 22 02:50:36 2015 From: holger at moiji-mobile.com (Holger Hans Peter Freyther) Date: Fri, 22 May 2015 02:50:36 -0000 Subject: [PATCH 1/2] llist: Reduce the external dependencies of this test Message-ID: <1432262614-6849-1-git-send-email-holger@moiji-mobile.com> Debian is using the classic bfd linker and when passing libosmogb as link dependency it always wants/needs to resolve the bssgp_prim_cb symbol (which is to be provided by the application). Only keep the libosmocore dependency. Fixes: lib/libosmogb.so: undefined reference to `bssgp_prim_cb' collect2: error: ld returned 1 exit status Makefile:511: recipe for target 'llist/LListTest' failed --- tests/Makefile.am | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index b822e46..77760f3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -56,9 +56,6 @@ ms_MsTest_LDFLAGS = \ llist_LListTest_SOURCES = llist/LListTest.cpp llist_LListTest_LDADD = \ - $(top_builddir)/src/libgprs.la \ - $(LIBOSMOGB_LIBS) \ - $(LIBOSMOGSM_LIBS) \ $(LIBOSMOCORE_LIBS) \ $(COMMON_LA) -- 2.3.5