On Wed, 23 Jun 2010 16:04:10 +0900 Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx> wrote: > I encountered the problem that /proc/bus/pci/XX/YY is not removed even > after the corresponding device is hot-removed, if the file is still > being opened. In addtion, accessing this file in this situation causes > kernel panic (see below). > > Becasue the pci_proc_detach_device() doesn't call remove_proc_entry() > if struct proc_dir_entry->count > 1, access to /proc/bus/pci/XX/YY > would refer to struct pci_dev that was already freed. > > Though I don't know why the check for proc_dir_entry->count was added, > I don't think it is needed. Removing this check fixes the problem. > > Steps to reproduce > ------------------ > # cd /sys/bus/pci/slots/2/ > # PROC_BUS_PCI_FILE=/proc/bus/pci/`awk -F: '{print $2"/"$3}' < address`.0 > # sleep 10000 < $PROC_BUS_PCI_FILE & > # echo 0 > power > # while true; do cat $PROC_BUS_PCI_FILE > /dev/null; done > applied to my linux-next branch, thanks. -- Jesse Barnes, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html