Skip to content

Commit ad72c3c

Browse files
committed
ALSA: usb-audio: Drop snd_BUG_ON() from snd_usbmidi_output_open()
snd_usbmidi_output_open() has a check of the NULL port with snd_BUG_ON(). snd_BUG_ON() was used as this shouldn't have happened, but in reality, the NULL port may be seen when the device gives an invalid endpoint setup at the descriptor, hence the driver skips the allocation. That is, the check itself is valid and snd_BUG_ON() should be dropped from there. Otherwise it's confusing as if it were a real bug, as recently syzbot stumbled on it. Reported-by: [email protected] Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5534bbb commit ad72c3c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sound/usb/midi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,8 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
11331133
port = &umidi->endpoints[i].out->ports[j];
11341134
break;
11351135
}
1136-
if (!port) {
1137-
snd_BUG();
1136+
if (!port)
11381137
return -ENXIO;
1139-
}
11401138

11411139
substream->runtime->private_data = port;
11421140
port->state = STATE_UNKNOWN;

0 commit comments

Comments
 (0)