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.
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 @@
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 @@
err_msg:
msgb_free(msg);
err:
- ipaccess_drop(bfd);
+ ipaccess_drop(bfd, line);
return ret;
}
@@ -559,7 +558,7 @@
msgb_free(msg);
return ret;
err:
- ipaccess_drop(bfd);
+ ipaccess_drop(bfd, line);
msgb_free(msg);
return ret;
}
@@ -977,7 +976,7 @@
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 @@
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));