Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2018 15:15:34 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336911 - head/sys/dev/sound/pci/hda
Message-ID:  <201807301515.w6UFFYKf005174@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807301515.w6UFFYKf005174>