svn commit: r336911 - head/sys/dev/sound/pci/hda

Justin Hibbits jhibbits at FreeBSD.org
Mon Jul 30 15:15:34 UTC 2018


Author: jhibbits
Date: Mon Jul 30 15:15:33 2018
New Revision: 336911
URL: https://svnweb.freebsd.org/changeset/base/336911

Log:
  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.

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Mon Jul 30 15:10:06 2018	(r336910)
+++ head/sys/dev/sound/pci/hda/hdac.c	Mon Jul 30 15:15:33 2018	(r336911)
@@ -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);


More information about the svn-src-all mailing list