Re: PCI: fix an oops in some pci devices on hotplug remove when their resources are being freed.

Greg KH
2005-04-02T03:33:57Z

On Sat, Apr 02, 2005 at 02:10:23AM +0100, Matthew Wilcox wrote:
> On Fri, Apr 01, 2005 at 03:47:50PM -0800, Greg KH wrote:
> > PCI: fix an oops in some pci devices on hotplug remove when their resources are being freed.
> >
> > As reported by Prarit Bhargava <prarit@sgi.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> >
> > diff -Nru a/drivers/pci/remove.c b/drivers/pci/remove.c
> > for (i = 0; i < PCI_NUM_RESOURCES; i++) {
> > struct resource *res = dev->resource + i;
> > - if (res->parent)
> > + if (res && res->parent)
> > release_resource(res);
>
> I can't believe this fixes anything. How can res possibly be NULL here?
> It's a pointer into a pci_dev.

I agree. However, SGI seems to have some majorly <insert expletive here>
hardware and drivers that cause this line to release a already released
resource. See the other part of this patch for the part where this
resource is supposedly freed up.

I took the patch as it doesn't hurt anyone, and it gets them off of my
back. But if you so much as think this patch isn't needed, I'll gladly
revert it, as I'm really not trusting any PCI hotplug patches coming out
from them anymore...

thanks,

greg k-h