ipa: protect against multiple subsequent calls to ipa_client_conn_close()
This would create linked list coruption in osmo_fd_unregister().
The fact that multiple calls of osmo_fd_unrgeister() on the same fd
happen is due to the fact that ipaccess_drop() and others already close
the file descriptor.
diff --git a/src/input/ipa.c b/src/input/ipa.c
index 0a1172f..8c6f603 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -108,8 +108,12 @@
void ipa_client_conn_close(struct ipa_client_conn *link)
{
- osmo_fd_unregister(link->ofd);
- close(link->ofd->fd);
+ /* be safe against multiple calls */
+ if (link->ofd->fd != -1) {
+ osmo_fd_unregister(link->ofd);
+ close(link->ofd->fd);
+ link->ofd->fd = -1;
+ }
}
static void ipa_client_read(struct ipa_client_conn *link)