public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Giuliano Pochini <pochini@shiny.it>, Takashi Iwai <tiwai@suse.de>,
	Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] Fix potential NULL pointer dereference in echoaudio midi.
Date: Tue, 31 Oct 2006 22:21:40 +0100	[thread overview]
Message-ID: <200610312221.41089.jesper.juhl@gmail.com> (raw)

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 */



             reply	other threads:[~2006-10-31 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-31 21:21 Jesper Juhl [this message]
2006-10-31 22:13 ` [PATCH] Fix potential NULL pointer dereference in echoaudio midi 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200610312221.41089.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pochini@shiny.it \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox