lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aS3jxR1YvjWZKYYO@lizhi-Precision-Tower-5810>
Date: Mon, 1 Dec 2025 13:51:49 -0500
From: Frank Li <Frank.li@....com>
To: Koichiro Den <den@...inux.co.jp>
Cc: ntb@...ts.linux.dev, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org, jdmason@...zu.us,
	dave.jiang@...el.com, allenbh@...il.com, mani@...nel.org,
	kwilczynski@...nel.org, kishon@...nel.org, bhelgaas@...gle.com,
	jbrunet@...libre.com, lpieralisi@...nel.org, yebin10@...wei.com,
	geert+renesas@...der.be, arnd@...db.de, stable@...r.kernel.org
Subject: Re: [PATCH v3 6/7] PCI: endpoint: pci-epf-vntb: Switch
 vpci_scan_bus() to use pci_scan_root_bus()

On Mon, Dec 01, 2025 at 12:10:59AM +0900, Koichiro Den wrote:
> vpci_scan_bus() currently uses pci_scan_bus(), which creates a root bus
> without a parent struct device. In a subsequent change we want to tear
> down the virtual PCI root bus using pci_remove_root_bus(). For that to
> work correctly, the root bus must be associated with a parent device,
> similar to what the removed pci_scan_bus_parented() helper used to do.
>
> Switch vpci_scan_bus() to use pci_scan_root_bus() and pass
> &ndev->epf->epc->dev as the parent. Build the resource list in the same
> way as pci_scan_bus(), so the behavior is unchanged except that the
> virtual root bus now has a proper parent device. This avoids crashes in
> the pci_epf_unbind() -> epf_ntb_unbind() -> pci_remove_root_bus() ->
> pci_bus_release_domain_nr() path once we start removing the root bus in
> a follow-up patch.
>
> Signed-off-by: Koichiro Den <den@...inux.co.jp>
> ---
>  drivers/pci/endpoint/functions/pci-epf-vntb.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 750a246f79c9..af0651c03b20 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -1098,7 +1098,19 @@ static int vpci_scan_bus(void *sysdata)
>  	struct pci_bus *vpci_bus;
>  	struct epf_ntb *ndev = sysdata;
>

next patch's remove empty line should be in this patch.

Reviewed-by: Frank Li <Frank.Li@....com>

Frank
> -	vpci_bus = pci_scan_bus(ndev->vbus_number, &vpci_ops, sysdata);
> +	LIST_HEAD(resources);
> +	static struct resource busn_res = {
> +		.start = 0,
> +		.end = 255,
> +		.flags = IORESOURCE_BUS,
> +	};
> +
> +	pci_add_resource(&resources, &ioport_resource);
> +	pci_add_resource(&resources, &iomem_resource);
> +	pci_add_resource(&resources, &busn_res);
> +
> +	vpci_bus = pci_scan_root_bus(&ndev->epf->epc->dev, ndev->vbus_number,
> +				     &vpci_ops, sysdata, &resources);
>  	if (!vpci_bus) {
>  		pr_err("create pci bus failed\n");
>  		return -EINVAL;
> --
> 2.48.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ