From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, andrew+netdev@lunn.ch,
netdev@vger.kernel.org
Cc: Myeonghun Pak <mhun512@gmail.com>,
anthony.l.nguyen@intel.com, ae878000@gmail.com,
joshua.a.hay@intel.com, sridhar.samudrala@intel.com,
milena.olech@intel.com, vadim.fedorenko@linux.dev,
willemb@google.com, jacob.e.keller@intel.com,
przemyslaw.kitszel@intel.com, jbrandeb@kernel.org,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Samuel Salin <Samuel.salin@intel.com>
Subject: [PATCH net 2/5] idpf: disable PTM on probe failure and on remove
Date: Tue, 8 Sep 2026 14:44:57 -0700 [thread overview]
Message-ID: <20260908214502.528440-3-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20260908214502.528440-1-anthony.l.nguyen@intel.com>
From: Myeonghun Pak <mhun512@gmail.com>
idpf_probe() enables PCIe Precision Time Measurement with
pci_enable_ptm(), which takes a reference on the device and on every
PTM-capable device up the path to the PTM Root.
Neither the probe error path nor idpf_remove() drops that reference, so
the PTM enable counts of this device and of its upstream path stay
elevated with no bound driver, and the device's PTM control bits remain
set. pcim_enable_device() only arranges for pci_disable_device() and
does not undo the PTM enable.
Add the matching pci_disable_ptm() to the common unwind path.
pci_enable_ptm() failure is not fatal here, so guard the call with
pcie_ptm_enabled(): pci_disable_ptm() decrements dev->ptm_enable_cnt
unconditionally and then recurses upstream, so calling it after a failed
enable would drive this device's count negative and wrongly decrement
parents shared with other endpoints.
This issue was identified during our ongoing static-analysis research
while reviewing kernel code.
Fixes: 8d5e12c5921c ("idpf: add initial PTP support")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
[TN moved call due to commit 6b284aa2ddf3 ("idpf: refactor idpf to use libie_pci APIs")]
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
index 9840580fbe51..129bccaa6baa 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -106,6 +106,11 @@ static int idpf_dev_init(struct idpf_adapter *adapter,
*/
static void idpf_decfg_device(struct idpf_adapter *adapter)
{
+ struct pci_dev *pdev = adapter->pdev;
+
+ if (pcie_ptm_enabled(pdev))
+ pci_disable_ptm(pdev);
+
libie_pci_unmap_all_mmio_regions(&adapter->ctlq_ctx.mmio_info);
}
--
2.47.1
next prev parent reply other threads:[~2026-09-08 21:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 21:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-09-08 (idpf, ice) Tony Nguyen
2026-09-08 21:44 ` [PATCH net 1/5] idpf: disable DIM work before freeing q_vectors Tony Nguyen
2026-09-08 21:44 ` Tony Nguyen [this message]
2026-09-12 9:36 ` [PATCH net 2/5] idpf: disable PTM on probe failure and on remove netdev-bot+sashiko
2026-09-08 21:44 ` [PATCH net 3/5] idpf: account for VLAN header when parsing RSC packet header Tony Nguyen
2026-09-08 21:44 ` [PATCH net 4/5] ice: add missing xa_destroy for sched_node_ids Tony Nguyen
2026-09-08 21:45 ` [PATCH net 5/5] eth: ice: don't dereference pointers from TP_printk() Tony Nguyen
2026-09-10 16:10 ` [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-09-08 (idpf, ice) patchwork-bot+netdevbpf
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=20260908214502.528440-3-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=Samuel.salin@intel.com \
--cc=ae878000@gmail.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jbrandeb@kernel.org \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=mhun512@gmail.com \
--cc=milena.olech@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=vadim.fedorenko@linux.dev \
--cc=willemb@google.com \
/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