mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] IEEE1284: Use del_timer_sync in parport_wait_event
@ 2008-11-30 20:20 Michael Buesch
  2008-12-03  0:30 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Buesch @ 2008-11-30 20:20 UTC (permalink / raw)
  To: Phil Blundell, Carsten Gross, Jose Renau, Tim Waugh
  Cc: linux-kernel, Andrew Morton

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.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

This is completely 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.
Return from parport_wait_even, which destroys the automatic variable "timer"
while the callback is running on another CPU.

Index: linux-2.6/drivers/parport/ieee1284.c
===================================================================
--- linux-2.6.orig/drivers/parport/ieee1284.c	2008-10-24 21:08:12.000000000 +0200
+++ linux-2.6/drivers/parport/ieee1284.c	2008-11-30 21:09:25.000000000 +0100
@@ -84,7 +84,7 @@ int parport_wait_event (struct parport *
 
 	add_timer (&timer);
 	ret = down_interruptible (&port->physport->ieee1284.irq);
-	if (!del_timer (&timer) && !ret)
+	if (!del_timer_sync (&timer) && !ret)
 		/* Timed out. */
 		ret = 1;
 

-- 
Greetings Michael.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-03  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-30 20:20 [PATCH] IEEE1284: Use del_timer_sync in parport_wait_event Michael Buesch
2008-12-03  0:30 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome