public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Midi close race
@ 2001-09-21 10:04 Adrian Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Cox @ 2001-09-21 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: sailer

The patch below fixes a race condition when closing the MIDI input device. The
previous code left the timer running while freeing buffers used by the timer
routine, leading to frequent OOPSes. Thomas: you seem to have been the last
person to touch this file. Any comments?

--- 1.1/drivers/sound/midibuf.c	Sat Jan  6 07:28:25 2001
+++ 1.2/drivers/sound/midibuf.c	Thu Jun 14 16:33:40 2001
@@ -253,13 +253,13 @@
 
 	midi_devs[dev]->close(dev);
 
+	if (open_devs < 2)
+		del_timer(&poll_timer);
+	open_devs--;
 	vfree(midi_in_buf[dev]);
 	vfree(midi_out_buf[dev]);
 	midi_in_buf[dev] = NULL;
 	midi_out_buf[dev] = NULL;
-	if (open_devs < 2)
-		del_timer(&poll_timer);;
-	open_devs--;
 
 	if (midi_devs[dev]->owner)
 		__MOD_DEC_USE_COUNT (midi_devs[dev]->owner);

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

* [PATCH] Midi close race
@ 2001-09-21 10:38 Studierende der Universitaet des Saarlandes
  0 siblings, 0 replies; 2+ messages in thread
From: Studierende der Universitaet des Saarlandes @ 2001-09-21 10:38 UTC (permalink / raw)
  To: Adrian Cox; +Cc: linux-kernel

+       if (open_devs < 2)
+               del_timer(&poll_timer);

Probably you need del_timer_sync():
Otherwise the timer could be running on another cpu.

+       open_devs--;

--
	Manfred
(OT: Are there any mail archives that store the cc list? I'm not
subscribed to l-k, and if I answer a mail the cc list is always lost)

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

end of thread, other threads:[~2001-09-21 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-21 10:38 [PATCH] Midi close race Studierende der Universitaet des Saarlandes
  -- strict thread matches above, loose matches on Subject: below --
2001-09-21 10:04 Adrian Cox

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