sound: rawmidi: fix MIDI device O_APPEND error handling
authorClemens Ladisch <clemens@ladisch.de>
Wed, 21 Oct 2009 07:11:43 +0000 (09:11 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 10 Nov 2009 15:22:59 +0000 (16:22 +0100)
commitb7fe750fcceda4fa6bef399b0e2812562728ea82
treeb309dee386e4c0d5b47166338e5a81af50a58eb6
parent16fb109644b5644e42ececeff644514de6f4bd03
sound: rawmidi: fix MIDI device O_APPEND error handling

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>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/rawmidi.c