Skip to content

Commit 49a5f3c

Browse files
Jiri Slabytorvalds
authored andcommitted
TTY: pdc_cons, fix regression in close
The test in pdc_console_tty_close '!tty->count' was always wrong because tty->count is decremented after tty->ops->close is called and thus can never be zero. Hence the 'then' branch was never executed and the timer never deleted. This did not matter until commit 5dd5bc4 ("TTY: pdc_cons, use tty_port"). There we needed to set TTY in tty_port to NULL, but this never happened due to the bug above. So change the test to really trigger at the last close by changing the condition to 'tty->count == 1'. Well, the driver should not touch tty->count at all. It should use tty_port->count and count open count there itself. Signed-off-by: Jiri Slaby <[email protected]> Reported-and-tested-by: Mikulas Patocka <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Helge Deller <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1c2f954 commit 49a5f3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/parisc/kernel/pdc_cons.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
104104

105105
static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
106106
{
107-
if (!tty->count) {
107+
if (tty->count == 1) {
108108
del_timer_sync(&pdc_console_timer);
109109
tty_port_tty_set(&tty_port, NULL);
110110
}

0 commit comments

Comments
 (0)