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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Oct 10 14:20:00 UTC 2018


Harald Welte has submitted this change and it was merged. ( 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(-)

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



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: merged
Gerrit-Change-Id: Ia953b2eff54cac0bd980944291f75db14df09a34
Gerrit-Change-Number: 11300
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181010/46f0e08c/attachment.htm>


More information about the gerrit-log mailing list