diff options
-rw-r--r-- | drivers/tty/pty.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_io.c | 3 | ||||
-rw-r--r-- | include/linux/tty.h | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 2728afe52eea..c32690862671 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -345,6 +345,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, | |||
345 | tty_port_init(ports[1]); | 345 | tty_port_init(ports[1]); |
346 | o_tty->port = ports[0]; | 346 | o_tty->port = ports[0]; |
347 | tty->port = ports[1]; | 347 | tty->port = ports[1]; |
348 | o_tty->port->itty = o_tty; | ||
348 | 349 | ||
349 | tty_driver_kref_get(driver); | 350 | tty_driver_kref_get(driver); |
350 | tty->count++; | 351 | tty->count++; |
@@ -371,6 +372,7 @@ static void pty_unix98_shutdown(struct tty_struct *tty) | |||
371 | 372 | ||
372 | static void pty_cleanup(struct tty_struct *tty) | 373 | static void pty_cleanup(struct tty_struct *tty) |
373 | { | 374 | { |
375 | tty->port->itty = NULL; | ||
374 | kfree(tty->port); | 376 | kfree(tty->port); |
375 | } | 377 | } |
376 | 378 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index f90b6217b3ba..202008f38ca3 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1417,6 +1417,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx) | |||
1417 | "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n", | 1417 | "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n", |
1418 | __func__, tty->driver->name); | 1418 | __func__, tty->driver->name); |
1419 | 1419 | ||
1420 | tty->port->itty = tty; | ||
1421 | |||
1420 | /* | 1422 | /* |
1421 | * Structures all installed ... call the ldisc open routines. | 1423 | * Structures all installed ... call the ldisc open routines. |
1422 | * If we fail here just call release_tty to clean up. No need | 1424 | * If we fail here just call release_tty to clean up. No need |
@@ -1552,6 +1554,7 @@ static void release_tty(struct tty_struct *tty, int idx) | |||
1552 | tty->ops->shutdown(tty); | 1554 | tty->ops->shutdown(tty); |
1553 | tty_free_termios(tty); | 1555 | tty_free_termios(tty); |
1554 | tty_driver_remove_tty(tty->driver, tty); | 1556 | tty_driver_remove_tty(tty->driver, tty); |
1557 | tty->port->itty = NULL; | ||
1555 | 1558 | ||
1556 | if (tty->link) | 1559 | if (tty->link) |
1557 | tty_kref_put(tty->link); | 1560 | tty_kref_put(tty->link); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index b4b3c568d242..9be74d649a51 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -189,6 +189,7 @@ struct tty_port_operations { | |||
189 | 189 | ||
190 | struct tty_port { | 190 | struct tty_port { |
191 | struct tty_struct *tty; /* Back pointer */ | 191 | struct tty_struct *tty; /* Back pointer */ |
192 | struct tty_struct *itty; /* internal back ptr */ | ||
192 | const struct tty_port_operations *ops; /* Port operations */ | 193 | const struct tty_port_operations *ops; /* Port operations */ |
193 | spinlock_t lock; /* Lock protecting tty field */ | 194 | spinlock_t lock; /* Lock protecting tty field */ |
194 | int blocked_open; /* Waiting to open */ | 195 | int blocked_open; /* Waiting to open */ |