aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2025-10-27 11:30:29 +0000
committerChristos Margiolis <christos@FreeBSD.org>2025-10-27 11:30:29 +0000
commit364864ea91abbd8a9a79578168fa5d34e05200a7 (patch)
tree3d63c974b7e697bc275ed35c28571de2a337e9db
parent3b79697040a7d3f9a4a21fb2e66d9031feb6af84 (diff)
snd_dummy: Round channel pointer after each write
Otherwise we go out of bounds and keep incrementing endlessly. Sponsored by: The FreeBSD Foundation MFC after: 4 days Differential Revision: https://reviews.freebsd.org/D53337
-rw-r--r--sys/dev/sound/dummy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c
index 1f2d69708eec..39214a141bf9 100644
--- a/sys/dev/sound/dummy.c
+++ b/sys/dev/sound/dummy.c
@@ -104,9 +104,10 @@ dummy_chan_io(void *arg)
ch = &sc->chans[i];
if (!ch->run)
continue;
- if (ch->dir == PCMDIR_PLAY)
+ if (ch->dir == PCMDIR_PLAY) {
ch->ptr += sndbuf_getblksz(ch->buf);
- else
+ ch->ptr %= sndbuf_getsize(ch->buf);
+ } else
sndbuf_fillsilence(ch->buf);
snd_mtxunlock(sc->lock);
chn_intr(ch->chan);