提交 5929546a 编写于 作者: G Giuliano Pochini 提交者: Jaroslav Kysela

[ALSA] Fix potential NULL pointer dereference in echoaudio midi

Fix races between the timer handler and the close function.
Signed-off-by: NGiuliano Pochini <pochini@shiny.it>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 5b005a01
......@@ -213,7 +213,7 @@ static void snd_echo_midi_output_write(unsigned long data)
sent = bytes = 0;
spin_lock_irqsave(&chip->lock, flags);
chip->midi_full = 0;
if (chip->midi_out && !snd_rawmidi_transmit_empty(chip->midi_out)) {
if (!snd_rawmidi_transmit_empty(chip->midi_out)) {
bytes = snd_rawmidi_transmit_peek(chip->midi_out, buf,
MIDI_OUT_BUFFER_SIZE - 1);
DE_MID(("Try to send %d bytes...\n", bytes));
......@@ -264,9 +264,11 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream
}
} else {
if (chip->tinuse) {
del_timer(&chip->timer);
chip->tinuse = 0;
spin_unlock_irq(&chip->lock);
del_timer_sync(&chip->timer);
DE_MID(("Timer removed\n"));
return;
}
}
spin_unlock_irq(&chip->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册