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]
Date:	Mon, 29 Apr 2013 08:19:10 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Gu Zheng <guz.fnst@...fujitsu.com>
Cc:	Bjorn Helgaas <bhelgaas@...gle.com>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sarah Sharp <sarah.a.sharp@...ux.intel.com>
Subject: Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng <guz.fnst@...fujitsu.com> wrote:
> Hi Yinghai,
>
> On 04/27/2013 05:01 AM, Yinghai Lu wrote:
>
>> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas <bhelgaas@...gle.com> wrote:
>>
>>>
>>> You can't be serious.  This is a disgusting mess.  Checking a list
>>> pointer for LIST_POISON1?  As far as I'm concerned, this is a waste of
>>> my time.

looks like xhci is using that LIST_POISON1 ...

>>
>> Well, then need to hold the bus ref, and check bus->devices list instead.
>
> @@ -341,6 +352,7 @@ remove_store(struct device *dev, struct
>  {
>         int err;
>         unsigned long val;
> +       struct pci_dev *pdev;
>
>         if (strict_strtoul(buf, 0, &val) < 0)
>                 return -EINVAL;
> @@ -351,9 +363,14 @@ remove_store(struct device *dev, struct
>         /* An attribute cannot be unregistered by one of its own methods,
>          * so we have to use this roundabout approach.
>          */
> +       pdev = pci_dev_get(to_pci_dev(dev));
>
> There is no need to increase pci_dev's ref here, because we'll increase it
> in sysfs_schedule_callback.

ok, i missed that. if we can use LIST_POISON, then could be more simple.

like -v4.

>
> +       get_device(&pdev->bus->dev);
>
> So the pci_bus' ref management is still needed.

No, we don't need that as first pci_stop_and_remove_bus_device()
already drop that reference.

Yinghai

Download attachment "fix_racing_removing_4.patch" of type "application/octet-stream" (2923 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ