Commit 6e23459c authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update

RawMidi Midlevel
fix handling of EFAULT errors in snd_rawmidi_read/write;
fix hang when writing to /dev/midi* with O_SYNC
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 8f291821
...@@ -984,6 +984,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun ...@@ -984,6 +984,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
} }
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
count1 = snd_rawmidi_kernel_read1(substream, buf, count, 0); count1 = snd_rawmidi_kernel_read1(substream, buf, count, 0);
if (count1 < 0)
return result > 0 ? result : count1;
result += count1; result += count1;
buf += count1; buf += count1;
count -= count1; count -= count1;
...@@ -1216,14 +1218,14 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size ...@@ -1216,14 +1218,14 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
count1 = snd_rawmidi_kernel_write1(substream, buf, count, 0); count1 = snd_rawmidi_kernel_write1(substream, buf, count, 0);
if (count1 < 0) if (count1 < 0)
continue; return result > 0 ? result : count1;
result += count1; result += count1;
buf += count1; buf += count1;
if ((size_t)count1 < count && (file->f_flags & O_NONBLOCK)) if ((size_t)count1 < count && (file->f_flags & O_NONBLOCK))
break; break;
count -= count1; count -= count1;
} }
while (file->f_flags & O_SYNC) { if (file->f_flags & O_SYNC) {
spin_lock_irq(&runtime->lock); spin_lock_irq(&runtime->lock);
while (runtime->avail != runtime->buffer_size) { while (runtime->avail != runtime->buffer_size) {
wait_queue_t wait; wait_queue_t wait;
......
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