[MERGED] osmo-ggsn[master]: create_context_ind(): Fix crash on apn not found

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Oct 12 01:52:00 UTC 2017

Harald Welte has submitted this change and it was merged.

Change subject: create_context_ind(): Fix crash on apn not found

create_context_ind(): Fix crash on apn not found

Program terminated with signal SIGSEGV, Segmentation fault.
0  create_context_ind (pdp=0xb6b391b0 <pdpa>)
    at /usr/src/debug/osmo-ggsn/1.0.0+gitrAUTOINC+ab5e160937-r0/git/ggsn/ggsn.c:453

453             if (!apn->started)

(gdb) bt
0  create_context_ind (pdp=0xb6b391b0 <pdpa>)
    at /usr/src/debug/osmo-ggsn/1.0.0+gitrAUTOINC+ab5e160937-r0/git/ggsn/ggsn.c:453
1  0xb6b225e0 in gtp_create_pdp_ind (gsn=gsn at entry=0x74f28, version=version at entry=1, peer=0x0,
    peer at entry=0xbee6ead4, fd=-1092167056, fd at entry=8, pack=pack at entry=0xbee6eae4, len=len at entry=179)
    at /usr/src/debug/osmo-ggsn/1.0.0+gitrAUTOINC+ab5e160937-r0/git/gtp/gtp.c:1591
2  0xb6b245e4 in gtp_decaps1c (gsn=0x74f28)
    at /usr/src/debug/osmo-ggsn/1.0.0+gitrAUTOINC+ab5e160937-r0/git/gtp/gtp.c:2986
3  0x41d770c0 in osmo_select_main () from /usr/lib/libosmocore.so.8
4  0x000121b8 in main (argc=4, argv=0xbee70e54)
    at /usr/src/debug/osmo-ggsn/1.0.0+gitrAUTOINC+ab5e160937-r0/git/ggsn/ggsn.c:897

Fixes: dd266066c7cc96c797034da352cc9d72177c5780, b16c46b4c36383368eb1581e40d0a8ca751ddc53

Change-Id: Ie4ec74e87aaf1d067dd1717d986673be56c4d6ed
M ggsn/ggsn.c
1 file changed, 2 insertions(+), 2 deletions(-)

  Neels Hofmeyr: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 5852ef6..6c5c1a8 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -449,14 +449,14 @@
 	/* First find an exact APN name match */
 	apn = ggsn_find_apn(ggsn, name_buf);
 	/* ignore if the APN has not been started */
-	if (!apn->started)
+	if (apn && !apn->started)
 		apn = NULL;
 	/* then try default (if any) */
 	if (!apn)
 		apn = ggsn->cfg.default_apn;
 	/* ignore if the APN has not been started */
-	if (!apn->started)
+	if (apn && !apn->started)
 		apn = NULL;
 	if (!apn) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4ec74e87aaf1d067dd1717d986673be56c4d6ed
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>

More information about the gerrit-log mailing list