Change in ...libosmocore[master]: fix: vty crash by logging during VTY_CLOSED event handling

neels gerrit-no-reply at lists.osmocom.org
Thu Aug 29 22:51:04 UTC 2019


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15339


Change subject: fix: vty crash by logging during VTY_CLOSED event handling
......................................................................

fix: vty crash by logging during VTY_CLOSED event handling

When a VTY closes, dispatch the VTY_CLOSED signal before tearing down the VTY
buffer and fd.

In particular this fixes:

- a crash during telnet_close_client(), invoked by the VTY_CLOSED event, which
  logs to DLGLOBAL and uses vty->obuf that, so far, vty_close() had already
  unallocated earlier (OS#4164).

- the logging about closing a telnet session so far logged:
    DLGLOBAL INFO Closing telnet connection r=NULL<->l=NULL
  By dispatching the VTY_CLOSED event while the fd is still valid, we instead
  get the actual connection IP address and port being closed:
    DLGLOBAL INFO Closing telnet connection r=127.0.0.1:36708<->l=127.0.0.1:4258

Related: OS#4164
Change-Id: I1d235cbfbfb9aaf411316642c7bcfac12106df44
---
M src/vty/vty.c
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/15339/1

diff --git a/src/vty/vty.c b/src/vty/vty.c
index a96d86c..aa23fa0 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -205,6 +205,9 @@
 {
 	int i;
 
+	/* VTY_CLOSED is handled by the telnet_interface */
+	vty_event(VTY_CLOSED, vty->fd, vty);
+
 	if (vty->obuf)  {
 		/* Flush buffer. */
 		buffer_flush_all(vty->obuf, vty->fd);
@@ -236,9 +239,6 @@
 	/* Check configure. */
 	vty_config_unlock(vty);
 
-	/* VTY_CLOSED is handled by the telnet_interface */
-	vty_event(VTY_CLOSED, vty->fd, vty);
-
 	/* OK free vty. */
 	talloc_free(vty);
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1d235cbfbfb9aaf411316642c7bcfac12106df44
Gerrit-Change-Number: 15339
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190829/ce5bb383/attachment.html>


More information about the gerrit-log mailing list