⬢ DragonFlyBSD Kernel Audit
DF-4426 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/acpica/acpi_hp/acpi_hp.c
+++ b/sys/dev/acpica/acpi_hp/acpi_hp.c
@@ -1141,7 +1141,7 @@
 acpi_hp_hpcmi_read(struct dev_read_args *ap)
 {
 	struct acpi_hp_softc	*sc;
-	int			pos, i, l, ret;
+	int			pos, i, l, ret, stop;
 	UINT8			instance;
 	UINT8			maxInstance;
 	UINT32			sequence;
@@ -1163,6 +1163,7 @@
 		if (!sbuf_done(&sc->hpcmi_sbuf)) {
 			if (sc->cmi_order_size < 0) {
 				maxInstance = sc->has_cmi;
+				stop = 0;
 				if (!(sc->cmi_detail & 
 				    ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE) &&
 				    maxInstance > 0) {
@@ -1171,11 +1172,13 @@
 				sc->cmi_order_size = 0;
 				for (instance = 0; instance < maxInstance;
 				    ++instance) {
+					if (stop)
+						break;
 					if (acpi_hp_get_cmi_block(sc->wmi_dev,
 						ACPI_HP_WMI_CMI_GUID, instance,
 						line, linesize, &sequence,
 						sc->cmi_detail)) {
-						instance = maxInstance;
+						stop = 1;
 					}
 					else {
 						pos = sc->cmi_order_size;