diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-10-21 03:10:16 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-10 10:21:30 -0500 |
commit | 16fb109644b5644e42ececeff644514de6f4bd03 (patch) | |
tree | 8f05be8292e049627ac800b4bff301e0a7e84f05 | |
parent | 8579d2d7779d7ff41ea2a0183015e0e5038f1043 (diff) |
sound: rawmidi: fix checking of O_APPEND when opening MIDI device
Commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a 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: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/core/rawmidi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 3071e6f5801e..091405385e15 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, | |||
248 | list_for_each_entry(substream, &s->substreams, list) { | 248 | list_for_each_entry(substream, &s->substreams, list) { |
249 | if (substream->opened) { | 249 | if (substream->opened) { |
250 | if (stream == SNDRV_RAWMIDI_STREAM_INPUT || | 250 | if (stream == SNDRV_RAWMIDI_STREAM_INPUT || |
251 | !(mode & SNDRV_RAWMIDI_LFLG_APPEND)) | 251 | !(mode & SNDRV_RAWMIDI_LFLG_APPEND) || |
252 | !substream->append) | ||
252 | continue; | 253 | continue; |
253 | } | 254 | } |
254 | if (subdevice < 0 || subdevice == substream->number) { | 255 | if (subdevice < 0 || subdevice == substream->number) { |