From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565Ab1GIGDR (ORCPT ); Sat, 9 Jul 2011 02:03:17 -0400 Received: from out5.smtp.messagingengine.com ([66.111.4.29]:38470 "EHLO out5.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754221Ab1GIGBb (ORCPT ); Sat, 9 Jul 2011 02:01:31 -0400 X-Sasl-enc: aS3p3On37wJnX+s5M8KdfgN26kZbfYumzbcHrAfmyfP1 1310191291 X-Mailbox-Line: From gregkh@clark.kroah.org Fri Jul 8 16:01:10 2011 Message-Id: <20110708230110.318401636@clark.kroah.org> User-Agent: quilt/0.48-16.4 Date: Fri, 08 Jul 2011 16:00:24 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Bob Copeland , "John W. Linville" Subject: [08/35] ath5k: fix memory leak when fewer than N_PD_CURVES are in use In-Reply-To: <20110708230122.GA18807@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.33-longterm review patch. If anyone has any objections, please let us know. ------------------ From: "Eugene A. Shatokhin" commit a0b8de350be458b33248e48b2174d9af8a4c4798 upstream. 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. Signed-off-by: Bob Copeland Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath5k/eeprom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c @@ -1588,14 +1588,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k 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);