diff mbox

iwlwifi: missing error code in iwl_trans_pcie_alloc()

Message ID 20170614104450.GN29394@elgon.mountain (mailing list archive)
State Accepted
Delegated to: Luca Coelho
Headers show

Commit Message

Dan Carpenter June 14, 2017, 10:44 a.m. UTC
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>

Comments

Luca Coelho June 14, 2017, 10:49 a.m. UTC | #1
On Wed, 2017-06-14 at 13:44 +0300, Dan Carpenter wrote:
> 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>

Good catch, thanks!

I'll push it to our internal tree, so it will go upstream via our normal
process.

--
Cheers,
Luca.
diff mbox

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index a3c5d3b195ad..24420314f91b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -3100,7 +3100,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);