lynxis lazus has submitted this change and it was merged. ( 
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
- MS: Activate PDP CTX
- SGSN: send PDP CTX Request to GGSN which GGSN 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(-)

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



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: merged
Gerrit-Change-Id: I4575f7f80f785a62ae3b7f165d236a9dd818aabf
Gerrit-Change-Number: 11019
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>

Reply via email to