public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix potential NULL pointer dereference in echoaudio midi.
@ 2006-10-31 21:21 Jesper Juhl
  2006-10-31 22:13 ` David Rientjes
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-10-31 21:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Giuliano Pochini, Takashi Iwai, Jesper Juhl

In sound/pci/echoaudio/midi.c::snd_echo_midi_output_write(), there's a risk
of dereferencing a NULL 'chip->midi_out'.
This patch contains the obvious fix as also used a bit higher up in the 
same function.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c
index e31f0f1..69ef9f0 100644
--- a/sound/pci/echoaudio/midi.c
+++ b/sound/pci/echoaudio/midi.c
@@ -236,7 +236,8 @@ static void snd_echo_midi_output_write(u
 	}
 
 	/* We restart the timer only if there is some data left to send */
-	if (!snd_rawmidi_transmit_empty(chip->midi_out) && chip->tinuse) {
+	if (chip->midi_out && !snd_rawmidi_transmit_empty(chip->midi_out) &&
+			chip->tinuse) {
 		/* The timer will expire slightly after the data has been
 		   sent */
 		time = (sent << 3) / 25 + 1;	/* 8/25=0.32ms to send a byte */



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

end of thread, other threads:[~2006-11-06 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31 21:21 [PATCH] Fix potential NULL pointer dereference in echoaudio midi Jesper Juhl
2006-10-31 22:13 ` David Rientjes
2006-10-31 22:26   ` Jesper Juhl
2006-11-02 20:16     ` Giuliano Pochini
2006-11-02 20:22       ` Jesper Juhl
2006-11-06 10:50         ` Takashi Iwai

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