Change in osmo-sgsn[master]: llme_free: clean up related sndcp

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

laforge gerrit-no-reply at lists.osmocom.org
Wed Dec 8 08:05:40 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/26462 )

Change subject: llme_free: clean up related sndcp
......................................................................

llme_free: clean up related sndcp

Fix crash in vty_dump_sne when sndcp->lle has already been deallocated.

Context:
* sndcp->lle is set only once in gprs_sndcp_entity_alloc()
* sndcp->lle is a struct gprs_llc_lle, which gets allocated and
  deallocated together with struct gprs_llc_llme. From gprs_llc.h:

    struct gprs_llc_llme {
            ...
            struct gprs_llc_lle lle[NUM_SAPIS];

Fixes: OS#4824
Change-Id: I707029f78222bc6335837241e5a08c54c5ae6eb3
---
M include/osmocom/sgsn/gprs_sndcp.h
M src/sgsn/gprs_llc.c
M src/sgsn/gprs_sndcp.c
3 files changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/include/osmocom/sgsn/gprs_sndcp.h b/include/osmocom/sgsn/gprs_sndcp.h
index d970240..5334d92 100644
--- a/include/osmocom/sgsn/gprs_sndcp.h
+++ b/include/osmocom/sgsn/gprs_sndcp.h
@@ -76,4 +76,7 @@
 		      struct gprs_llc_xid_field *xid_field_request,
 		      struct gprs_llc_lle *lle);
 
+/* Clean up all gprs_sndcp_entities related to llme (OS#4824) */
+void gprs_sndcp_sm_deactivate_ind_by_llme(struct gprs_llc_llme *llme);
+
 #endif	/* INT_SNDCP_H */
diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c
index eea1cec..453ded5 100644
--- a/src/sgsn/gprs_llc.c
+++ b/src/sgsn/gprs_llc.c
@@ -590,6 +590,7 @@
 
 static void llme_free(struct gprs_llc_llme *llme)
 {
+	gprs_sndcp_sm_deactivate_ind_by_llme(llme);
 	gprs_sndcp_comp_free(llme->comp.proto);
 	gprs_sndcp_comp_free(llme->comp.data);
 	llist_del(&llme->list);
diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c
index 6692f1a..d8982ac 100644
--- a/src/sgsn/gprs_sndcp.c
+++ b/src/sgsn/gprs_sndcp.c
@@ -544,6 +544,20 @@
 	return 0;
 }
 
+/* Clean up all gprs_sndcp_entities related to llme (OS#4824) */
+void gprs_sndcp_sm_deactivate_ind_by_llme(struct gprs_llc_llme *llme)
+{
+	struct gprs_sndcp_entity *sne, *sne2;
+
+	llist_for_each_entry_safe(sne, sne2, &gprs_sndcp_entities, list) {
+		if (sne->lle->llme == llme) {
+			LOGP(DSNDCP, LOGL_INFO, "SNSM-DEACTIVATE.ind for SNDCP attached to llme=%p\n", llme);
+			/* Free and remove from list */
+			sndcp_sm_deactivate_ind(sne->lle, sne->nsapi);
+		}
+	}
+}
+
 /* Fragmenter state */
 struct sndcp_frag_state {
 	uint8_t frag_nr;

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I707029f78222bc6335837241e5a08c54c5ae6eb3
Gerrit-Change-Number: 26462
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
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/20211208/0dca3609/attachment.htm>


More information about the gerrit-log mailing list