Change in libosmocore[master]: fix error handling gprs_ns_nsip_listen()

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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Wed Oct 10 14:12:38 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11300


Change subject: fix error handling gprs_ns_nsip_listen()
......................................................................

fix error handling gprs_ns_nsip_listen()

If we cannot bind the listening socket, reset related fields in
the osmo fd structure to NULL again. Otherwise our caller might
eventually try to use an uninitialized osmo fd.

Change-Id: Ia953b2eff54cac0bd980944291f75db14df09a34
Related: OS#3643
---
M src/gb/gprs_ns.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/11300/1

diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 9b7cc05..198ead1 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1628,8 +1628,11 @@
 		LOGP(DNS, LOGL_NOTICE, "Listening for nsip packets on %s:%u\n", inet_ntoa(in), nsi->nsip.local_port);
 	}
 
-	if (ret < 0)
+	if (ret < 0) {
+		nsi->nsip.fd.cb = NULL;
+		nsi->nsip.fd.data = NULL;
 		return ret;
+	}
 
 	ret = setsockopt(nsi->nsip.fd.fd, IPPROTO_IP, IP_TOS,
 				&nsi->nsip.dscp, sizeof(nsi->nsip.dscp));

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia953b2eff54cac0bd980944291f75db14df09a34
Gerrit-Change-Number: 11300
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181010/747eb488/attachment.htm>


More information about the gerrit-log mailing list