diff options
author | mlaier <mlaier@FreeBSD.org> | 2006-10-23 00:34:07 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2006-10-23 00:34:07 +0000 |
commit | 2fda6e11e96b7e11228416efe0f63ecae26e904d (patch) | |
tree | c2577d58c353234de5f8a84744048b95e5b71403 | |
parent | d9281607508ee6f6d12781efbab55502df85e247 (diff) | |
download | FreeBSD-src-2fda6e11e96b7e11228416efe0f63ecae26e904d.zip FreeBSD-src-2fda6e11e96b7e11228416efe0f63ecae26e904d.tar.gz |
net80211 seems to give us more rates than specified via ic_sup_rates under
yet to be investigated circumstances. If that happens truncate to the number
of rates that the firmware supports.
Found by: Jeremie Le Hen
Obtained from: OpenBSD (w/ changes)
MFC after: 3 days
-rw-r--r-- | sys/dev/iwi/if_iwi.c | 5 | ||||
-rw-r--r-- | sys/dev/iwi/if_iwireg.h | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index e88e99d..2451281 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -2935,6 +2935,11 @@ iwi_auth_and_assoc(struct iwi_softc *sc) IWI_MODE_11G; rs.type = IWI_RATESET_TYPE_NEGOTIATED; rs.nrates = ni->ni_rates.rs_nrates; + if (rs.nrates > IWI_RATESET_SIZE) { + DPRINTF(("Truncating negotiated rate set from %u\n", + rs.nrates)); + rs.nrates = IWI_RATESET_SIZE; + } memcpy(rs.rates, ni->ni_rates.rs_rates, rs.nrates); DPRINTF(("Setting negotiated rates (%u)\n", rs.nrates)); error = iwi_cmd(sc, IWI_CMD_SET_RATES, &rs, sizeof rs); diff --git a/sys/dev/iwi/if_iwireg.h b/sys/dev/iwi/if_iwireg.h index 4816013..05ce168 100644 --- a/sys/dev/iwi/if_iwireg.h +++ b/sys/dev/iwi/if_iwireg.h @@ -338,7 +338,8 @@ struct iwi_rateset { #define IWI_RATESET_TYPE_SUPPORTED 1 uint8_t reserved; - uint8_t rates[12]; +#define IWI_RATESET_SIZE 12 + uint8_t rates[IWI_RATESET_SIZE]; } __packed; /* structure for command IWI_CMD_SET_TX_POWER */ |