Change in osmo-sgsn[master]: sgsn_libgtp: fix a potential memleak when the GGSN is not reachable

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Sep 18 16:26:06 UTC 2018


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/11019


Change subject: sgsn_libgtp: fix a potential memleak when the GGSN is not reachable
......................................................................

sgsn_libgtp: fix a potential memleak when the GGSN is not reachable

When a MS does the following

- MS: GMM Attach Activate
- MS: Activate PDP CTX
- SGNS: send Request Ctx to GSGSN which does not answer
- GMM Detach (MM ctx get freed)
- libgtp retrans timeout of the first answer
- sgsn_libgtp.c: create_pdp_conf() which ignores this ctx because of emtpy MM ctx

Change-Id: I4575f7f80f785a62ae3b7f165d236a9dd818aabf
---
M src/gprs/sgsn_libgtp.c
1 file changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/19/11019/1

diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 7829796..478d402 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -390,15 +390,13 @@
 static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause)
 {
 	struct sgsn_pdp_ctx *pctx = cbp;
-	uint8_t reject_cause;
+	uint8_t reject_cause = 0;
 
 	LOGPDPCTXP(LOGL_INFO, pctx, "Received CREATE PDP CTX CONF, cause=%d(%s)\n",
 		cause, get_value_string(gtp_cause_strs, cause));
 
 	if (!pctx->mm) {
-		LOGP(DGPRS, LOGL_INFO,
-		     "No MM context, aborting CREATE PDP CTX CONF\n");
-		return -EIO;
+		goto reject;
 	}
 
 	/* Check for cause value if it was really successful */
@@ -452,9 +450,11 @@
 
 	if (pdp)
 		pdp_freepdp(pdp);
+
 	/* Send PDP CTX ACT REJ to MS */
-	gsm48_tx_gsm_act_pdp_rej(pctx->mm, pctx->ti, reject_cause,
-					0, NULL);
+	if (pctx->mm)
+		gsm48_tx_gsm_act_pdp_rej(pctx->mm, pctx->ti, reject_cause,
+					 0, NULL);
 	sgsn_pdp_ctx_free(pctx);
 
 	return EOF;

-- 
To view, visit https://gerrit.osmocom.org/11019
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4575f7f80f785a62ae3b7f165d236a9dd818aabf
Gerrit-Change-Number: 11019
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180918/43c452fa/attachment.htm>


More information about the gerrit-log mailing list