[MERGED] libosmocore[master]: fsm: fix double llist_del in osmo_fsm_inst_term()

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 17 13:33:28 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: fsm: fix double llist_del in osmo_fsm_inst_term()
......................................................................


fsm: fix double llist_del in osmo_fsm_inst_term()

llist_del(&fi->proc.child) is executed always, regardless whether
a parent is configured or not. This may lead into a double llist_del
when the child has been previously unlinked.

- check if fi->proc.parent is set, and only then execute
  llist_del(&fi->proc.child);

Change-Id: I4b33d508c8a11b72fbf30125088a882894d9e6ac
---
M src/fsm.c
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/fsm.c b/src/fsm.c
index 0bdcd9d..f9effc4 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -483,10 +483,11 @@
 
 	/* delete ourselves from the parent */
 	parent = fi->proc.parent;
-	if (parent)
+	if (parent) {
 		LOGPFSMSRC(fi, file, line, "Removing from parent %s\n",
 			   osmo_fsm_inst_name(parent));
-	llist_del(&fi->proc.child);
+		llist_del(&fi->proc.child);
+	}
 
 	/* call destructor / clean-up function */
 	if (fi->fsm->cleanup)

-- 
To view, visit https://gerrit.osmocom.org/5831
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4b33d508c8a11b72fbf30125088a882894d9e6ac
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list