aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Huemer <alexander.huemer@xx.vu>2011-05-24 15:16:57 +0200
committerHarald Welte <laforge@gnumonks.org>2011-05-24 17:21:32 +0200
commit792edebb4fa5036cdbc32c38caa36c0fd5fcd6b5 (patch)
tree3ee83c5a36d41276ecfc7ee041d5ff6fe2aadf83
parent9e267731675a7976c0f20af0f079385b889d7620 (diff)
libabis: fix segfault on malformed ipaccess RSL link
This patch fixes a segfault that occured when a ipaccess RSL link gets closed unexpectedly. The segfault can be provoked by connecting to the RSL port with ncat and hitting ^C.
-rw-r--r--openbsc/src/libabis/input/ipaccess.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c
index 14271180..cc2a7a05 100644
--- a/openbsc/src/libabis/input/ipaccess.c
+++ b/openbsc/src/libabis/input/ipaccess.c
@@ -429,12 +429,15 @@ static int ipaccess_drop(struct e1inp_ts *ts, struct osmo_fd *bfd)
struct e1inp_sign_link *link;
int bts_nr;
- if (!ts) {
+ if (!ts || !bfd->data) {
/*
* If we don't have a TS this means that this is a RSL
* connection but we are not past the authentication
* handling yet. So we can safely delete this bfd and
* wait for a reconnect.
+ * If we don't have bfd->data this means that a RSL
+ * connection was accept()ed, but nothing was recv()ed
+ * and the connection gets close()ed.
*/
osmo_fd_unregister(bfd);
close(bfd->fd);