Re: [RFC] PCI device list locking

From: Chris Wright (chris@wirex.com)
Date: Tue Jun 17 2003 - 17:13:35 EST


* Greg KH (greg@kroah.com) wrote:
>
> Comments? Places I missed protecting?

Is it safe to ignore pcibios_init? This happens after smp_init, but are
could there be multiple events (that would effect pcibios_sort)?

> --- a/drivers/pci/proc.c Tue Jun 17 12:47:27 2003
> +++ b/drivers/pci/proc.c Tue Jun 17 12:47:27 2003
> @@ -12,6 +12,7 @@
> #include <linux/proc_fs.h>
> #include <linux/seq_file.h>
> #include <linux/smp_lock.h>
> +#include "pci.h"
>
> #include <asm/uaccess.h>
> #include <asm/byteorder.h>
> @@ -311,20 +312,32 @@
> struct list_head *p = &pci_devices;
> loff_t n = *pos;
>
> - /* XXX: surely we need some locking for traversing the list? */
> + spin_lock(&pci_bus_lock);

should you just grab this lock here (pci_seq_start), and release in
pci_seq_stop, holding for duration of ->seq_start() ->seq_next()
->seq_stop(). IOW, what happens when you grab list element in
->seq_start(), it's removed from list, you reference a bogus ->next
pointer in ->seq_next()?

thanks,
-chris

-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:22 EST