aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2018-07-30 15:15:33 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2018-07-30 15:15:33 +0000
commitcf40916b6305e48035ff0230adb48add81c7b6b1 (patch)
tree157e4fe2be54ed02429f6e9aa0e284004babfd28 /sys/dev/sound
parent3f6cd86b65da87409c7cdfdc9c57c33241a42d1f (diff)
downloadsrc-cf40916b6305e48035ff0230adb48add81c7b6b1.tar.gz
src-cf40916b6305e48035ff0230adb48add81c7b6b1.zip
snd_hda: Only free streams DMA maps if the streams list has been created
If hdac_attach fails prior to allocating sc->streams, cleanup in the hdac_attach_fail label will dereference a NULL pointer, panicking.
Notes
Notes: svn path=/head/; revision=336911
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/pci/hda/hdac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index e1daccb0b8e9..865656ae1862 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -1312,8 +1312,9 @@ hdac_attach(device_t dev)
hdac_attach_fail:
hdac_irq_free(sc);
- for (i = 0; i < sc->num_ss; i++)
- hdac_dma_free(sc, &sc->streams[i].bdl);
+ if (sc->streams != NULL)
+ for (i = 0; i < sc->num_ss; i++)
+ hdac_dma_free(sc, &sc->streams[i].bdl);
free(sc->streams, M_HDAC);
hdac_dma_free(sc, &sc->rirb_dma);
hdac_dma_free(sc, &sc->corb_dma);