ath5k: fix hw rate index condition
PATCH 1/1 ath5k: fix hw rate index condition
Make sure we print out a warning when the index is out of bounds, i.e. even on hw_rix == AR5K_MAX_RATES.
Also change to WARN and print text with the reported hw_rix.
--- drivers/net/wireless/ath5k/base.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/ath5k/base.c +2 -1
@@ -1100,7 +1100,8 @@ ath5k_mode_setup(struct ath5k_softc *sc)static inline int ath5k_hw_to_driver_rix (struct ath5k_softc *sc,int hw_rix) { -WARN_ON (hw_rix <0 || hw_rix >AR5K_MAX_RATES ); +WARN (hw_rix <0 || hw_rix >=AR5K_MAX_RATES , +"hw_rix out of bounds: %x\n" , hw_rix);return sc->rate_idx[sc->curband->band][hw_rix]; }
Signature · 1 line
1.6.1.3
On Thu, 26 Feb 2009 23:44:31 +0100, Jiri Slaby wrote
Quoted 4 lines
Make sure we print out a warning when the index is out of bounds, i.e. even on
hw_rix==AR5K_MAX_RATES.Also change to WARN and print text with the reported
hw_rix.
ACK.
Speaking of, I think there's another potential oob array access at:
if (rxs.rate_idx >= 0 && rs.rs_rate ==
sc->curband->bitrates[rxs.rate_idx].hw_value_short)
rxs.flag |= RX_FLAG_SHORTPRE;because sc->rate_idx is u8 instead of s8.
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Quoted 7 lines · Bob Copeland
Speaking of, I think there's another potential oob array access at:
if (rxs.rate_idx>= 0&& rs.rs_rate ==
sc->curband->bitrates[rxs.rate_idx].hw_value_short) rxs.flag |= RX_FLAG_SHORTPRE;because
sc->rate_idxis u8 instead of s8.
strcmp("sc->rate_idx", "rxs.rate_idx") != 0 :)
Or did I miss something?
On Thu, Feb 26, 2009 at 6:19 PM, Jiri Slaby <[email protected]> wrote= :
Quoted 7 lines · Bob Copeland
Quoted 6 lines
Speaking of, I think there's another potential oob array access at:
if (rxs.rate_idx>=3D 0&& =A0rs.rs_rate =3D=3D
=A0 =A0 =A0sc->curband->bitrates[rxs.rate_idx].hw_value_short) =A0 =A0 =A0 =A0 =A0rxs.flag |=3DRX_FLAG_SHORTPRE;
Quoted 5 lines
Quoted 1 line
because
sc->rate_idxis u8 instead of s8.
strcmp("sc->rate_idx", "rxs.rate_idx")!=3D 0 :)Or did I miss something?
:) Sorry, I should've been clearer.
hw_to_driver_rix() returns sc->rate_idx[x][y] as an int, and that array is initialized to (u8)-1 for invalid rates. So, it can return 255 if the hardware rate index (y) is bad, then the check "rxs.rate_idx >=3D 0" would always be true, right? If it's not a real bug yet, it likely will be one day :)
--=20
Bob Copeland %% www.bobcopeland.com
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Bob Copeland
hw_to_driver_rix()returns sc->rate_idx[x][y] as an int, and that array is initialized to (u8)-1 for invalid rates. So, it can return 255 if the hardware rate index (y) is bad, then the check "rxs.rate_idx>= 0" would always be true, right? If it's not a real bug yet, it likely will be one day :)
Ah, yes, it really is a bug(tm), care to post a fix?
Quoted 8 lines · Jiri Slaby
Quoted 5 lines · Bob Copeland
hw_to_driver_rix()returns sc->rate_idx[x][y] as an int, and that array is initialized to (u8)-1 for invalid rates. So, it can return 255 if the hardware rate index (y) is bad, then the check "rxs.rate_idx>= 0" would always be true, right? If it's not a real bug yet, it likely will be one day :)Ah, yes, it really is a bug(tm), care to post a fix?
Actually, I remembered in the dark recesses of my moldering brain that someone had a lost patch for this a while ago, so I searched the archives. Pavel, ok to add your s-o-b?
From: Pavel Roskin <[email protected]>
Subject: [PATCH] ath5k: use signed elements for rate index table
A lookup table is used to convert from hardware rate indexes back to driver-based rate indexes. For unknown hardware rates, we initialize these values to -1, but since the array elements are of type u8, they will be in the range 0-255. This can cause array overruns because subsequent sanity checks only check for negative values.
--- drivers/net/wireless/ath5k/base.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath5k/base.h +1 -1
@@ -112,7 +112,7 @@ struct ath5k_softc {struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS ];struct ieee80211_channel channels[ATH_CHAN_MAX ];struct ieee80211_rate rates[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; -u8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; +s8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ];enum nl80211_iftype opmode;struct ath5k_hw *ah;/* Atheros HW */
Signature · 5 lines
1.5.4.1 -- Bob Copeland %% www.bobcopeland.com
Quoted 34 lines · Bob Copeland
Quoted 8 lines · Jiri Slaby
Quoted 5 lines · Bob Copeland
hw_to_driver_rix()returns sc->rate_idx[x][y] as an int, and that array is initialized to (u8)-1 for invalid rates. So, it can return 255 if the hardware rate index (y) is bad, then the check "rxs.rate_idx>= 0" would always be true, right? If it's not a real bug yet, it likely will be one day :)Ah, yes, it really is a bug(tm), care to post a fix?
Actually, I remembered in the dark recesses of my moldering brain that someone had a lost patch for this a while ago, so I searched the archives. Pavel, ok to add your s-o-b?
From: Pavel Roskin <[email protected]>
Subject: [PATCH] ath5k: use signed elements for rate index tableA lookup table is used to convert from hardware rate indexes back to driver-based rate indexes. For unknown hardware rates, we initialize these values to -1, but since the array elements are of type u8, they will be in the range 0-255. This can cause array overruns because subsequent sanity checks only check for negative values.
Signed-off-by Bob Copeland <[email protected]>--- drivers/net/wireless/ath5k/base.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/wireless/ath5k/base.h +0
-0
drivers/net/wireless/ath5k/base.h struct ath5k_softc { · line 115
Quoted 5 lines
drivers/net/wireless/ath5k/base.h +1
-1@@ -112,7 +112,7 @@ struct ath5k_softc {struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS ];struct ieee80211_channel channels[ATH_CHAN_MAX ];struct ieee80211_rate rates[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; -u8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; +s8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ];
Might be worth adding a note why this is the case. Can't we simply avoid this by checking earlier for the error or simply assigning it an actual default _good_ hw rate value?
Luis
Quoted 3 lines · Luis R. Rodriguez
Might be worth adding a note why this is the case. Can't we simply avoid this by checking earlier for the error or simply assigning it an actual default _good_ hw rate value?
I guess an alternative is to initialize to 0, that would count any rx packets whose hw rate we don't know about as the base rate, so it would probably bias the RC to 1mb, but this is already one of those 'should never happen' cases. Also I can't forsee having a rate index > 127 so changing the sign is pretty low risk.
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Quoted 9 lines · Bob Copeland
Quoted 3 lines · Luis R. Rodriguez
Might be worth adding a note why this is the case. Can't we simply avoid this by checking earlier for the error or simply assigning it an actual default _good_ hw rate value?
I guess an alternative is to initialize to 0, that would count any rx packets whose hw rate we don't know about as the base rate, so it would probably bias the RC to 1mb, but this is already one of those 'should never happen' cases.
Understood.
Quoted 2 lines
Also I can't forsee having a rate index > 127 so
changing the sign is pretty low risk.
Sure, it just seems a bit strange to see a signed rate index, that's all. And if its to deal with an error I think it may be nicer to actually use a rate that works and then warn rather than warn and not use a valid rate at all.
Mind you I haven't checked this code in while.
Luis
Quoted 9 lines · Bob Copeland
Quoted 3 lines · Luis R. Rodriguez
Might be worth adding a note why this is the case. Can't we simply avoid this by checking earlier for the error or simply assigning it an actual default _good_ hw rate value?
I guess an alternative is to initialize to 0, that would count any rx packets whose hw rate we don't know about as the base rate, so it would probably bias the RC to 1mb, but this is already one of those 'should never happen' cases.
I would prefer that we don't hide problems.
If we don't know why we cannot get a valid rate, we should use WARN_ON and find out why and when it happens. I'm fine with using a bogus rate with WARN_ON.
If we decide that we indeed cannot find the actual rate, then WARN_ON should be removed and the bogus rate replaced with an "unknown rate", that is, a special value that is never translated to a valid rate and never given to any rate control algorithm. Using a bogus rate without a warning is wrong in my opinion.
It should be possible to represent "unknown rate" as such. That applies to all drivers. I remember that b43 also failed to report the rate in some cases (for the first received packet or something like that).
Signature · 2 lines
Regards, Pavel Roskin
Quoted 5 lines · Pavel Roskin
I would prefer that we don't hide problems.
If we don't know why we cannot get a valid rate, we should use
WARN_ONand find out why and when it happens. I'm fine with using a bogus rate withWARN_ON.
So here is at least stage one of this, not yet the global "unknown rate" infrastructure, but hopefully it will allow us to track down the issue.
It makes hw_to_driver_rix a little uglier, but oh well. Thoughts?
From: Bob Copeland <[email protected]>
Date: Mon, 2 Mar 2009 21:55:18 -0500
Subject: [PATCH] ath5k: warn and correct rate for unknown hw rate indexes
ath5k sets up a mapping table from the hardware rate index to the rate index used by mac80211; however, we have seen some received frames with incorrect rate indexes. Such frames normally get dropped with a warning in __ieee80211_rx(), but the warning doesn't include enough context to track down the error.
This patch adds a warning to hw_to_driver_rix for any lookups that result in a rate index of -1, then returns a valid rate so the frame can be processed.
This also includes the bug fix suggested by Pavel Roskin, in which the mapping table is made signed, so rates initialized to -1 stay that way.
--- drivers/net/wireless/ath5k/base.c | 15 ++++++++++++--- drivers/net/wireless/ath5k/base.h | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/wireless/ath5k/base.c +12 -3
@@ -1100,9 +1100,18 @@ ath5k_mode_setup(struct ath5k_softc *sc)static inline int ath5k_hw_to_driver_rix (struct ath5k_softc *sc,int hw_rix) { -WARN (hw_rix <0 || hw_rix >=AR5K_MAX_RATES , -"hw_rix out of bounds: %x\n" , hw_rix); -return sc->rate_idx[sc->curband->band][hw_rix]; +int rix; + +/* return base rate on errors */ +if (WARN (hw_rix <0 || hw_rix >=AR5K_MAX_RATES , +"hw_rix out of bounds: %x\n" , hw_rix)) +return 0 ; + + rix = sc->rate_idx[sc->curband->band][hw_rix]; +if (WARN (rix <0 ,"invalid hw_rix: %x\n" , hw_rix)) + rix =0 ; + +return rix; }/***************\
drivers/net/wireless/ath5k/base.h +1 -1
@@ -112,7 +112,7 @@ struct ath5k_softc {struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS ];struct ieee80211_channel channels[ATH_CHAN_MAX ];struct ieee80211_rate rates[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; -u8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; +s8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ];enum nl80211_iftype opmode;struct ath5k_hw *ah;/* Atheros HW */
Signature · 6 lines
1.6.0.6 -- Bob Copeland %% www.bobcopeland.com
2009/3/3 Bob Copeland <[email protected]>:
Quoted 4 lines · Pavel Roskin
Quoted 3 lines
I would prefer that we don't hide problems.
If we don't know why we cannot get a valid rate, we should use WARN_=
ON
Quoted 1 line
Quoted 1 line
and find out why and when it happens. =C2=A0I'm fine with using a bo=
gus rate
Quoted 3 lines
Quoted 1 line
with
WARN_ON.So here is at least stage one of this, not yet the global "unknown ra=
te"
Quoted 1 line
infrastructure, but hopefully it will allow us to track down the issu=
e.
Quoted 2 lines
It makes
hw_to_driver_rixa little uglier, but oh well. =C2=A0Thought=
s?
Quoted 4 lines
From: Bob Copeland <[email protected]>
Date: Mon, 2 Mar 2009 21:55:18 -0500
Subject: [PATCH] ath5k: warn and correct rate for unknown hw rate ind=
exes
drivers/net/wireless=
Quoted 22 lines
ath5k sets up a mapping table from the hardware rate index to the rate index used by mac80211; however, we have seen some received frames with incorrect rate indexes. =C2=A0Such frames normally get dropped with a warning in
__ieee80211_rx(), but the warning doesn't include enough context to track down the error.This patch adds a warning to
hw_to_driver_rixfor any lookups that result in a rate index of -1, then returns a valid rate so the frame can be processed.This also includes the bug fix suggested by Pavel Roskin, in which the mapping table is made signed, so rates initialized to -1 stay that way.
Signed-off-by Bob Copeland <[email protected]>---
=C2=A0drivers/net/wireless/ath5k/base.c | =C2=A0 15 ++++++++++++--- =C2=A0drivers/net/wireless/ath5k/base.h | =C2=A0 =C2=A02 +- =C2=A02 files changed, 13 insertions(+), 4 deletions(-)drivers/net/wireless= renamed from drivers/net/wireless/ath5k/base.c +0
-0
/ath5k/base.c
Quoted 9 lines
index f7c424d..8d4b11c 100644
drivers/net/wireless/ath5k/base.c +0
-0@@ -1100,9 +1100,18 @@ ath5k_mode_setup(struct ath5k_softc *sc)=C2=A0static inline int
=C2=A0ath5k_hw_to_driver_rix(structath5k_softc*sc, inthw_rix) =C2=A0{
- =C2=A0 =C2=A0 =C2=A0 WARN(hw_rix < 0 ||hw_rix>=3DAR5K_MAX_RATES,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 "hw_rix out of bounds: %x\n", hw_rix);
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 return sc->rate_idx[sc->curband->band][hw_rix]=
;
Quoted 4 lines
+ =C2=A0 =C2=A0 =C2=A0 int rix;
+
+ =C2=A0 =C2=A0 =C2=A0 /* return base rate on errors */
+ =C2=A0 =C2=A0 =C2=A0 if (WARN(hw_rix < 0 ||hw_rix>=3D AR5K_MAX_RA=
TES,
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 "hw_rix out of bounds: %x\n", hw_rix))
Quoted 3 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; +
+ =C2=A0 =C2=A0 =C2=A0 rix =3D sc->rate_idx[sc->curband->band][hw_rix=
];
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 if (WARN(rix < 0, "invalid
hw_rix: %x\n", hw_r=
ix))
drivers/net/wireless=
Quoted 7 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rix =3D 0; +
+ =C2=A0 =C2=A0 =C2=A0 return rix;
=C2=A0}=C2=A0/***************\
drivers/net/wireless= renamed from drivers/net/wireless/ath5k/base.h +0
-0
/ath5k/base.h
Quoted 5 lines
index 20e0d14..8229561 100644
drivers/net/wireless/ath5k/base.h +0
-0@@ -112,7 +112,7 @@ struct ath5k_softc {=C2=A0 =C2=A0 =C2=A0 =C2=A0struct
ieee80211_supported_bandsbands[IEE=
E80211_NUM_BANDS];
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0struct
ieee80211_channelchannels[ATH_CHAN=
_MAX];
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0struct
ieee80211_rate=C2=A0 rates[IEEE802=
11_NUM_BANDS][AR5K_MAX_RATES];
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 u8 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_R= ATES];
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 s8 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_R= ATES];
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0enum
nl80211_iftype=C2=A0 =C2=A0 opmode; =C2=A0 =C2=A0 =C2=A0 =C2=A0structath5k_hw=C2=A0 =C2=A0 =C2=A0 =C2=A0=
*ah; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Atheros HW */
Quoted 4 lines
--
1.6.0.6
Another thought...
According to docs the rate field is only valid if more flag is clear (we have the last descriptor) and only if the receive ok flag is set or both receive ok and phy error flags are cleared. We never do such checks so we might actually try to process this field when we already know we shouldn't...
Also the following rate codes are reserved (except XR codes that we already know):
0x000x04 -> the short preamble flag0x050x10 - 0x170x1f
and i don't believe i've ever seen them, so we can warn on them too and print something like "Reserved rate code: %x", also it would be nice to warn on XR rates (1,2,3,6,7) in case we want to debug this in the future.
--=20
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-) Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Nick Kossifidis
According to docs the rate field is only valid if more flag is clear (we have the last descriptor) and only if the receive ok flag is set or both receive ok and phy error flags are cleared. We never do such checks so we might actually try to process this field when we already know we shouldn't...
Well, we do skip rs_more packets without getting the rate, hopefully phy error packets too. The warning would definitely show if we have any bugs there.
Quoted 2 lines
Also the following rate codes are reserved (except XR codes that we already know):
[snip]
Quoted 4 lines
and i don't believe i've ever seen them, so we can warn on them too and print something like "Reserved rate code: %x", also it would be nice to warn on XR rates (1,2,3,6,7) in case we want to debug this in the future.
Good idea, though I'm somewhat of the mind that we should let the current patch go in for a bit and see if any of these pop up. But that's because I'm lazy :)
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Quoted 4 lines · Nick Kossifidis
and i don't believe i've ever seen them, so we can warn on them too and print something like "Reserved rate code: %x", also it would be nice to warn on XR rates (1,2,3,6,7) in case we want to debug this in the future.
Nick, are you ok with taking this patch as-is and adding the other stuff in later? It does fix a warning in mac80211 for unknown rates and instead warns with the actual hw rate code we get.
Here's a repost (rebased, if it matters):
From: Bob Copeland <[email protected]>
Date: Mon, 2 Mar 2009 21:55:18 -0500
Subject: [PATCH] ath5k: warn and correct rate for unknown hw rate indexes
ath5k sets up a mapping table from the hardware rate index to the rate index used by mac80211; however, we have seen some received frames with incorrect rate indexes. Such frames normally get dropped with a warning in __ieee80211_rx(), but it doesn't include enough information to track down the error.
This patch adds a warning to hw_to_driver_rix for any lookups that result in a rate index of -1, then returns a valid rate so the frame can be processed.
Changes-licensed-under: 3-Clause-BSD
--- drivers/net/wireless/ath5k/base.c | 15 ++++++++++++--- drivers/net/wireless/ath5k/base.h | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/wireless/ath5k/base.c +12 -3
@@ -1088,9 +1088,18 @@ ath5k_mode_setup(struct ath5k_softc *sc)static inline int ath5k_hw_to_driver_rix (struct ath5k_softc *sc,int hw_rix) { -WARN (hw_rix <0 || hw_rix >=AR5K_MAX_RATES , -"hw_rix out of bounds: %x\n" , hw_rix); -return sc->rate_idx[sc->curband->band][hw_rix]; +int rix; + +/* return base rate on errors */ +if (WARN (hw_rix <0 || hw_rix >=AR5K_MAX_RATES , +"hw_rix out of bounds: %x\n" , hw_rix)) +return 0 ; + + rix = sc->rate_idx[sc->curband->band][hw_rix]; +if (WARN (rix <0 ,"invalid hw_rix: %x\n" , hw_rix)) + rix =0 ; + +return rix; }/***************\
drivers/net/wireless/ath5k/base.h +1 -1
@@ -112,7 +112,7 @@ struct ath5k_softc {struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS ];struct ieee80211_channel channels[ATH_CHAN_MAX ];struct ieee80211_rate rates[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; -u8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; +s8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ];enum nl80211_iftype opmode;struct ath5k_hw *ah;/* Atheros HW */
Signature · 5 lines
1.6.0.6 -- Bob Copeland %% www.bobcopeland.com
2009/3/23 Bob Copeland <[email protected]>:
Quoted 4 lines · Nick Kossifidis
Quoted 3 lines
and i don't believe i've ever seen them, so we can warn on them too and print something like "Reserved rate code: %x", also it would be nice to warn on XR rates (1,2,3,6,7) in case we want to debug this i=
n
Quoted 3 lines
Quoted 1 line
the future.
Nick, are you ok with taking this patch as-is and adding the other st=
uff
Quoted 1 line
in later? =C2=A0It does fix a warning in mac80211 for unknown rates a=
nd
Quoted 2 lines
instead warns with the actual hw rate code we get.
Sure ;-)
--=20
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-) Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Bob Copeland
Quoted 4 lines · Nick Kossifidis
and i don't believe i've ever seen them, so we can warn on them too and print something like "Reserved rate code: %x", also it would be nice to warn on XR rates (1,2,3,6,7) in case we want to debug this in the future.
Nick, are you ok with taking this patch as-is and adding the other stuff in later? It does fix a warning in mac80211 for unknown rates and instead warns with the actual hw rate code we get.
Quoted 5 lines
Here's a repost (rebased, if it matters):
From: Bob Copeland <[email protected]>
Date: Mon, 2 Mar 2009 21:55:18 -0500
Subject: [PATCH] ath5k: warn and correct rate for unknown hw rate indexes
I've got this one now. Just FYI, I'll be prone to losing any patches posted in the middle of a thread if the Subject isn't changed appropriately. FWIW, 'git send-email' can accept an "--in-reply-to" argument. So when replying in a thread you can say "Oh yeah, I see the problem...patch to follow" and then send the patch in a separate email with it's own subject so that I will see it even if I'm buried (at least most of the time).
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 4 lines · John W. Linville
I've got this one now. Just FYI, I'll be prone to losing any patches posted in the middle of a thread if the Subject isn't changed appropriately. FWIW, 'git send-email' can accept an "--in-reply-to" argument.
Great, thanks -- and thanks for the tip!
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Quoted 3 lines · Bob Copeland
Actually, I remembered in the dark recesses of my moldering brain that someone had a lost patch for this a while ago, so I searched the archives. Pavel, ok to add your s-o-b?
Since my patch was dropped and the new patch was implemented without my participation, it makes no sense to put my s-o-b on the code I didn't write (even though I wrote something similar before).
Signature · 2 lines
Regards, Pavel Roskin
Quoted 7 lines · Pavel Roskin
Quoted 3 lines · Bob Copeland
Actually, I remembered in the dark recesses of my moldering brain that someone had a lost patch for this a while ago, so I searched the archives. =A0Pavel, ok to add your s-o-b?
Since my patch was dropped and the new patch was implemented without =
my
Quoted 2 lines
participation, it makes no sense to put my s-o-b on the code I didn't write (even though I wrote something similar before).
Ok, I just wanted to be sure to maintain proper credit, the "From" shou= ld
suffice. I did rewrite the patch but it actually had an identical diff= =2E
=46WIW, the thread didn't give a clue why it didn't make it upstream, j= ust
missed I guess (http://marc.info/?l=3Dlinux-wireless&m=3D12248000251962=
7&w=3D2,
ultimately that problem was fixed by correctly setting the rs_more flag= ).
Anyway, the patch, while IMO correct, will still result in mac80211 warning in ieee80211_rx with -1 just as 255 will; it just fixes the subsequent out of bound read. If we want to tell mac80211 a real rate, I think we should change it to s8 then hw_to_driver_rix should do something like:
idx =3D array[x][y];
if (WARN_ON(idx < 0))
idx =3D 0;
return idx;
Then we get the warning in the driver and we also return a real rate up the stack. I'll prep a patch for this unless there are any objections.
--=20
Bob Copeland %% www.bobcopeland.com
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html