⬢ DragonFlyBSD Kernel Audit
DF-4913 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ath/ath_hal/ah_eeprom_v14.c
+++ b/sys/dev/netif/ath/ath_hal/ah_eeprom_v14.c
@@ -369,6 +369,7 @@
 		off = owl_eep_start_loc + w;	/* NB: AP71 starts at 0 */
 		if (!ath_hal_eepromRead(ah, off, &eep_data[w])) {
 			HALDEBUG(ah, HAL_DEBUG_ANY,
 			    "%s eeprom read error at offset 0x%x\n",
 			    __func__, off);
+			ath_hal_free(ee);
 			return HAL_EEREAD;
 		}
 	}
@@ -410,6 +411,7 @@
 	/* Check CRC - Attach should fail on a bad checksum */
 	if (sum != 0xffff) {
 		HALDEBUG(ah, HAL_DEBUG_ANY,
 		    "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len);
+		ath_hal_free(ee);
 		return HAL_EEBADSUM;
 	}
@@ -429,6 +431,7 @@
 	/* NB: must be after all byte swapping */
 	if (owl_get_eep_ver(ee) != AR5416_EEP_VER) {
 		HALDEBUG(ah, HAL_DEBUG_ANY,
 		    "Bad EEPROM version 0x%x\n", owl_get_eep_ver(ee));
+		ath_hal_free(ee);
 		return HAL_EEBADSUM;
 	}