Re: [BUG][RFC][PATCH] PCI: kernel oops on access to pci proc file while hot-removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(2010/06/24 7:46), Greg KH wrote:
On Wed, Jun 23, 2010 at 04:04:10PM +0900, Kenji Kaneshige 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

Those last 2 lines only work as root, right?

In fact, only "echo 0 > power"s needs root privilege.
The last line works as non root.

Thank you very much for review.

Thanks,
Kenji Kaneshige


--
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


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux