lynxis lazus has uploaded this change for review. ( 
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(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/87/15387/1

diff --git a/src/input/ipa.c b/src/input/ipa.c
index 8aed7b3..c05ab04 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -333,8 +333,12 @@

 void ipa_server_link_close(struct ipa_server_link *link)
 {
-       osmo_fd_unregister(&link->ofd);
-       close(link->ofd.fd);
+       if (osmo_fd_is_registered(&link->ofd))
+               osmo_fd_unregister(&link->ofd);
+       if (link->ofd.fd < 0)
+               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: 1
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-MessageType: newchange

Reply via email to