Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

From: Greg Kroah-Hartman
Date: Mon Apr 29 2013 - 17:32:26 EST


On Mon, Apr 29, 2013 at 02:23:50PM -0700, Sarah Sharp wrote:
> On Mon, Apr 29, 2013 at 11:21:42AM -0700, Greg Kroah-Hartman wrote:
> > On Mon, Apr 29, 2013 at 11:15:50AM -0700, Bjorn Helgaas wrote:
> > > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote:
> > > > On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng <guz.fnst@xxxxxxxxxxxxxx> wrote:
> > > > > On 04/27/2013 05:01 AM, Yinghai Lu wrote:
> > > > >> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> 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 ...
> > > >
> > > Maybe my allergic reaction to your use of LIST_POISON1 is unjustified,
> > > but I am dubious about the idea that xhci was the only place that needed
> > > it before now, and we just happened to find one more place in PCI that
> > > needs it. That doesn't make sense because good design patterns are used
> > > many times, not just once or twice.
> > >
> > > I thought the whole point of the get/put scheme was that if we had a
> > > pointer to a correctly reference-counted object, we didn't need to check
> > > whether the object was still valid because the object remains valid until
> > > all the references are released.
> >
> > You are correct, you shouldn't have to worry about that. If you have to
> > do something like the LIST_POISON test, something is really wrong.
>
> All right, I'll take a look at the xHCI code. From a brief glance, both
> places that use LIST_POISON are handling a timed-out command. The
> command handling in xHCI needs to get completely reworked anyway, due to
> other race conditions.
>
> Were you suggesting I use the get/put scheme in the xHCI driver, or was
> that for Yinghai?

I thought for Yinghai, but really, no code should have to check that
type of thing, so if the xhci driver is, it shouldn't :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/