Skip to content

Commit a0b8de3

Browse files
Eugene A. Shatokhinlinvjw
authored andcommitted
ath5k: fix memory leak when fewer than N_PD_CURVES are in use
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>
1 parent c31eb8e commit a0b8de3

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎drivers/net/wireless/ath/ath5k/eeprom.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,14 +691,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
691691
if (!chinfo[pier].pd_curves)
692692
continue;
693693

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

698-
if (pd != NULL) {
699-
kfree(pd->pd_step);
700-
kfree(pd->pd_pwr);
701-
}
698+
kfree(pd->pd_step);
699+
kfree(pd->pd_pwr);
702700
}
703701

704702
kfree(chinfo[pier].pd_curves);

0 commit comments

Comments
 (0)