guard against 0 rates which can be caused by wrong received frames.

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3013 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
br1 2007-12-10 13:15:06 +00:00
parent d09703c049
commit 45c427d337
3 changed files with 40 additions and 0 deletions

View File

@ -7520,6 +7520,17 @@ ath_tx_start(struct net_device *dev, struct ieee80211_node *ni,
} else } else
antenna = sc->sc_txantenna; antenna = sc->sc_txantenna;
/* should be ok, but just to be sure */
if (txrate == 0)
return -EIO;
DPRINTF(sc, ATH_DEBUG_XMIT, "%s: set up txdesc: pktlen %d hdrlen %d "
"atype %d txpower %d txrate %d try0 %d keyix %d ant %d flags %x "
"ctsrate %d ctsdur %d icvlen %d ivlen %d comp %d\n",
__func__, pktlen, hdrlen, atype, MIN(ni->ni_txpower, 60), txrate,
try0, keyix, antenna, flags, ctsrate, ctsduration, icvlen, ivlen,
comp);
/* /*
* Formulate first tx descriptor with tx controls. * Formulate first tx descriptor with tx controls.
*/ */
@ -7551,6 +7562,20 @@ ath_tx_start(struct net_device *dev, struct ieee80211_node *ni,
if (try0 != ATH_TXMAXTRY) { if (try0 != ATH_TXMAXTRY) {
sc->sc_rc->ops->get_mrr(sc, an, shortPreamble, skb->len, rix, sc->sc_rc->ops->get_mrr(sc, an, shortPreamble, skb->len, rix,
&mrr); &mrr);
/*
* if rate module fucks up and gives us 0 rates we disable the
* multi rate retries. this is important since 0 rates can lead
* to a card continously sending noise (in A band at least)
*/
if (!mrr.rate1) mrr.retries1 = 0;
if (!mrr.rate2) mrr.retries2 = 0;
if (!mrr.rate3) mrr.retries3 = 0;
DPRINTF(sc, ATH_DEBUG_XMIT, "%s: set up multi rate/retry "
"1:%d/%d 2:%d/%d 3:%d/%d\n", __func__,
mrr.rate1, mrr.retries1, mrr.rate2, mrr.retries2,
mrr.rate3, mrr.retries3);
ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1, ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1,
mrr.rate2, mrr.retries2, mrr.rate2, mrr.retries2,
mrr.rate3, mrr.retries3); mrr.rate3, mrr.retries3);

View File

@ -2765,6 +2765,7 @@ ieee80211_recv_mgmt(struct ieee80211_node *ni, struct sk_buff *skb,
if (frm > efrm) if (frm > efrm)
return; return;
IEEE80211_VERIFY_ELEMENT(scan.rates, IEEE80211_RATE_MAXSIZE); IEEE80211_VERIFY_ELEMENT(scan.rates, IEEE80211_RATE_MAXSIZE);
IEEE80211_VERIFY_ELEMENT(scan.xrates, IEEE80211_RATE_MAXSIZE);
IEEE80211_VERIFY_ELEMENT(scan.ssid, IEEE80211_NWID_LEN); IEEE80211_VERIFY_ELEMENT(scan.ssid, IEEE80211_NWID_LEN);
#if IEEE80211_CHAN_MAX < 255 #if IEEE80211_CHAN_MAX < 255
if (scan.chan > IEEE80211_CHAN_MAX) { if (scan.chan > IEEE80211_CHAN_MAX) {

View File

@ -425,6 +425,20 @@ ieee80211_fix_rate(struct ieee80211_node *ni, int flags)
} }
r = nrs->rs_rates[i] & IEEE80211_RATE_VAL; r = nrs->rs_rates[i] & IEEE80211_RATE_VAL;
badrate = r; badrate = r;
/*
* remove 0 rates
* they don't make sense and can lead to trouble later
*/
if (r == 0) {
nrs->rs_nrates--;
nrs->rs_nrates--;
for (j = i; j < nrs->rs_nrates; j++)
nrs->rs_rates[j] = nrs->rs_rates[j + 1];
nrs->rs_rates[j] = 0;
continue;
}
/* /*
* Check for fixed rate. * Check for fixed rate.
*/ */