diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:51:13 -0500 |
commit | 52b762f7a94c88e5a8aa2be67a06a6f01020cc82 (patch) | |
tree | 637b42adc531c7cfd1e5b3c374fa19b84e5864ba /arch/parisc/kernel/pdc_cons.c | |
parent | e380a81e34375a38f253b42394ef06ca3127559f (diff) |
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 <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>
Diffstat (limited to 'arch/parisc/kernel/pdc_cons.c')
-rw-r--r-- | arch/parisc/kernel/pdc_cons.c | 7 |
1 files changed, 2 insertions, 5 deletions
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) | |||
90 | 90 | ||
91 | #define PDC_CONS_POLL_DELAY (30 * HZ / 1000) | 91 | #define PDC_CONS_POLL_DELAY (30 * HZ / 1000) |
92 | 92 | ||
93 | static struct timer_list pdc_console_timer; | 93 | static void pdc_console_poll(unsigned long unused); |
94 | static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0); | ||
94 | 95 | ||
95 | static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) | 96 | static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) |
96 | { | 97 | { |
@@ -205,10 +206,6 @@ static int __init pdc_console_tty_driver_init(void) | |||
205 | 206 | ||
206 | pdc_console_tty_driver = drv; | 207 | pdc_console_tty_driver = drv; |
207 | 208 | ||
208 | /* No need to initialize the pdc_console_timer if tty isn't allocated */ | ||
209 | init_timer(&pdc_console_timer); | ||
210 | pdc_console_timer.function = pdc_console_poll; | ||
211 | |||
212 | return 0; | 209 | return 0; |
213 | } | 210 | } |
214 | 211 | ||