From: sashiko-bot@kernel.org
To: "Navon John Lukose" <navonjohnlukose@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH wireless v2 3/3] wifi: iwlwifi: pcie: recover a device that lost power in D3cold
Date: Mon, 31 Aug 2026 13:20:10 +0000 [thread overview]
Message-ID: <20260831132010.AC41B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831130332.323549-4-navonjohnlukose@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Time-of-check to time-of-use (TOCTOU) race condition when checking and setting STATUS_TRANS_DEAD in iwl_trans_pcie_reset.
--
commit 6f5f8c9b1441f8d8ad9817104244243beaa97d1d
Author: Navon John Lukose <navonjohnlukose@gmail.com>
wifi: iwlwifi: pcie: recover a device that lost power in D3cold
This commit recovers discrete modules that lose power in D3cold by arming a
product reset via DSM during suspend. If the device does not respond upon
resume, it falls back to a software reset via iwl_trans_pcie_reset().
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221695
Link: https://lore.kernel.org/all/20260722021321.68902-1-nika@nikableh.moe/
Link: https://lore.kernel.org/all/20260829093922.37103-1-navonjohnlukose@gmail.com/
> diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> @@ -1229,6 +1237,22 @@ static int _iwl_pci_resume(struct device *device, bool restore)
[ ... ]
> + if (trans_pcie->prod_reset_set) {
> + iwl_trans_pcie_arm_product_reset(trans, false);
> + if (trans_pcie->prod_reset_set &&
> + iwl_read32(trans, CSR_HW_REV) == ~0U) {
> + IWL_ERR(trans, "device not responding after resume\n");
> + iwl_trans_pcie_reset(trans, IWL_RESET_MODE_PROD_RESET);
[Severity: High]
This is a pre-existing issue, but can this new call to iwl_trans_pcie_reset()
trigger a time-of-check to time-of-use (TOCTOU) race condition with concurrent
callers?
Looking at iwl_trans_pcie_reset() in
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c, the function checks
the STATUS_TRANS_DEAD bit:
if (test_bit(STATUS_TRANS_DEAD, &trans->status))
return;
Then there is a wide window involving memory allocation and CSR dumps before
the bit is actually set:
set_bit(STATUS_TRANS_DEAD, &trans->status);
If this resume path executes concurrently with another error handler (like an
interrupt or timer), both threads could pass the test_bit() check before
either sets it.
Could this result in two iwl_trans_pcie_removal_wk work items being queued
for the same device?
The first worker would remove the device, free its state, and rescan the bus,
creating a new pdev and driver instance. The second worker would then operate
on the old pdev reference, potentially calling pci_reset_function() which
issues a hardware FLR and restores the old PCI config state over the new
driver's device.
> + return 0;
> + }
> + trans_pcie->prod_reset_set = false;
> + }
> +
> if (!trans->op_mode)
> return 0;
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831130332.323549-1-navonjohnlukose@gmail.com?part=3
next prev parent reply other threads:[~2026-08-31 13:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 13:03 [PATCH wireless v2 0/3] wifi: iwlwifi: recover a device that lost power in D3cold Navon John Lukose
2026-08-31 13:03 ` [PATCH wireless v2 1/3] wifi: iwlwifi: pcie: don't infer CSME presence from a failed read Navon John Lukose
2026-08-31 13:15 ` sashiko-bot
2026-08-31 13:44 ` Navon John Lukose
2026-09-01 15:48 ` Bjorn Helgaas
2026-09-01 16:17 ` Bjorn Helgaas
2026-09-01 17:02 ` Johannes Berg
2026-09-06 23:00 ` Navon John Lukose
2026-09-07 6:30 ` Johannes Berg
2026-09-08 3:41 ` Navon John Lukose
2026-08-31 13:03 ` [PATCH wireless v2 2/3] wifi: iwlwifi: pcie: deselect the product reset mode at probe Navon John Lukose
2026-08-31 13:13 ` sashiko-bot
2026-08-31 13:03 ` [PATCH wireless v2 3/3] wifi: iwlwifi: pcie: recover a device that lost power in D3cold Navon John Lukose
2026-08-31 13:20 ` sashiko-bot [this message]
2026-08-31 17:08 ` Ilpo Järvinen
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=20260831132010.AC41B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=navonjohnlukose@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.