From: Allen <allen.pais@oracle.com>
To: Johannes Berg <johannes@sipsolutions.net>, kvalo@codeaurora.org
Cc: davem@davemloft.net, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iwlwifi: fix a potential NULL pointer dereference
Date: Thu, 19 Sep 2019 19:37:01 +0530 [thread overview]
Message-ID: <2380f108-54a6-0110-4e2b-e66dd54ae800@oracle.com> (raw)
In-Reply-To: <fd8813c1c3c02734d60f494a3c8081d95550ec85.camel@sipsolutions.net>
>
> Anyway, as 0-day bot pointed out, this isn't really right. The cleanup
> paths here are also tricky, so I arrived at this patch a few days ago:
My bad, I should have looked at the cleanup path.
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
> index eb544811759d..882fdf7e5e7b 100644
> --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
> +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
> @@ -3530,6 +3530,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
> spin_lock_init(&trans_pcie->reg_lock);
> mutex_init(&trans_pcie->mutex);
> init_waitqueue_head(&trans_pcie->ucode_write_waitq);
> +
> + trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
> + WQ_HIGHPRI | WQ_UNBOUND, 1);
> + if (!trans_pcie->rba.alloc_wq) {
I would like to stick to if(unlikely(!trans_pcie->rba.alloc_wq) just
for consistency.
Let me know if I could add your SOB and send out V2.
- Allen
> + ret = -ENOMEM;
> + goto out_free_trans;
> + }
> + INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
> +
> trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
> if (!trans_pcie->tso_hdr_page) {
> ret = -ENOMEM;
> @@ -3664,10 +3673,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
> trans_pcie->inta_mask = CSR_INI_SET_MASK;
> }
>
> - trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
> - WQ_HIGHPRI | WQ_UNBOUND, 1);
> - INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
> -
> #ifdef CPTCFG_IWLWIFI_DEBUGFS
> trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED;
> mutex_init(&trans_pcie->fw_mon_data.mutex);
> @@ -3681,6 +3686,8 @@ out_free_ict:
> iwl_pcie_free_ict(trans);
> out_no_pci:
> free_percpu(trans_pcie->tso_hdr_page);
> + destroy_workqueue(trans_pcie->rba.alloc_wq);
> +out_free_trans:
> iwl_trans_free(trans);
> return ERR_PTR(ret);
> }
>
next prev parent reply other threads:[~2019-09-19 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 18:11 [PATCH] iwlwifi: fix a potential NULL pointer dereference Allen Pais
2019-09-18 20:19 ` kbuild test robot
2019-09-19 7:08 ` Johannes Berg
2019-09-19 14:07 ` Allen [this message]
2019-09-19 14:47 ` Johannes Berg
2019-09-19 15:29 ` Allen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2380f108-54a6-0110-4e2b-e66dd54ae800@oracle.com \
--to=allen.pais@oracle.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).