hrev48752 adds 1 changeset to branch 'master' old head: 39a1cc8ec3a8e1567431391e489ddc5acb009b41 new head: af3185c4b5c95ba3769aa8678e7ad40b9b8f41da overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=af3185c4b5c9+%5E39a1cc8ec3a8 ---------------------------------------------------------------------------- af3185c4b5c9: usb_midi: KDL when receiving data on a closed port In normal situations the midi_server opens all midi ports, so this wouldn't be a problem. However, my new MIDI keyboard (Miditech i²Control-25) sends some MIDI events immediately when it is connected to an USB port. These would be handled before the MIDI server had a chance to open the port, leading to a KDL. A similar problem could be triggered by killing the midi_server then sending MIDI events from any other USB device. [ Adrien Destugues <pulkomandy@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48752 Commit: af3185c4b5c95ba3769aa8678e7ad40b9b8f41da URL: http://cgit.haiku-os.org/haiku/commit/?id=af3185c4b5c9 Author: Adrien Destugues <pulkomandy@xxxxxxxxx> Date: Fri Jan 30 20:54:37 2015 UTC ---------------------------------------------------------------------------- 1 file changed, 3 insertions(+) src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp | 3 +++ ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp index c78a278..3facd1a 100644 --- a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp +++ b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp @@ -213,6 +213,9 @@ interpret_midi_buffer(usbmidi_device_info* midiDevice) if (port == NULL) { DPRINTF_ERR((MY_ID "no port matching cable number %d!\n", packet->cn)); + } else if (port->open_fd == NULL) { + DPRINTF_ERR((MY_ID "received data for port %d but it is closed!\n", + packet->cn)); } else { ring_buffer_write(port->rbuf, packet->midi, pktlen); release_sem_etc(port->open_fd->sem_cb, pktlen,