[PATCH] Fix potential NULL pointer dereference in echoaudio midi.



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@xxxxxxxxx>
---

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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH] kdesu broken
    ... So the end result is that Ogawa-san's fix is the right one. ... This is just Ogawa's patch, redone against current -git, and with commit ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [PATCH] Fix potential NULL pointer dereference in echoaudio midi.
    ... On Tue, 31 Oct 2006, Jesper Juhl wrote: ... of dereferencing a NULL 'chip->midi_out'. ... This patch contains the obvious fix as also used a bit higher up in the ...
    (Linux-Kernel)
  • Re: [PATCH] rio: typo in bitwise AND expression.
    ... Subject: [PATCH] rio: typo in bitwise AND expression. ... Obvious fix is to change! ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [PATCH] rio: typo in bitwise AND expression.
    ... Subject: [PATCH] rio: typo in bitwise AND expression. ... Obvious fix is to change! ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [PATCH -mmotm] Remove ->nopfn check from use_zero_page
    ... This patch is needed to at least compile. ... Also includes fix to endless bad page states once you boot. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)