diff options
author | Daniel C Halperin <daniel.c.halperin@intel.com> | 2009-08-13 16:31:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-20 11:33:13 -0400 |
commit | 396887a2b2ad1ef5e5526fec34dec582baf39b81 (patch) | |
tree | 5730d04dedb1cbd97ececce93c039b642d8abaa1 /drivers/net/wireless/iwlwifi/iwl-rx.c | |
parent | 15993e08ac027b64b6f3400d32754966b4cac7b0 (diff) |
iwlwifi: fix erroneous use of iwl_rx_packet.len as a length
The field called 'len' in struct iwl_rx_packet is in fact not just a length
field but also includes some flags from the flow handler. In several places
throughout the driver, this causes incorrect values to be interpreted as
lengths when the field is improperly masked.
In most situations the improper use is for debugging output, and simply results
in an erroneous message, such as:
[551933.070224] ieee80211 phy0: I iwl_rx_statistics Statistics notification received (480 vs -1367342620).
which should read '(480 vs 484)'.
In at least one case this could case bad things to happen:
void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb)
{
struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
"notification for %s:\n",
le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)
);
}
EXPORT_SYMBOL(iwl_rx_pm_debug_statistics_notif);
Given the rampant misuse of this field without proper masking throughout the
driver (every use but one), this patch renames the field from 'len' to
'len_n_flags' to reduce confusion. It also adds the proper masking when
this field is used as a length value.
Signed-off-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 092d3276175a..353d9a2ddbca 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -539,7 +539,8 @@ void iwl_rx_statistics(struct iwl_priv *priv, | |||
539 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 539 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
540 | 540 | ||
541 | IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", | 541 | IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", |
542 | (int)sizeof(priv->statistics), pkt->len); | 542 | (int)sizeof(priv->statistics), |
543 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); | ||
543 | 544 | ||
544 | change = ((priv->statistics.general.temperature != | 545 | change = ((priv->statistics.general.temperature != |
545 | pkt->u.stats.general.temperature) || | 546 | pkt->u.stats.general.temperature) || |