Skip to contentSkip to conversation

ath10k: fix supported band setup

PATCH New Michal Kazior 2 participants 2 messages Apr 24, 2013 – Apr 25, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath10k: fix supported band setup

This fixes a crash and a possible memleak.

---
This was introduced just recently.

 drivers/net/wireless/ath/ath10k/mac.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +7 -4
index ded1ea9..7d985be 100644
@@ -2658,16 +2658,19 @@ int ath10k_mac_register(struct ath10k *ar)
 		ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
 	}
 
-
-
 	if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
 		channels = kmemdup(ath10k_5ghz_channels,
 				   sizeof(ath10k_5ghz_channels),
 				   GFP_KERNEL);
-		if (!channels)
+		if (!channels) {
+			if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
+				band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
+				kfree(band->channels);
+			}
 			return -ENOMEM;
+		}
 
-		band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
+		band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
 		band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
 		band->channels = channels;
 		band->n_bitrates = ath10k_a_rates_size;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ath10k: fix supported band setup

Quoted 3 lines · Michal Kazior

This fixes a crash and a possible memleak.

Damn, I broke this. Sorry about it. Applied, thank you for fixing my bug!

Signature · 1 line
Kalle Valo