Re: [PATCH] PCI: switchtec: Fix PCI device reference leak on probe failure
From: Logan Gunthorpe
Date: Thu Nov 05 2026 - 12:42:53 EST
On 2026-11-05 1:55 a.m., Yige Jiang wrote:
> stdev_create() takes a pci_dev reference for stdev->pdev. When a
> later step of switchtec_pci_probe() fails, err_put drops stdev->dev
> but omits the PCI device reference. stdev_release() only frees
> stdev, so the PCI device remains pinned after the failed probe.
>
> Return the PCI device reference before putting stdev->dev, matching
> the existing cleanup in stdev_create() and switchtec_pci_remove().
>
> Fixes: df25461119d9 ("PCI: switchtec: Fix stdev_release() crash after surprise hot remove")
> Signed-off-by: Yige Jiang <yigejiang86@xxxxxxxxx>
Thanks! This looks correct to me.
Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>