Change in ...libosmo-abis[master]: ipa: ipa_server_link_close() add checks of link state

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Sep 16 13:14:49 UTC 2019


lynxis lazus has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmo-abis/+/15387 )

Change subject: ipa: ipa_server_link_close() add checks of link state
......................................................................

ipa: ipa_server_link_close() add checks of link state

When closing a link which failed on open,
ipa_server_link_close() would crash it when calling osmo_fd_unregister.

Change-Id: I672d4de25464c3829b08aff26b1a6d4ad92e7684
---
M src/input/ipa.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/input/ipa.c b/src/input/ipa.c
index 8aed7b3..b4dbcb0 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -297,6 +297,7 @@
 
 	ipa_link->ofd.when |= BSC_FD_READ | BSC_FD_WRITE;
 	ipa_link->ofd.cb = ipa_server_fd_cb;
+	ipa_link->ofd.fd = -1;
 	ipa_link->ofd.data = ipa_link;
 	if (addr)
 		ipa_link->addr = talloc_strdup(ipa_link, addr);
@@ -326,6 +327,7 @@
 	link->ofd.fd = ret;
 	if (osmo_fd_register(&link->ofd) < 0) {
 		close(ret);
+		link->ofd.fd = -1;
 		return -EIO;
 	}
 	return 0;
@@ -333,8 +335,12 @@
 
 void ipa_server_link_close(struct ipa_server_link *link)
 {
+	if (link->ofd.fd == -1)
+		return;
+
 	osmo_fd_unregister(&link->ofd);
 	close(link->ofd.fd);
+	link->ofd.fd = -1;
 }
 
 static int ipa_server_conn_read(struct ipa_server_conn *conn)

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/15387
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I672d4de25464c3829b08aff26b1a6d4ad92e7684
Gerrit-Change-Number: 15387
Gerrit-PatchSet: 6
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190916/f342a10c/attachment.htm>


More information about the gerrit-log mailing list