⬢ DragonFlyBSD Kernel Audit
DF-5585 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/pccard/pccard_cis_quirks.c
+++ b/sys/bus/pccard/pccard_cis_quirks.c
@@ -231,6 +231,9 @@ pccard_check_cis_quirks(device_t dev)
 	for (i=0; i<n_pccard_cis_quirks; i++) {
 		q = &pccard_cis_quirks[i];
 		if (!pccard_cis_quirk_match(sc, q))
 			continue;
+		if (q->pf == NULL || q->cfe == NULL)	/* malformed entry */
+			continue;
 		if (!wiped) {
 			if (bootverbose) {
 				device_printf(dev, "using CIS quirks for ");
@@ -278,8 +281,10 @@ pccard_check_cis_quirks(device_t dev)
 			cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT);
 			if (cfe == NULL) {
 				kfree(pf, M_DEVBUF);
+				/* pf no longer tracks pf_last; force the next
+				 * match down the fresh-function path */
+				pf_last = NULL;
 				device_printf(dev, "no memory for quirk (2)\n");
 				continue;
 			}