Change in osmo-bts[master]: osmo-bts-trx: fix segfault on trx_phy_inst_open() failure

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Thu Mar 18 07:46:00 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/23399 )


Change subject: osmo-bts-trx: fix segfault on trx_phy_inst_open() failure
......................................................................

osmo-bts-trx: fix segfault on trx_phy_inst_open() failure

If for whatever reason it fails to initialize the TRXD or TRXC
interface, trx_phy_inst_open() would return an error.  This
would cause bts_model_phy_link_open() to call trx_if_close()
on each of the PHY links, including those that were never
opened.  This leads to a segfault in trx_if_close().

Make sure that in trx_if_init() we properly init 'struct trx_l1h',
so it's safe to call trx_if_close() at any time and in any state.

Change-Id: I1f128813528f505fede04799e84456f6271058d0
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 6 insertions(+), 3 deletions(-)



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

diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index c6701cb..2e97319 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -193,6 +193,12 @@
 {
 	l1h->trx_ctrl_timer.cb = trx_ctrl_timer_cb;
 	l1h->trx_ctrl_timer.data = l1h;
+
+	/* initialize ctrl queue */
+	INIT_LLIST_HEAD(&l1h->trx_ctrl_list);
+
+	l1h->trx_ofd_ctrl.fd = -1;
+	l1h->trx_ofd_data.fd = -1;
 }
 
 /*! Send a new TRX control command.
@@ -1215,9 +1221,6 @@
 
 	LOGPPHI(l1h->phy_inst, DTRX, LOGL_NOTICE, "Open transceiver\n");
 
-	/* initialize ctrl queue */
-	INIT_LLIST_HEAD(&l1h->trx_ctrl_list);
-
 	/* open sockets */
 	rc = trx_udp_open(l1h, &l1h->trx_ofd_ctrl,
 			  plink->u.osmotrx.local_ip,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23399
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I1f128813528f505fede04799e84456f6271058d0
Gerrit-Change-Number: 23399
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210318/a8cc54b8/attachment.htm>


More information about the gerrit-log mailing list