From: Jiri Slaby Date: Mon, 5 Mar 2012 13:52:51 +0000 (+0100) Subject: TTY: pdc_cons, fix open vs timer race X-Git-Tag: MMI-PSA29.97-13-9~17267^2~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=52b762f7a94c88e5a8aa2be67a06a6f01020cc82;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git TTY: pdc_cons, fix open vs timer race 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 Cc: Kyle McMartin Cc: Helge Deller Cc: "James E.J. Bottomley" Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index c1db65fc4525..8ad05215d4b1 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -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) { @@ -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; }