aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/dsp.c
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2024-04-28 19:40:29 +0000
committerChristos Margiolis <christos@FreeBSD.org>2024-04-28 19:48:24 +0000
commitb18b990d8e7b15d25243d85ea22374dfdde8a18b (patch)
tree015d4a4143b6057c1271851f5eced3ed4b973ff9 /sys/dev/sound/pcm/dsp.c
parent074d6fbebc160222cde6b726adcc7350881d7824 (diff)
downloadsrc-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/dsp.c')
-rw-r--r--sys/dev/sound/pcm/dsp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index c5bb27530d2b..df1482d6a97a 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2085,6 +2085,7 @@ dsp_clone(void *arg, struct ucred *cred, char *name, int namelen,
}
return;
found:
+ bus_topo_lock();
d = devclass_get_softc(pcm_devclass, snd_unit);
/*
* If we only have a single soundcard attached and we detach it right
@@ -2096,6 +2097,7 @@ found:
*dev = d->dsp_dev;
dev_ref(*dev);
}
+ bus_topo_unlock();
}
static void