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] [thread-next>] [day] [month] [year] [list]
Message-ID: <9686208.vxkaqkMmr5@vostro.rjw.lan>
Date:	Thu, 13 Jun 2013 21:02:55 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Jiang Liu <jiang.liu@...wei.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	"Alexander E . Patrakov" <patrakov@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Yijing Wang <wangyijing@...wei.com>,
	Jiang Liu <liuj97@...il.com>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [BUGFIX 0/9] Fix bug 59501 and code improvement for dock driver

On Thursday, June 13, 2013 11:42:16 AM Yinghai Lu wrote:
> On Thu, Jun 13, 2013 at 9:32 AM, Jiang Liu <jiang.liu@...wei.com> wrote:
> > Alexander E. Patrakov <patrakov@...il.com> reports two bugs related to
> > dock station support on Sony VAIO VPCZ23A4R. Actually there are at least
> > four bugs related to Sony VAIO VPCZ23A4R dock support.
> > 1) can't correctly detect hotplug slot for dock state
> > 2) resource leak on undocking
> > 3) resource allocation failure for dock devices
> > 4) one bug in intel_snd_hda driver
> >
> > The first patch fixes issue 1, and the second patch fixes issue 2.
> > These two patches, if accepted, should be material for stable branches
> > too.
> > Patch 3-9 are code improvement for ACPI and dock driver.
> >
> > I have found the root cause for issue three, but still working on
> > solutions, and seems can't be solve in short time. So please help
> > to review and test patches for issue 1) and 2) first.
> 
> the 3) is about pci resource allocation?
> because pcibios_add_bus is called too early?
> 
> If that is case, we should have something like attached patch for it.

I'm including the patch below to make it easier to comment.

> With that, we will not need to worry about _OSC set for 3.10 etc.

> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index b1ff02a..68ed5d8 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -186,6 +186,14 @@ int pci_bus_add_device(struct pci_dev *dev)
>  	return 0;
>  }
>  
> +void __weak pcibios_add_bus(struct pci_bus *bus)
> +{
> +}
> +
> +void __weak pcibios_remove_bus(struct pci_bus *bus)
> +{
> +}
> +
>  /**
>   * pci_bus_add_devices - start driver for PCI devices
>   * @bus: bus to check for new devices
> @@ -198,6 +206,11 @@ void pci_bus_add_devices(const struct pci_bus *bus)
>  	struct pci_bus *child;
>  	int retval;
>  
> +	if (bus->is_added == 1) {
> +		pcibios_add_bus(bus);
> +		bus->is_added++;
> +	}

Do we need that in all of the places pci_bus_add_devices() is called?

It looks like pci_scan_child_bus() might be a better place for adding this,
or am I overlooking something?

[Hint: the bus->is_added++ hack is <explicit content> ugly.]

> +
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>  		/* Skip already-added devices */
>  		if (dev->is_added)
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 3dfc907..51404e6 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -704,8 +704,6 @@ add_dev:
>  	ret = device_add(&child->dev);
>  	WARN_ON(ret < 0);
>  
> -	pcibios_add_bus(child);
> -
>  	/* Create legacy_io and legacy_mem files for this bus */
>  	pci_create_legacy_files(child);
>  
> @@ -1688,14 +1686,6 @@ int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
>  	return 0;
>  }
>  
> -void __weak pcibios_add_bus(struct pci_bus *bus)
> -{
> -}
> -
> -void __weak pcibios_remove_bus(struct pci_bus *bus)
> -{
> -}
> -
>  struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
>  		struct pci_ops *ops, void *sysdata, struct list_head *resources)
>  {
> @@ -1742,8 +1732,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
>  	if (error)
>  		goto class_dev_reg_err;
>  
> -	pcibios_add_bus(b);
> -
>  	/* Create legacy_io and legacy_mem files for this bus */
>  	pci_create_legacy_files(b);
>  

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ