git: d5b70b1192ef - main - sound: Busy the device in SNDCTL_DSP_GETCAPS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Nov 2026 10:24:41 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=d5b70b1192ef342c1314c1d5ff3335e13b5894a0
commit d5b70b1192ef342c1314c1d5ff3335e13b5894a0
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-18 10:20:55 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-18 10:20:55 +0000
sound: Busy the device in SNDCTL_DSP_GETCAPS
The handler read the device flags under PCM_LOCK, but those flags are
written while holding the device busy, so busy it instead.
The CHN_F_VIRTUAL checks do not need a lock. The flag is set once in
vchan_init() when the channel is created and never cleared.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60514
---
sys/dev/sound/pcm/dsp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 8fb1df6d5dd1..d1e9c1f7bc89 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -1354,7 +1354,7 @@ dsp_ioctl(struct cdev *i_dev, unsigned long cmd, caddr_t arg, int mode,
break;
case SNDCTL_DSP_GETCAPS:
- PCM_LOCK(d);
+ PCM_ACQUIRE(d);
*arg_i = PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER;
if (rdch && wrch && !(pcm_getflags(d->dev) & SD_F_SIMPLEX))
*arg_i |= PCM_CAP_DUPLEX;
@@ -1362,7 +1362,7 @@ dsp_ioctl(struct cdev *i_dev, unsigned long cmd, caddr_t arg, int mode,
*arg_i |= PCM_CAP_VIRTUAL;
if (wrch && (wrch->flags & CHN_F_VIRTUAL) != 0)
*arg_i |= PCM_CAP_VIRTUAL;
- PCM_UNLOCK(d);
+ PCM_RELEASE(d);
break;
case SOUND_PCM_READ_BITS: