Skip to content

Commit

Permalink
ath5k: fix memory leak when fewer than N_PD_CURVES are in use
Browse files Browse the repository at this point in the history
We would free the proper number of curves, but in the wrong
slots, due to a missing level of indirection through
the pdgain_idx table.

It's simpler just to try to free all four slots, so do that.

Cc: stable@kernel.org
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Eugene A. Shatokhin authored and John W. Linville committed Jun 29, 2011
1 parent c31eb8e commit a0b8de3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/net/wireless/ath/ath5k/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
if (!chinfo[pier].pd_curves)
continue;

for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
for (pdg = 0; pdg < AR5K_EEPROM_N_PD_CURVES; pdg++) {
struct ath5k_pdgain_info *pd =
&chinfo[pier].pd_curves[pdg];

if (pd != NULL) {
kfree(pd->pd_step);
kfree(pd->pd_pwr);
}
kfree(pd->pd_step);
kfree(pd->pd_pwr);
}

kfree(chinfo[pier].pd_curves);
Expand Down

0 comments on commit a0b8de3

Please sign in to comment.