diff options
author | matk <matk@FreeBSD.org> | 2003-11-27 19:51:44 +0000 |
---|---|---|
committer | matk <matk@FreeBSD.org> | 2003-11-27 19:51:44 +0000 |
commit | 6d505570679bce227a18fbe48191245762f24f5a (patch) | |
tree | 2de4d8577971277bfe99a2d54236932fe1c94547 /sys/dev/sound/pcm/buffer.c | |
parent | aacae28be66e9b41c0be050051772c80b85ab8c1 (diff) | |
download | FreeBSD-src-6d505570679bce227a18fbe48191245762f24f5a.zip FreeBSD-src-6d505570679bce227a18fbe48191245762f24f5a.tar.gz |
Fix a panic due to holding a lock over calls to uiomove.
Pointed out by: Artur Poplawski
Explained by: Don Lewis (truckman)
Approved by: tanimura (mentor)
Approved by: scottl (re)
Diffstat (limited to 'sys/dev/sound/pcm/buffer.c')
-rw-r--r-- | sys/dev/sound/pcm/buffer.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 30970ab..0021c25 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -499,33 +499,6 @@ sndbuf_dispose(struct snd_dbuf *b, u_int8_t *to, unsigned int count) return 0; } -int -sndbuf_uiomove(struct snd_dbuf *b, struct uio *uio, unsigned int count) -{ - int x, c, p, rd, err; - - err = 0; - rd = (uio->uio_rw == UIO_READ)? 1 : 0; - if (count > uio->uio_resid) - return EINVAL; - - if (count > (rd? sndbuf_getready(b) : sndbuf_getfree(b))) { - return EINVAL; - } - - while (err == 0 && count > 0) { - p = rd? sndbuf_getreadyptr(b) : sndbuf_getfreeptr(b); - c = MIN(count, sndbuf_getsize(b) - p); - x = uio->uio_resid; - err = uiomove(sndbuf_getbufofs(b, p), c, uio); - x -= uio->uio_resid; - count -= x; - x = rd? sndbuf_dispose(b, NULL, x) : sndbuf_acquire(b, NULL, x); - } - - return 0; -} - /* count is number of bytes we want added to destination buffer */ int sndbuf_feed(struct snd_dbuf *from, struct snd_dbuf *to, struct pcm_channel *channel, struct pcm_feeder *feeder, unsigned int count) |