fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/43390?usp=email )


Change subject: pdpctx: sgsn_pdp_ctx_terminate(): free PDP context if GTP side 
is detached
......................................................................

pdpctx: sgsn_pdp_ctx_terminate(): free PDP context if GTP side is detached

When pdp->ggsn is NULL, sgsn_pdp_ctx_terminate() detached the PDP
context from its MM context but never freed it: sgsn_delete_pdp_ctx()
(which normally triggers the eventual free via the GTP delete
confirmation callback) was only called when pdp->ggsn was set.
This leaked the PDP context.

pdp->ggsn becomes NULL while the PDP context is still attached to
a live MM context in sgsn_ggsn_ctx_remove_pdp(), e.g. when a GGSN
recovers/disappears while the MS stays GPRS attached.  Any later
termination of that PDP context (e.g. Detach, or dropping stale PDP
contexts on re-Attach) would then leak it instead of freeing it.

Mirror the pattern already used in process_ms_ctx_status(): if the
GTP side is already detached, free the PDP context right away
instead of leaving it dangling.

Change-Id: Ia74407c34576bfcc1f4ab9d1940b500da86cfbab
Related: OS#6922
---
M src/sgsn/pdpctx.c
1 file changed, 2 insertions(+), 0 deletions(-)



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

diff --git a/src/sgsn/pdpctx.c b/src/sgsn/pdpctx.c
index da825e6..d65ca4d 100644
--- a/src/sgsn/pdpctx.c
+++ b/src/sgsn/pdpctx.c
@@ -126,6 +126,8 @@
        pdp_ctx_detach_mm_ctx(pdp);
        if (pdp->ggsn)
                sgsn_delete_pdp_ctx(pdp);
+       else /* GTP side already detached, freeing */
+               sgsn_pdp_ctx_free(pdp);
 }

 /*

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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia74407c34576bfcc1f4ab9d1940b500da86cfbab
Gerrit-Change-Number: 43390
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to