From 8dca9c27c95e82ceb3a549e7f76324d5db3d6fe1 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 18 May 2015 16:02:44 +0000 Subject: [PATCH] Fix an off-by-one error by adding proper range checks when parsing the HDA association descriptors. This fixes a crash during device probe for some HDA PCI devices. Reported by: David Wolfskill Reviewed by: mav @ MFC after: 1 week --- sys/dev/sound/pci/hda/hdaa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index 0d2ae4735b1d..fe4534378be7 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -3203,7 +3203,7 @@ hdaa_audio_as_parse(struct hdaa_devinfo *devinfo) /* Scan associations skipping as=0. */ cnt = 0; - for (j = 1; j < 16; j++) { + for (j = 1; j < 16 && cnt < max; j++) { first = 16; hpredir = 0; for (i = devinfo->startnode; i < devinfo->endnode; i++) {