diff options
author | Jones Desougi <jones.desougi@27m.se> | 2010-10-27 13:38:34 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-27 15:54:54 -0400 |
commit | 3d435ad7218ff58c846d7e52d87c2daf115f50cd (patch) | |
tree | 67d70141b5d7df2c4194231bed3ec1430771bcc5 /drivers/net/wireless | |
parent | dc9f48ce7c7d345be31208def51572a8250a4a03 (diff) |
ath5k: Fix double free on hw attach error path
If ath5k_hw_attach fails it will free sc->ah (local variable ah) before
returning. However, when it reports failure the caller (ath5k_pci_probe)
will also free sc->ah. Let the caller handle the deallocation, it does
so on further errors as well.
Signed-off-by: Jones Desougi <jones.desougi@27m.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/attach.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index cd0b14a0a93a..fbe8aca975d8 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c | |||
@@ -139,12 +139,12 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
139 | /* Fill the ath5k_hw struct with the needed functions */ | 139 | /* Fill the ath5k_hw struct with the needed functions */ |
140 | ret = ath5k_hw_init_desc_functions(ah); | 140 | ret = ath5k_hw_init_desc_functions(ah); |
141 | if (ret) | 141 | if (ret) |
142 | goto err_free; | 142 | goto err; |
143 | 143 | ||
144 | /* Bring device out of sleep and reset its units */ | 144 | /* Bring device out of sleep and reset its units */ |
145 | ret = ath5k_hw_nic_wakeup(ah, 0, true); | 145 | ret = ath5k_hw_nic_wakeup(ah, 0, true); |
146 | if (ret) | 146 | if (ret) |
147 | goto err_free; | 147 | goto err; |
148 | 148 | ||
149 | /* Get MAC, PHY and RADIO revisions */ | 149 | /* Get MAC, PHY and RADIO revisions */ |
150 | ah->ah_mac_srev = srev; | 150 | ah->ah_mac_srev = srev; |
@@ -234,7 +234,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
234 | } else { | 234 | } else { |
235 | ATH5K_ERR(sc, "Couldn't identify radio revision.\n"); | 235 | ATH5K_ERR(sc, "Couldn't identify radio revision.\n"); |
236 | ret = -ENODEV; | 236 | ret = -ENODEV; |
237 | goto err_free; | 237 | goto err; |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
@@ -244,7 +244,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
244 | (srev < AR5K_SREV_AR2425)) { | 244 | (srev < AR5K_SREV_AR2425)) { |
245 | ATH5K_ERR(sc, "Device not yet supported.\n"); | 245 | ATH5K_ERR(sc, "Device not yet supported.\n"); |
246 | ret = -ENODEV; | 246 | ret = -ENODEV; |
247 | goto err_free; | 247 | goto err; |
248 | } | 248 | } |
249 | 249 | ||
250 | /* | 250 | /* |
@@ -252,7 +252,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
252 | */ | 252 | */ |
253 | ret = ath5k_hw_post(ah); | 253 | ret = ath5k_hw_post(ah); |
254 | if (ret) | 254 | if (ret) |
255 | goto err_free; | 255 | goto err; |
256 | 256 | ||
257 | /* Enable pci core retry fix on Hainan (5213A) and later chips */ | 257 | /* Enable pci core retry fix on Hainan (5213A) and later chips */ |
258 | if (srev >= AR5K_SREV_AR5213A) | 258 | if (srev >= AR5K_SREV_AR5213A) |
@@ -265,7 +265,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
265 | ret = ath5k_eeprom_init(ah); | 265 | ret = ath5k_eeprom_init(ah); |
266 | if (ret) { | 266 | if (ret) { |
267 | ATH5K_ERR(sc, "unable to init EEPROM\n"); | 267 | ATH5K_ERR(sc, "unable to init EEPROM\n"); |
268 | goto err_free; | 268 | goto err; |
269 | } | 269 | } |
270 | 270 | ||
271 | ee = &ah->ah_capabilities.cap_eeprom; | 271 | ee = &ah->ah_capabilities.cap_eeprom; |
@@ -307,7 +307,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
307 | if (ret) { | 307 | if (ret) { |
308 | ATH5K_ERR(sc, "unable to get device capabilities: 0x%04x\n", | 308 | ATH5K_ERR(sc, "unable to get device capabilities: 0x%04x\n", |
309 | sc->pdev->device); | 309 | sc->pdev->device); |
310 | goto err_free; | 310 | goto err; |
311 | } | 311 | } |
312 | 312 | ||
313 | /* Crypto settings */ | 313 | /* Crypto settings */ |
@@ -341,8 +341,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
341 | ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); | 341 | ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); |
342 | 342 | ||
343 | return 0; | 343 | return 0; |
344 | err_free: | 344 | err: |
345 | kfree(ah); | ||
346 | return ret; | 345 | return ret; |
347 | } | 346 | } |
348 | 347 | ||