public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Jesse Barnes <jbarnes@engr.sgi.com>
Cc: John Rose <johnrose@austin.ibm.com>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] release_pcibus_dev() crash
Date: Thu, 13 Jan 2005 10:37:30 -0800	[thread overview]
Message-ID: <20050113183729.GA25049@kroah.com> (raw)
In-Reply-To: <200501131021.19434.jbarnes@engr.sgi.com>

On Thu, Jan 13, 2005 at 10:21:19AM -0800, Jesse Barnes wrote:
> On Thursday, January 13, 2005 10:18 am, Greg KH wrote:
> > On Thu, Jan 13, 2005 at 11:49:11AM -0600, John Rose wrote:
> > > > Maybe, did you read Documentation/filesystems/sysfs-pci.c?  You need to
> > > > do more than just enable HAVE_PCI_LEGACY, you also need to implement
> > > > some functions.
> > >
> > > This sounds like more than I bargained for.  I'll leave the patch as-is,
> > > since I don't currently have the means to test a fix for the legacy IO
> > > stuff.  Also because it doesn't crash on my architecture :)
> > >
> > > If you get some time, my suggestion is to scrap
> > > pci_remove_legacy_files(), and free the pci_bus->legacy_io field in
> > > pci_remove_bus().  The binary sysfs files will be cleaned up
> > > automatically as the class device is deleted, as described in the
> > > parent.
> >
> > No, don't rely on this please.  Explicitly clean up the files, it's
> > nicer that way, and when sysfs changes to not clean them up for you, it
> > will be less changes then.
> 
> So does the crash indicate that something is removing the directory, 
> containing the attributes to be removed, before it should?  How should the 
> oops be fixed?

Yes, this should be fixed, as it is incorrect, sorry in not seeing it
before.  Those files should be removed in the pci_remove_bus() function,
before the class_device_unregister() call.

So, does the patch below fix the problem for you?
(warning, not even compile tested)

thanks,

greg k-h

===== probe.c 1.91 vs edited =====
--- 1.91/drivers/pci/probe.c	2005-01-11 09:14:53 -08:00
+++ edited/probe.c	2005-01-13 10:34:43 -08:00
@@ -95,10 +95,6 @@ static void release_pcibus_dev(struct cl
 {
 	struct pci_bus *pci_bus = to_pci_bus(class_dev);
 
-	pci_remove_legacy_files(pci_bus);
-	class_device_remove_file(&pci_bus->class_dev,
-				 &class_device_attr_cpuaffinity);
-	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
 	if (pci_bus->bridge)
 		put_device(pci_bus->bridge);
 	kfree(pci_bus);
===== remove.c 1.10 vs edited =====
--- 1.10/drivers/pci/remove.c	2004-11-15 09:27:14 -08:00
+++ edited/remove.c	2005-01-13 10:36:23 -08:00
@@ -61,15 +61,19 @@ int pci_remove_device_safe(struct pci_de
 }
 EXPORT_SYMBOL(pci_remove_device_safe);
 
-void pci_remove_bus(struct pci_bus *b)
+void pci_remove_bus(struct pci_bus *pci_bus)
 {
-	pci_proc_detach_bus(b);
+	pci_proc_detach_bus(pci_bus);
 
 	spin_lock(&pci_bus_lock);
-	list_del(&b->node);
+	list_del(&pci_bus->node);
 	spin_unlock(&pci_bus_lock);
 
-	class_device_unregister(&b->class_dev);
+	pci_remove_legacy_files(pci_bus);
+	class_device_remove_file(&pci_bus->class_dev,
+				 &class_device_attr_cpuaffinity);
+	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
+	class_device_unregister(&pci_bus->class_dev);
 }
 EXPORT_SYMBOL(pci_remove_bus);
 

  reply	other threads:[~2005-01-13 18:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13  0:39 [PATCH] release_pcibus_dev() crash John Rose
2005-01-13  0:55 ` Jesse Barnes
2005-01-13 17:11   ` John Rose
2005-01-13 17:33     ` Jesse Barnes
2005-01-13 17:49       ` John Rose
2005-01-13 18:18         ` Greg KH
2005-01-13 18:21           ` Jesse Barnes
2005-01-13 18:37             ` Greg KH [this message]
2005-01-13 20:12               ` John Rose
2005-01-13 20:25                 ` Greg KH
2005-01-13 20:54                   ` John Rose
2005-01-13 21:05                     ` Greg KH
2005-01-13 21:17                       ` John Rose
2005-01-13 21:55                         ` John Rose
2005-01-13 23:41                         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050113183729.GA25049@kroah.com \
    --to=greg@kroah.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=johnrose@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox