[PATCH] osmo-ggsn[master]: sgsnemu: Fix bad ptr during context deallocation

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Feb 12 18:14:57 UTC 2018


Review at  https://gerrit.osmocom.org/6392

sgsnemu: Fix bad ptr during context deallocation

Older commit switched pdp_t to have an array of 2 peers instead of
only one in order to accomodate for ipv4v6 contexts, which can have 2
addresses assigned. The usage of peer field was not updated in sgsnemu
accordingly, which means the wrong memory portion was being accessed.

Fixes: 2d6a69e69a4b4cb2b8cc63c4810dae44e5a4d8f6 ("Add support for IPv4v6 End User Addresses")

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/92/6392/1

diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index cf4aa44..804b542 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1312,8 +1312,8 @@
 	if (tun && options.ipdown)
 		tun_runscript(tun, options.ipdown);
 
-	ipdel((struct iphash_t *)pdp->peer);
-	memset(pdp->peer, 0, sizeof(struct iphash_t));	/* To be sure */
+	ipdel((struct iphash_t *)pdp->peer[0]);
+	memset(pdp->peer[0], 0, sizeof(struct iphash_t));	/* To be sure */
 
 	if (1 == options.contexts)
 		state = 5;	/* Disconnected */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list