From: Zhu Yi <yi.zhu@intel.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"ipw2100-devel@lists.sourceforge.net"
<ipw2100-devel@lists.sourceforge.net>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ipw2x00: Write outside array bounds
Date: Mon, 27 Jul 2009 10:10:20 +0800 [thread overview]
Message-ID: <1248660620.3747.102.camel@debian> (raw)
In-Reply-To: <4A6B7DB0.7090902@gmail.com>
On Sun, 2009-07-26 at 05:48 +0800, Roel Kluin wrote:
> channel_index loops up to IPW_SCAN_CHANNELS, but is used after being
> incremented. This might be able to access 1 past the end of the array
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Thanks. Do you think below patch is better?
Thanks,
-yi
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 2dc1cdb..07f171c 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -6226,7 +6226,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
};
u8 channel;
- while (channel_index < IPW_SCAN_CHANNELS) {
+ while (channel_index < IPW_SCAN_CHANNELS - 1) {
channel =
priv->speed_scan[priv->speed_scan_pos];
if (channel == 0) {
> ---
> diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
> index 44c29b3..d1c9d6d 100644
> --- a/drivers/net/wireless/ipw2x00/ipw2200.c
> +++ b/drivers/net/wireless/ipw2x00/ipw2200.c
> @@ -6249,7 +6249,10 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
>
> channels[channel - 1] = 1;
> priv->speed_scan_pos++;
> - channel_index++;
> +
> + if (++channel_index >= IPW_SCAN_CHANNELS)
> + break;
> +
> scan->channels_list[channel_index] = channel;
> index =
> ieee80211_channel_to_index(priv->ieee, channel);
next prev parent reply other threads:[~2009-07-27 2:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-25 21:48 [PATCH] ipw2x00: Write outside array bounds Roel Kluin
2009-07-27 2:10 ` Zhu Yi [this message]
2009-08-03 19:51 ` John W. Linville
2009-08-04 0:35 ` Zhu Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1248660620.3747.102.camel@debian \
--to=yi.zhu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=ipw2100-devel@lists.sourceforge.net \
--cc=linux-wireless@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).