Commit 16fb1096 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai

sound: rawmidi: fix checking of O_APPEND when opening MIDI device

Commit 9a1b64ca in 2.6.30 dropped the
check that a substream must already have been opened with O_APPEND to be
able to open it a second time.

This would make it possible for a substream to be switched to append
mode, which would mean that non-atomic writes would fail unexpectedly.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8579d2d7
...@@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, ...@@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice,
list_for_each_entry(substream, &s->substreams, list) { list_for_each_entry(substream, &s->substreams, list) {
if (substream->opened) { if (substream->opened) {
if (stream == SNDRV_RAWMIDI_STREAM_INPUT || if (stream == SNDRV_RAWMIDI_STREAM_INPUT ||
!(mode & SNDRV_RAWMIDI_LFLG_APPEND)) !(mode & SNDRV_RAWMIDI_LFLG_APPEND) ||
!substream->append)
continue; continue;
} }
if (subdevice < 0 || subdevice == substream->number) { if (subdevice < 0 || subdevice == substream->number) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment