sound: rawmidi: fix MIDI device O_APPEND error handling
commit80bc5c1318442367dbcdccfa737ec952548088a3
authorClemens Ladisch <clemens@ladisch.de>
Wed, 21 Oct 2009 07:11:43 +0000 (21 09:11 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:21:07 +0000 (8 10:21 -0800)
tree6f9eda97c9c6241e67aaaf7083d77c8bfb8c4937
parentdfe0b47c1e940dbe2f59133c08c485dee78668c5
sound: rawmidi: fix MIDI device O_APPEND error handling

commit b7fe750fcceda4fa6bef399b0e2812562728ea82 upstream.

Commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a in 2.6.30 broke the
error handling code in rawmidi_open_priv().

If only the output substream of a RawMIDI device has been opened and
if this device is then opened with O_RDWR | O_APPEND and if the
initialization of the input substream fails (either because of low
memory or because the device driver's open callback fails), then the
runtime structure of the already open output substream will be freed
and all following writes through the first handle will cause
snd_rawmidi_write() to use the NULL runtime pointer.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sound/core/rawmidi.c