* [PATCH] ipw2x00: Write outside array bounds
@ 2009-07-25 21:48 Roel Kluin
2009-07-27 2:10 ` Zhu Yi
0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-07-25 21:48 UTC (permalink / raw)
To: yi.zhu, linux-wireless, ipw2100-devel, Andrew Morton
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>
---
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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipw2x00: Write outside array bounds
2009-07-25 21:48 [PATCH] ipw2x00: Write outside array bounds Roel Kluin
@ 2009-07-27 2:10 ` Zhu Yi
2009-08-03 19:51 ` John W. Linville
0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yi @ 2009-07-27 2:10 UTC (permalink / raw)
To: Roel Kluin; +Cc: linux-wireless, ipw2100-devel, Andrew Morton
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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipw2x00: Write outside array bounds
2009-07-27 2:10 ` Zhu Yi
@ 2009-08-03 19:51 ` John W. Linville
2009-08-04 0:35 ` Zhu Yi
0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2009-08-03 19:51 UTC (permalink / raw)
To: Zhu Yi; +Cc: Roel Kluin, linux-wireless, ipw2100-devel, Andrew Morton
On Mon, Jul 27, 2009 at 10:10:20AM +0800, Zhu Yi wrote:
> 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?
Didn't see an answer here...which patch do we want?
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
¡Viva Honduras Libre!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ipw2x00: Write outside array bounds
2009-08-03 19:51 ` John W. Linville
@ 2009-08-04 0:35 ` Zhu Yi
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Yi @ 2009-08-04 0:35 UTC (permalink / raw)
To: John W. Linville; +Cc: Roel Kluin, linux-wireless, ipw2100-devel, Andrew Morton
On Tue, 2009-08-04 at 03:51 +0800, John W. Linville wrote:
> On Mon, Jul 27, 2009 at 10:10:20AM +0800, Zhu Yi wrote:
> > 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?
>
> Didn't see an answer here...which patch do we want?
Please apply mine.
Thanks,
-yi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-04 0:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-25 21:48 [PATCH] ipw2x00: Write outside array bounds Roel Kluin
2009-07-27 2:10 ` Zhu Yi
2009-08-03 19:51 ` John W. Linville
2009-08-04 0:35 ` Zhu Yi
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).