Change in osmo-bts[master]: trx_if: Allow calling trx_if_flush/close from within TRXC callback

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

pespin gerrit-no-reply at lists.osmocom.org
Thu Sep 23 09:59:29 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25517 )

Change subject: trx_if: Allow calling trx_if_flush/close from within TRXC callback
......................................................................

trx_if: Allow calling trx_if_flush/close from within TRXC callback

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

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index bfeb2ec..533f7c8 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -707,6 +707,13 @@
 
 	rsp.cb = tcm->cb;
 
+	/* Remove command from list, save it to last_acked and remove previous
+	 * last_acked. Do it before calling callback to avoid user freeing tcm
+	 * pointer if flushing/closing the iface. */
+	llist_del(&tcm->list);
+	talloc_free(l1h->last_acked);
+	l1h->last_acked = tcm;
+
 	/* check for response code */
 	rc = trx_ctrl_rx_rsp(l1h, &rsp, tcm);
 	if (rc == -EINVAL)
@@ -714,15 +721,11 @@
 
 	/* re-schedule last cmd in rc seconds time */
 	if (rc > 0) {
-		osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0);
+		if (!llist_empty(&l1h->trx_ctrl_list))
+			osmo_timer_schedule(&l1h->trx_ctrl_timer, rc, 0);
 		return 0;
 	}
 
-	/* remove command from list, save it to last_acked and removed previous last_acked */
-	llist_del(&tcm->list);
-	talloc_free(l1h->last_acked);
-	l1h->last_acked = tcm;
-
 	trx_ctrl_send(l1h);
 
 	return 0;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic3baa95ffe4e6ca95c6d02276ea8eb0cb9fa0064
Gerrit-Change-Number: 25517
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210923/611a3cb6/attachment.htm>


More information about the gerrit-log mailing list