⬢ DragonFlyBSD Kernel Audit
DF-4617 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c
index 9d446793..39c985e7 100644
--- a/sys/dev/sound/pci/hda/hdacc.c
+++ b/sys/dev/sound/pci/hda/hdacc.c
@@ -665,6 +665,8 @@ hdacc_stream_free(device_t dev, device_t child, int dir, int stream)
 {
 	struct hdacc_softc *codec = device_get_softc(dev);
 
+	if (dir < 0 || dir > 1 || stream < 0 || stream > 15)
+		return;
 	codec->streams[dir][stream] = NULL;
 	HDAC_STREAM_FREE(device_get_parent(dev), dev, dir, stream);
 }
@@ -705,6 +707,9 @@ hdacc_stream_intr(device_t dev, int dir, int stream)
 	struct hdacc_softc *codec = device_get_softc(dev);
 	device_t child;
 
+	/* Stream tags are 4-bit (1..15); reject controller-derived garbage. */
+	if (dir < 0 || dir > 1 || stream < 1 || stream > 15)
+		return;
 	if ((child = codec->streams[dir][stream]) != NULL)
 		HDAC_STREAM_INTR(child, dir, stream);
 }