Skip to content

Commit

Permalink
iwlwifi: don't crash on firmware file missing info
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and Reinette Chatre committed May 13, 2010
1 parent 1d60a79 commit c9696b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c9696b2

Please sign in to comment.