aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-06-30 14:05:49 +0200
committerHarald Welte <laforge@gnumonks.org>2013-10-06 11:54:38 +0200
commit10b41306dbddd6e2cdb182e33f1f1be03152375d (patch)
tree0ef67d94f0cdb1386fca5a3f943845531496bdc3
parent84f67b2832f984fd28e78596bc3d7fbbc661e04f (diff)
ipaccess: Properly resolve 'line' in error case
If a write on an IPA file descriptor fails, then we call ipaccess_drop(). However, only in the BSC side the assumption that bfd->data == e1inp_line holds true. On the BTS side, ofd->data references to the ipa_client_conn structure. In order to avoid the problem, call ipaccess_drop() with an explicit reference to the line in which the link was dropped.
-rw-r--r--src/input/ipaccess.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 7e1891e..5c6faa9 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -250,10 +250,9 @@ int ipaccess_rcvmsg_bts_base(struct msgb *msg,
return ret;
}
-static int ipaccess_drop(struct osmo_fd *bfd)
+static int ipaccess_drop(struct osmo_fd *bfd, struct e1inp_line *line)
{
int ret = 1;
- struct e1inp_line *line = bfd->data;
/* Error case: we did not see any ID_RESP yet for this socket. */
if (bfd->fd != -1) {
@@ -463,7 +462,7 @@ static int handle_ts1_read(struct osmo_fd *bfd)
err_msg:
msgb_free(msg);
err:
- ipaccess_drop(bfd);
+ ipaccess_drop(bfd, line);
return ret;
}
@@ -559,7 +558,7 @@ out:
msgb_free(msg);
return ret;
err:
- ipaccess_drop(bfd);
+ ipaccess_drop(bfd, line);
msgb_free(msg);
return ret;
}
@@ -977,7 +976,7 @@ static int ipaccess_line_update(struct e1inp_line *line)
NULL,
ipaccess_bts_cb,
ipaccess_bts_write_cb,
- NULL);
+ line);
if (link == NULL) {
LOGP(DLINP, LOGL_ERROR, "cannot create OML "
"BTS link: %s\n", strerror(errno));
@@ -1011,7 +1010,7 @@ int e1inp_ipa_bts_rsl_connect(struct e1inp_line *line,
NULL,
ipaccess_bts_cb,
ipaccess_bts_write_cb,
- NULL);
+ line);
if (rsl_link == NULL) {
LOGP(DLINP, LOGL_ERROR, "cannot create RSL "
"BTS link: %s\n", strerror(errno));