git: 1cfc55dacd1d - main - sound: Protect channels.pcm.opened with the sx alone
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Nov 2026 10:24:40 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=1cfc55dacd1d29f3ad4fa110d97af949450b17b3
commit 1cfc55dacd1d29f3ad4fa110d97af949450b17b3
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-18 10:20:02 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-18 10:20:02 +0000
sound: Protect channels.pcm.opened with the sx alone
This list is initialized in pcm_init() and only accessed by dsp_open()
and dsp_close(), and we are under sx already, so the PCM_LOCK does not
add anything.
PCM_LOCK is also held around playcount/reccount reads, which are also
under sx now.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D60513
---
sys/dev/sound/pcm/dsp.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 4dfb66075a9b..8fb1df6d5dd1 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -266,7 +266,6 @@ dsp_close(void *data)
PCM_GIANT_ENTER(d);
PCM_ACQUIRE(d);
- PCM_LOCK(d);
rdch = priv->rdch;
wrch = priv->wrch;
@@ -276,8 +275,6 @@ dsp_close(void *data)
if (wrch != NULL)
CHN_REMOVE(d, wrch, channels.pcm.opened);
- PCM_UNLOCK(d);
-
if (rdch != NULL) {
/*
* The channel itself need not be locked because:
@@ -376,9 +373,7 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
PCM_GIANT_ENTER(d);
- /* Lock snddev so nobody else can monkey with it. */
PCM_ACQUIRE(d);
- PCM_LOCK(d);
error = 0;
if (!DSP_F_VALID(flags))
@@ -417,7 +412,6 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
error = ENOTSUP;
}
}
- PCM_UNLOCK(d);
if (error != 0) {
PCM_RELEASE(d);
@@ -432,9 +426,7 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
PCM_GIANT_EXIT(d);
return (error);
}
- PCM_LOCK(d);
CHN_INSERT_HEAD(d, priv->wrch, channels.pcm.opened);
- PCM_UNLOCK(d);
}
if (DSP_F_READ(flags)) {
error = dsp_chn_alloc(d, &priv->rdch, PCMDIR_REC, flags, td);
@@ -443,9 +435,7 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
PCM_GIANT_EXIT(d);
return (error);
}
- PCM_LOCK(d);
CHN_INSERT_HEAD(d, priv->rdch, channels.pcm.opened);
- PCM_UNLOCK(d);
}
PCM_RELEASE(d);