⬢ DragonFlyBSD Kernel Audit
DF-4293 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -825,6 +825,11 @@ int
 mixer_reinit(device_t dev)
 {
 	struct snd_mixer *m;
 	struct cdev *pdev;
 	int i;
 
 	pdev = mixer_get_devt(dev);
+	if (pdev == NULL || pdev->si_drv1 == NULL)
+		return ENXIO;
 	m = pdev->si_drv1;
 	snd_mtxlock(m->lock);
@@ -878,6 +883,11 @@ int
 mixer_hwvol_init(device_t dev)
 {
 	struct snd_mixer *m;
 	struct cdev *pdev;
 
 	pdev = mixer_get_devt(dev);
+	if (pdev == NULL || pdev->si_drv1 == NULL)
+		return ENXIO;
 	m = pdev->si_drv1;
@@ -912,6 +922,11 @@ void
 mixer_hwvol_mute(device_t dev)
 {
 	struct snd_mixer *m;
 	struct cdev *pdev;
 
 	pdev = mixer_get_devt(dev);
+	if (pdev == NULL || pdev->si_drv1 == NULL)
+		return;
 	m = pdev->si_drv1;
 	snd_mtxlock(m->lock);
@@ -952,6 +967,11 @@ void
 mixer_hwvol_step(device_t dev, int left_step, int right_step)
 {
 	struct snd_mixer *m;
 	struct cdev *pdev;
 
 	pdev = mixer_get_devt(dev);
+	if (pdev == NULL || pdev->si_drv1 == NULL)
+		return;
 	m = pdev->si_drv1;
 	snd_mtxlock(m->lock);