diff options
author | Christos Margiolis <christos@FreeBSD.org> | 2024-04-28 19:40:29 +0000 |
---|---|---|
committer | Christos Margiolis <christos@FreeBSD.org> | 2024-04-28 19:48:24 +0000 |
commit | b18b990d8e7b15d25243d85ea22374dfdde8a18b (patch) | |
tree | 015d4a4143b6057c1271851f5eced3ed4b973ff9 /sys/dev/sound/pcm/mixer.c | |
parent | 074d6fbebc160222cde6b726adcc7350881d7824 (diff) | |
download | src-b18b990d8e7b15d25243d85ea22374dfdde8a18b.tar.gz src-b18b990d8e7b15d25243d85ea22374dfdde8a18b.zip |
sound: Wrap dsp_clone() and mixer_clone() with bus_topo_lock()
Make sure that the softc isn't freed in between the checks.
Sponsored by: The FreeBSD Foundation
MFC after; 1 day
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44991
Diffstat (limited to 'sys/dev/sound/pcm/mixer.c')
-rw-r--r-- | sys/dev/sound/pcm/mixer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 33a7eb26606d..2f4a6f4d6395 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -1377,12 +1377,14 @@ mixer_clone(void *arg, if (*dev != NULL) return; if (strcmp(name, "mixer") == 0) { + bus_topo_lock(); d = devclass_get_softc(pcm_devclass, snd_unit); /* See related comment in dsp_clone(). */ if (d != NULL && PCM_REGISTERED(d) && d->mixer_dev != NULL) { *dev = d->mixer_dev; dev_ref(*dev); } + bus_topo_unlock(); } } |