From patchwork Tue Aug 11 06:49:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 40638 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7BDEZTp010190 for ; Tue, 11 Aug 2009 13:14:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753812AbZHKNNI (ORCPT ); Tue, 11 Aug 2009 09:13:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753791AbZHKNNH (ORCPT ); Tue, 11 Aug 2009 09:13:07 -0400 Received: from mail-ew0-f214.google.com ([209.85.219.214]:57928 "EHLO mail-ew0-f214.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753043AbZHKNNF (ORCPT ); Tue, 11 Aug 2009 09:13:05 -0400 Received: by ewy10 with SMTP id 10so3758729ewy.37 for ; Tue, 11 Aug 2009 06:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Zm/nteX1D98NJdaLL00MCOqG/GFRCxRr393ca5RDeZI=; b=X0z1fqK1yNq/oc/R6P12jbR4Pmu/FDCGXhsbzs5wm+rZEGMcm1RWFV5sNKnb1N/2GJ ijiGrIqye1A06i3iEvs6sqyrUoGcclPNlMhl+ka/1hlsTINZiRkuc+5Ev6nvqScBC509 EhkLnWbyegzhPR+QL+H3U1ia6LelCZ0wNDI+c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=lhXXj5cqjvl5YWAgTQuXOXlFujI0zpMahXClu95BmqRrl7sPGtOEx2My4zJhCqFYYX srXr2sWAZhZCgwX31WpvxkX0cBwbazsD4xWDbtSC6vyRhrT6iHCH/8muEJ5zpMio5W2b Qn8P46BY5bXqDLLxSfmNHaQWoGshosyuPNhk4= Received: by 10.210.125.13 with SMTP id x13mr470620ebc.38.1249973120313; Mon, 10 Aug 2009 23:45:20 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm1715815eyg.5.2009.08.10.23.45.18 (version=SSLv3 cipher=RC4-MD5); Mon, 10 Aug 2009 23:45:18 -0700 (PDT) Message-ID: <4A811464.4030108@gmail.com> Date: Tue, 11 Aug 2009 08:49:08 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: "John W. Linville" CC: Jouni Malinen , linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net, Andrew Morton Subject: Re: [PATCH] ath9k: Fix read buffer overflow References: <4A7CA188.1070706@gmail.com> <20090810202622.GB6060@tuxdriver.com> In-Reply-To: <20090810202622.GB6060@tuxdriver.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Prevent a read of powInfo[-1] in the first iteration. Signed-off-by: Roel Kluin Acked-by: Luis R. Rodriguez --- -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index ce0e86c..e67db2c 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c @@ -150,10 +150,10 @@ static void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, IS_CHAN_2GHZ(chan))) { matchIndex = i; break; - } else if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan))) && - (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, - IS_CHAN_2GHZ(chan)))) { + } else if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, + IS_CHAN_2GHZ(chan)) && i > 0 && + freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, + IS_CHAN_2GHZ(chan))) { lowIndex = i - 1; break; } @@ -268,10 +268,10 @@ static void ath9k_hw_get_target_powers(struct ath_hw *ah, matchIndex = i; break; } else - if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan))) && - (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, - IS_CHAN_2GHZ(chan)))) { + if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, + IS_CHAN_2GHZ(chan)) && i > 0 && + freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, + IS_CHAN_2GHZ(chan))) { lowIndex = i - 1; break; }