diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-05-03 12:17:57 +0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-05-13 21:43:06 +0400 |
commit | c9696b2b6c36704dbd1eb51fd4465704a395a6ff (patch) | |
tree | 792346a411b68057bb4c5ce5c5d9a6d44e48e3be /drivers/net/wireless/iwlwifi | |
parent | 1d60a79ed516edcc62c5f74e4223d21e10a5cc14 (diff) | |
download | linux-c9696b2b6c36704dbd1eb51fd4465704a395a6ff.tar.xz |
iwlwifi: don't crash on firmware file missing info
If a firmware file misses one of the required
instruction or data pieces, the driver currently
crashes. Let it gracefully refuse that firmware
file instead.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-helpers.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 3ff6b9d25a10..69846395763b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h @@ -92,6 +92,11 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev, static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) { + if (!desc->len) { + desc->v_addr = NULL; + return -EINVAL; + } + desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, &desc->p_addr, GFP_KERNEL); return (desc->v_addr != NULL) ? 0 : -ENOMEM; |