Skip to contentSkip to conversation

pty: Remove redundant itty reset

PATCH New Peter Hurley 1 participant 2 messages Feb 5, 2013 – Jun 15, 2013 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pty: Remove redundant itty reset

port->itty has already been reset by release_tty() before pty_cleanup() is called.

Call stack:
release_tty()
tty_kref_put()
queue_release_one_tty()
release_one_tty() : workqueue
tty->ops->cleanup()
pty_cleanup()

---
 drivers/tty/pty.c | 1 -
 1 file changed, 1 deletion(-)
drivers/tty/pty.c +0 -1
index c24b4db..71e456a 100644
@@ -413,7 +413,6 @@ static void pty_unix98_shutdown(struct tty_struct *tty)
 
 static void pty_cleanup(struct tty_struct *tty)
 {
-	tty->port->itty = NULL;
 	tty_port_put(tty->port);
 }
 
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 tty: Reset itty for other pty

Commit 19ffd68f816878aed456d5e87697f43bd9e3bd2b ('pty: Remove redundant itty reset') introduced a regression whereby the other pty's linkage is not cleared on teardown. This triggers a false positive diagnostic in testing.

Properly reset the itty linkage.

---
 drivers/tty/tty_io.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/tty_io.c +2 -0
index b83c5c5..2174698 100644
@@ -1616,6 +1616,8 @@ static void release_tty(struct tty_struct *tty, int idx)
 	tty_free_termios(tty);
 	tty_driver_remove_tty(tty->driver, tty);
 	tty->port->itty = NULL;
+	if (tty->link)
+		tty->link->port->itty = NULL;
 	cancel_work_sync(&tty->port->buf.work);
 
 	if (tty->link)
Signature · 1 line
1.8.1.2