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

From: Greg KH
Date: Fri Apr 01 2005 - 22:37:48 EST


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@xxxxxxx>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
> >
> > 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
-
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/