Commit 16861636 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[sound/oss i810] fix race

This patch fixes the value of swptr in case of an underrun/overrun.

Overruns/underruns probably won't occur at all when the driver is
fixed properly, but this doesn't hurt.
parent e026d85d
......@@ -1456,8 +1456,8 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t *
}
continue;
}
swptr = dmabuf->swptr;
cnt = i810_get_available_read_data(state);
swptr = dmabuf->swptr;
// this is to make the copy_to_user simpler below
if(cnt > (dmabuf->dmasize - swptr))
cnt = dmabuf->dmasize - swptr;
......@@ -1600,8 +1600,8 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l
continue;
}
swptr = dmabuf->swptr;
cnt = i810_get_free_write_space(state);
swptr = dmabuf->swptr;
/* Bound the maximum size to how much we can copy to the
* dma buffer before we hit the end. If we have more to
* copy then it will get done in a second pass of this
......
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