diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2015-10-18 15:58:37 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-10-19 11:58:21 +0200 |
commit | 56b1c72a75ec44a98aca8bbd71ac869a6f54e036 (patch) | |
tree | bf621224f4e442b98875597c4e69765bf0ec8dec /sound/firewire/lib.c | |
parent | ALSA: firewire-digi00x/firewire-tascam: remove wrong conversion for Config ROM (diff) | |
download | linux-56b1c72a75ec44a98aca8bbd71ac869a6f54e036.tar.xz linux-56b1c72a75ec44a98aca8bbd71ac869a6f54e036.zip |
ALSA: firewire-lib: avoid NULL pointer dereference after closing MIDI port
When asynchronous MIDI port is closed before callbacked, the callback
function causes NULL pointer dereference to missing MIDI substream.
This commit fixes this bug.
Fixes: e8a40d9bcb23('ALSA: firewire-lib: schedule work again when MIDI substream has rest of MIDI messages')
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/lib.c')
-rw-r--r-- | sound/firewire/lib.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c index edf1c8bd25a6..f80aafa44c89 100644 --- a/sound/firewire/lib.c +++ b/sound/firewire/lib.c @@ -74,7 +74,11 @@ static void async_midi_port_callback(struct fw_card *card, int rcode, struct snd_fw_async_midi_port *port = callback_data; struct snd_rawmidi_substream *substream = ACCESS_ONCE(port->substream); - if (rcode == RCODE_COMPLETE && substream != NULL) + /* This port is closed. */ + if (substream == NULL) + return; + + if (rcode == RCODE_COMPLETE) snd_rawmidi_transmit_ack(substream, port->consume_bytes); else if (!rcode_is_permanent_error(rcode)) /* To start next transaction immediately for recovery. */ |