Change in libosmo-abis[master]: ipacces: Fix e1inp_line reference put in ipaccess_close

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jul 20 15:27:31 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/19258 )

Change subject: ipacces: Fix e1inp_line reference put in ipaccess_close
......................................................................

ipacces: Fix e1inp_line reference put in ipaccess_close

Drop the function e1inp_close_socket since it's only used by the caller
at hand, and it's only exported through "internal.h", so no app is using
it. Remove it because there's only a caller, and furthermore because
keeping it (and putting bfd->data==line) would introduce a layer
violation because the bfd->data==line is only used for ipaccess so far.

Triggering path:
handle_ts1_read ret=0 "Sign link vanished"
  ipaccess_drop
line->ops->sign_link_down
  (osmo-bsc) ipaccess_drop_oml
e1inp_sign_link_destroy
  link->ts->line->driver->close
ipaccess_close

Related: OS#4624
Change-Id: If23cc722106a9f70c998e591369a4acafa52c519
---
M include/internal.h
M src/e1_input.c
M src/input/ipaccess.c
3 files changed, 15 insertions(+), 23 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  Hoernchen: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/include/internal.h b/include/internal.h
index c931d4f..8a5aa2e 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -20,13 +20,7 @@
 struct msgb;
 struct msgb *ipa_msg_alloc(int headroom);
 
-/*
- * helper for internal drivers, not public
- */
-void e1inp_close_socket(struct e1inp_ts *ts,
-			struct e1inp_sign_link *sign_link,
-			struct osmo_fd *bfd);
-
+int e1inp_int_snd_event(struct e1inp_ts *ts, struct e1inp_sign_link *link, int evt);
 
 
 #endif
diff --git a/src/e1_input.c b/src/e1_input.c
index fc0370d..df61c7b 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -816,8 +816,7 @@
 	return msg;
 }
 
-static int e1inp_int_snd_event(struct e1inp_ts *ts,
-			       struct e1inp_sign_link *link, int evt)
+int e1inp_int_snd_event(struct e1inp_ts *ts, struct e1inp_sign_link *link, int evt)
 {
 	struct input_signal_data isd;
 	isd.line = ts->line;
@@ -844,19 +843,6 @@
 	return e1inp_int_snd_event(ts, link, evt);
 }
 
-void e1inp_close_socket(struct e1inp_ts *ts,
-			struct e1inp_sign_link *sign_link,
-			struct osmo_fd *bfd)
-{
-	e1inp_int_snd_event(ts, sign_link, S_L_INP_TEI_DN);
-	/* the first e1inp_sign_link_destroy call closes the socket. */
-	if (bfd->fd != -1) {
-		osmo_fd_unregister(bfd);
-		close(bfd->fd);
-		bfd->fd = -1;
-	}
-}
-
 /* register a driver with the E1 core */
 int e1inp_driver_register(struct e1inp_driver *drv)
 {
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 08b34a4..4d55e71 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -431,7 +431,19 @@
 
 	}
 
-	return e1inp_close_socket(e1i_ts, sign_link, bfd);
+	e1inp_int_snd_event(e1i_ts, sign_link, S_L_INP_TEI_DN);
+	/* the first e1inp_sign_link_destroy call closes the socket. */
+	if (bfd->fd != -1) {
+		osmo_fd_unregister(bfd);
+		close(bfd->fd);
+		bfd->fd = -1;
+		/* If The bfd holds a reference to e1inp_line in ->data (BSC
+		 * accepted() sockets), then release it */
+		if (bfd->data == line) {
+			bfd->data = NULL;
+			e1inp_line_put2(line, "ipa_bfd");
+		}
+	}
 }
 
 static void timeout_ts1_write(void *data)

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/19258
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: If23cc722106a9f70c998e591369a4acafa52c519
Gerrit-Change-Number: 19258
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200720/49c1ad68/attachment.htm>


More information about the gerrit-log mailing list