mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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
This commit is contained in:
parent
074d6fbebc
commit
b18b990d8e
2 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue