Skip to content

Commit

Permalink
TTY: pdc_cons, fix open vs timer race
Browse files Browse the repository at this point in the history
The timer is initialized too late. tty->open may fire an invalid
timer. So initialize the timer earlier using DEFINE_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 e380a81 commit 52b762f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/parisc/kernel/pdc_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ static int pdc_console_setup(struct console *co, char *options)

#define PDC_CONS_POLL_DELAY (30 * HZ / 1000)

static struct timer_list pdc_console_timer;
static void pdc_console_poll(unsigned long unused);
static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);

static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
{
Expand Down Expand Up @@ -205,10 +206,6 @@ static int __init pdc_console_tty_driver_init(void)

pdc_console_tty_driver = drv;

/* No need to initialize the pdc_console_timer if tty isn't allocated */
init_timer(&pdc_console_timer);
pdc_console_timer.function = pdc_console_poll;

return 0;
}

Expand Down

0 comments on commit 52b762f

Please sign in to comment.