iwlwifi: missing error code in iwl_trans_pcie_alloc()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 10:44:51 +0000 (13:44 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 21 Jul 2017 09:26:38 +0000 (12:26 +0300)
We don't set the error code here so we end up returning ERR_PTR(0) which
is NULL.  The caller doesn't expect that so it results in a NULL
dereference.

Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/trans.c

index 92b3a55d0fbc2633bd6e06c5ef2e772fe98b679b..f95eec52508e9bc4784f5cda71548bbd7d761b0b 100644 (file)
@@ -3150,7 +3150,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
        init_waitqueue_head(&trans_pcie->d0i3_waitq);
 
        if (trans_pcie->msix_enabled) {
-               if (iwl_pcie_init_msix_handler(pdev, trans_pcie))
+               ret = iwl_pcie_init_msix_handler(pdev, trans_pcie);
+               if (ret)
                        goto out_no_pci;
         } else {
                ret = iwl_pcie_alloc_ict(trans);