Commit f59abb16 authored by Michael Buesch's avatar Michael Buesch Committed by Linus Torvalds

parport: ieee1284: use del_timer_sync() in parport_wait_event()

Use del_timer_sync() instead of del_timer() to make sure the timer won't
be running when we return from parport_wait_event(), because this would
crash due to destruction of timer_list.

This is untested and just based on a code review.  Just think about the
following sequence of events:

- add_timer()

- down_interruptible() is interrupted by a signal.

- we enter the timer callback handler on another CPU.

- del_timer(), but the timer callback is still running.

- eturn from parport_wait_even, which destroys the automatic variable
  "timer" while the callback is running on another CPU.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 50682bb4
...@@ -84,7 +84,7 @@ int parport_wait_event (struct parport *port, signed long timeout) ...@@ -84,7 +84,7 @@ int parport_wait_event (struct parport *port, signed long timeout)
add_timer (&timer); add_timer (&timer);
ret = down_interruptible (&port->physport->ieee1284.irq); ret = down_interruptible (&port->physport->ieee1284.irq);
if (!del_timer (&timer) && !ret) if (!del_timer_sync(&timer) && !ret)
/* Timed out. */ /* Timed out. */
ret = 1; ret = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment