Skip to contentSkip to conversation

wifi: iwlegacy: 3945: free EEPROM data on remove

PATCH In review Guangshuo Li 2 participants 2 messages Sep 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: iwlegacy: 3945: free EEPROM data on remove

il3945_pci_probe() calls il_eeprom_init(), which allocates memory for the EEPROM data. The probe failure paths release this allocation with il_eeprom_free(), but the remove path does not free it after a successful probe.

As a result, the EEPROM data is leaked when the PCI device is removed.

Free the EEPROM data in il3945_pci_remove() before releasing the mac80211 hardware structure.

This issue was found by manual code inspection.

Fixes 073d3f5f1b3b ("iwlwifi: changing EEPROM layout handling")
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +1 -0
index cbaf250626c5..f7ca182d1494 100644
@@ -3807,6 +3807,7 @@ il3945_pci_remove(struct pci_dev *pdev)
 
 	il_free_channel_map(il);
 	il_free_geos(il);
+	il_eeprom_free(il);
 	kfree(il->scan_cmd);
 	dev_kfree_skb(il->beacon_skb);
 	ieee80211_free_hw(il->hw);
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Guangshuo Li

il3945_pci_probe() calls il_eeprom_init(), which allocates memory for the EEPROM data. The probe failure paths release this allocation with il_eeprom_free(), but the remove path does not free it after a successful probe.

As a result, the EEPROM data is leaked when the PCI device is removed.

Quoted 8 lines

Free the EEPROM data in il3945_pci_remove() before releasing the mac80211 hardware structure.

This issue was found by manual code inspection.

Fixes 073d3f5f1b3b ("iwlwifi: changing EEPROM layout handling")
Quoted 19 lines
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +1 -0
index cbaf250626c5..f7ca182d1494 100644
@@ -3807,6 +3807,7 @@ il3945_pci_remove(struct pci_dev *pdev)
 
 	il_free_channel_map(il);
 	il_free_geos(il);
+	il_eeprom_free(il);
 	kfree(il->scan_cmd);
 	dev_kfree_skb(il->beacon_skb);
 	ieee80211_free_hw(il->hw);
Signature · 1 line
2.43.0