aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorBen Cahill <ben.m.cahill@intel.com>2009-11-06 17:52:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 15:23:45 -0500
commit84c4069232a671b3739387949d5cb588dacbd24a (patch)
tree47f0bf17d5ea2e1386b26915b348fc0e1f806e3c /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent6762f07fd55ff5e588aa5f0a1b70efe8e268a2e8 (diff)
iwlwifi: Limit size of Event Log dump
If device provides bad values for Event Log parameters (due to being asleep or SRAM corruption, etc.), the size can be very, very large (e.g. 0xa5a5a5a5), which can flood system log. Sanity-check capacity and next_entry values and limit to reasonable size dump. Signed-off-by: Ben Cahill <ben.m.cahill@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/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 23b31e6dcacd..a17afe01c0c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1603,6 +1603,9 @@ static void iwl3945_print_event_log(struct iwl_priv *priv, u32 start_idx,
1603 } 1603 }
1604} 1604}
1605 1605
1606/* For sanity check only. Actual size is determined by uCode, typ. 512 */
1607#define IWL3945_MAX_EVENT_LOG_SIZE (512)
1608
1606void iwl3945_dump_nic_event_log(struct iwl_priv *priv) 1609void iwl3945_dump_nic_event_log(struct iwl_priv *priv)
1607{ 1610{
1608 u32 base; /* SRAM byte address of event log header */ 1611 u32 base; /* SRAM byte address of event log header */
@@ -1624,6 +1627,18 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv)
1624 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); 1627 num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
1625 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); 1628 next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
1626 1629
1630 if (capacity > IWL3945_MAX_EVENT_LOG_SIZE) {
1631 IWL_ERR(priv, "Log capacity %d is bogus, limit to %d entries\n",
1632 capacity, IWL3945_MAX_EVENT_LOG_SIZE);
1633 capacity = IWL3945_MAX_EVENT_LOG_SIZE;
1634 }
1635
1636 if (next_entry > IWL3945_MAX_EVENT_LOG_SIZE) {
1637 IWL_ERR(priv, "Log write index %d is bogus, limit to %d\n",
1638 next_entry, IWL3945_MAX_EVENT_LOG_SIZE);
1639 next_entry = IWL3945_MAX_EVENT_LOG_SIZE;
1640 }
1641
1627 size = num_wraps ? capacity : next_entry; 1642 size = num_wraps ? capacity : next_entry;
1628 1643
1629 /* bail out if nothing in log */ 1644 /* bail out if nothing in log */