Skip to content

Commit

Permalink
TTY: pdc_cons, fix racy tty test
Browse files Browse the repository at this point in the history
The tty->count test in the timer was racy. Let's remove the test and
properly delete the timer and wait for the body to finish using _sync
version of del_timer.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Mar 8, 2012
1 parent 9b93742 commit e380a81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/parisc/kernel/pdc_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
{
if (!tty->count)
del_timer(&pdc_console_timer);
del_timer_sync(&pdc_console_timer);
}

static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
Expand Down Expand Up @@ -153,7 +153,7 @@ static void pdc_console_poll(unsigned long unused)
if (count)
tty_flip_buffer_push(tty);

if (tty->count && (pdc_cons.flags & CON_ENABLED))
if (pdc_cons.flags & CON_ENABLED)
mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
}

Expand Down

0 comments on commit e380a81

Please sign in to comment.