ALSA: oxfw: fix NULL pointer dereference to unused stream structure
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 26 Aug 2019 13:54:15 +0000 (22:54 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 26 Aug 2019 13:56:01 +0000 (15:56 +0200)
ALSA oxfw driver supports Griffin FireWave. This device supports one
isochronous stream for PCM playback. Current driver executes code to
wait event for stream structure of opposite direction. This causes
NULL pointer dereference.

This commit fixes the bug.

Fixes: ac5d77864cfc ("ALSA: oxfw: support AMDTP domain")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/oxfw/oxfw-stream.c

index 0318dc4dcc55f976cf807a3ed957348d15c06834..3c9a796b65269594c88886568f09a70627a62e07 100644 (file)
@@ -350,13 +350,18 @@ int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw)
 
                // Wait first packet.
                if (!amdtp_stream_wait_callback(&oxfw->rx_stream,
-                                               CALLBACK_TIMEOUT) ||
-                   !amdtp_stream_wait_callback(&oxfw->tx_stream,
                                                CALLBACK_TIMEOUT)) {
                        err = -ETIMEDOUT;
                        goto error;
                }
 
+               if (oxfw->has_output) {
+                       if (!amdtp_stream_wait_callback(&oxfw->tx_stream,
+                                                       CALLBACK_TIMEOUT)) {
+                               err = -ETIMEDOUT;
+                               goto error;
+                       }
+               }
        }
 
        return 0;