Re: [patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-05 Thread Chris Wright
* Kumar Gala ([EMAIL PROTECTED]) wrote:
> 
> On Feb 2, 2007, at 8:35 PM, Chris Wright wrote:
> 
> >-stable review patch.  If anyone has any objections, please let us  
> >know.
> >--
> 
> We just updated this for mainline to remove the printks.  I'd prefer  
> to see that version of this patch go in.

Thanks, I was able to fold that minor simplification in.
-chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-05 Thread Chris Wright
* Kumar Gala ([EMAIL PROTECTED]) wrote:
 
 On Feb 2, 2007, at 8:35 PM, Chris Wright wrote:
 
 -stable review patch.  If anyone has any objections, please let us  
 know.
 --
 
 We just updated this for mainline to remove the printks.  I'd prefer  
 to see that version of this patch go in.

Thanks, I was able to fold that minor simplification in.
-chris
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-03 Thread Kumar Gala


On Feb 2, 2007, at 8:35 PM, Chris Wright wrote:

-stable review patch.  If anyone has any objections, please let us  
know.

--


We just updated this for mainline to remove the printks.  I'd prefer  
to see that version of this patch go in.


- k



From: Ard van Breemen <[EMAIL PROTECTED]>

The pci_find_subsys gets called very early by obsolete ide setup  
parameters.
This is a bogus call since pci is not initialized yet, so the list  
is empty.
But in the mean time, interrupts get enabled by down_read.  This  
can result in

a kernel panic when the irq controller gets initialized.

This patch checks if the device list is empty before taking the  
semaphore, and
hence will not enable irq's.  Furthermore it will inform that it is  
called
while pci_devices is empty as a reminder that the ide code needs to  
be fixed.


The pci_get_subsys can get called in the same manner, and as such  
is patched

in the same manner.

[EMAIL PROTECTED]: cleanups]
Signed-off-by: Ard van Breemen <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
---
This is the other half of the fix for bug #7505

 drivers/pci/search.c |   24 
 1 file changed, 24 insertions(+)

--- linux-2.6.19.2.orig/drivers/pci/search.c
+++ linux-2.6.19.2/drivers/pci/search.c
@@ -193,6 +193,18 @@ static struct pci_dev * pci_find_subsys(
struct pci_dev *dev;

WARN_ON(in_interrupt());
+
+   /*
+	 * pci_find_subsys() can be called on the ide_setup() path, super- 
early

+* in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag  
that

+* situation and bail out early.
+*/
+   if (unlikely(list_empty(_devices))) {
+   printk(KERN_INFO "pci_find_subsys() called while pci_devices "
+   "is still empty\n");
+   return NULL;
+   }
down_read(_bus_sem);
n = from ? from->global_list.next : pci_devices.next;

@@ -259,6 +271,18 @@ pci_get_subsys(unsigned int vendor, unsi
struct pci_dev *dev;

WARN_ON(in_interrupt());
+
+   /*
+* pci_get_subsys() can potentially be called by drivers super-early
+* in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag  
that

+* situation and bail out early.
+*/
+   if (unlikely(list_empty(_devices))) {
+   printk(KERN_NOTICE "pci_get_subsys() called while pci_devices "
+   "is still empty\n");
+   return NULL;
+   }
down_read(_bus_sem);
n = from ? from->global_list.next : pci_devices.next;


--
-
To unsubscribe from this list: send the line "unsubscribe linux- 
kernel" in

the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-03 Thread Kumar Gala


On Feb 2, 2007, at 8:35 PM, Chris Wright wrote:

-stable review patch.  If anyone has any objections, please let us  
know.

--


We just updated this for mainline to remove the printks.  I'd prefer  
to see that version of this patch go in.


- k



From: Ard van Breemen [EMAIL PROTECTED]

The pci_find_subsys gets called very early by obsolete ide setup  
parameters.
This is a bogus call since pci is not initialized yet, so the list  
is empty.
But in the mean time, interrupts get enabled by down_read.  This  
can result in

a kernel panic when the irq controller gets initialized.

This patch checks if the device list is empty before taking the  
semaphore, and
hence will not enable irq's.  Furthermore it will inform that it is  
called
while pci_devices is empty as a reminder that the ide code needs to  
be fixed.


The pci_get_subsys can get called in the same manner, and as such  
is patched

in the same manner.

[EMAIL PROTECTED]: cleanups]
Signed-off-by: Ard van Breemen [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Chris Wright [EMAIL PROTECTED]
---
This is the other half of the fix for bug #7505

 drivers/pci/search.c |   24 
 1 file changed, 24 insertions(+)

--- linux-2.6.19.2.orig/drivers/pci/search.c
+++ linux-2.6.19.2/drivers/pci/search.c
@@ -193,6 +193,18 @@ static struct pci_dev * pci_find_subsys(
struct pci_dev *dev;

WARN_ON(in_interrupt());
+
+   /*
+	 * pci_find_subsys() can be called on the ide_setup() path, super- 
early

+* in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag  
that

+* situation and bail out early.
+*/
+   if (unlikely(list_empty(pci_devices))) {
+   printk(KERN_INFO pci_find_subsys() called while pci_devices 
+   is still empty\n);
+   return NULL;
+   }
down_read(pci_bus_sem);
n = from ? from-global_list.next : pci_devices.next;

@@ -259,6 +271,18 @@ pci_get_subsys(unsigned int vendor, unsi
struct pci_dev *dev;

WARN_ON(in_interrupt());
+
+   /*
+* pci_get_subsys() can potentially be called by drivers super-early
+* in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag  
that

+* situation and bail out early.
+*/
+   if (unlikely(list_empty(pci_devices))) {
+   printk(KERN_NOTICE pci_get_subsys() called while pci_devices 
+   is still empty\n);
+   return NULL;
+   }
down_read(pci_bus_sem);
n = from ? from-global_list.next : pci_devices.next;


--
-
To unsubscribe from this list: send the line unsubscribe linux- 
kernel in

the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-02 Thread Chris Wright
-stable review patch.  If anyone has any objections, please let us know.
--

From: Ard van Breemen <[EMAIL PROTECTED]>

The pci_find_subsys gets called very early by obsolete ide setup parameters.
This is a bogus call since pci is not initialized yet, so the list is empty.
But in the mean time, interrupts get enabled by down_read.  This can result in
a kernel panic when the irq controller gets initialized.

This patch checks if the device list is empty before taking the semaphore, and
hence will not enable irq's.  Furthermore it will inform that it is called
while pci_devices is empty as a reminder that the ide code needs to be fixed.

The pci_get_subsys can get called in the same manner, and as such is patched
in the same manner.

[EMAIL PROTECTED]: cleanups]
Signed-off-by: Ard van Breemen <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
---
This is the other half of the fix for bug #7505

 drivers/pci/search.c |   24 
 1 file changed, 24 insertions(+)

--- linux-2.6.19.2.orig/drivers/pci/search.c
+++ linux-2.6.19.2/drivers/pci/search.c
@@ -193,6 +193,18 @@ static struct pci_dev * pci_find_subsys(
struct pci_dev *dev;
 
WARN_ON(in_interrupt());
+
+   /*
+* pci_find_subsys() can be called on the ide_setup() path, super-early
+* in boot.  But the down_read() will enable local interrupts, which
+* can cause some machines to crash.  So here we detect and flag that
+* situation and bail out early.
+*/
+   if (unlikely(list_empty(_devices))) {
+   printk(KERN_INFO "pci_find_subsys() called while pci_devices "
+   "is still empty\n");
+   return NULL;
+   }
down_read(_bus_sem);
n = from ? from->global_list.next : pci_devices.next;
 
@@ -259,6 +271,18 @@ pci_get_subsys(unsigned int vendor, unsi
struct pci_dev *dev;
 
WARN_ON(in_interrupt());
+
+   /*
+* pci_get_subsys() can potentially be called by drivers super-early
+* in boot.  But the down_read() will enable local interrupts, which
+* can cause some machines to crash.  So here we detect and flag that
+* situation and bail out early.
+*/
+   if (unlikely(list_empty(_devices))) {
+   printk(KERN_NOTICE "pci_get_subsys() called while pci_devices "
+   "is still empty\n");
+   return NULL;
+   }
down_read(_bus_sem);
n = from ? from->global_list.next : pci_devices.next;
 

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 17/59] PCI: prevent down_read when pci_devices is empty

2007-02-02 Thread Chris Wright
-stable review patch.  If anyone has any objections, please let us know.
--

From: Ard van Breemen [EMAIL PROTECTED]

The pci_find_subsys gets called very early by obsolete ide setup parameters.
This is a bogus call since pci is not initialized yet, so the list is empty.
But in the mean time, interrupts get enabled by down_read.  This can result in
a kernel panic when the irq controller gets initialized.

This patch checks if the device list is empty before taking the semaphore, and
hence will not enable irq's.  Furthermore it will inform that it is called
while pci_devices is empty as a reminder that the ide code needs to be fixed.

The pci_get_subsys can get called in the same manner, and as such is patched
in the same manner.

[EMAIL PROTECTED]: cleanups]
Signed-off-by: Ard van Breemen [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
Signed-off-by: Chris Wright [EMAIL PROTECTED]
---
This is the other half of the fix for bug #7505

 drivers/pci/search.c |   24 
 1 file changed, 24 insertions(+)

--- linux-2.6.19.2.orig/drivers/pci/search.c
+++ linux-2.6.19.2/drivers/pci/search.c
@@ -193,6 +193,18 @@ static struct pci_dev * pci_find_subsys(
struct pci_dev *dev;
 
WARN_ON(in_interrupt());
+
+   /*
+* pci_find_subsys() can be called on the ide_setup() path, super-early
+* in boot.  But the down_read() will enable local interrupts, which
+* can cause some machines to crash.  So here we detect and flag that
+* situation and bail out early.
+*/
+   if (unlikely(list_empty(pci_devices))) {
+   printk(KERN_INFO pci_find_subsys() called while pci_devices 
+   is still empty\n);
+   return NULL;
+   }
down_read(pci_bus_sem);
n = from ? from-global_list.next : pci_devices.next;
 
@@ -259,6 +271,18 @@ pci_get_subsys(unsigned int vendor, unsi
struct pci_dev *dev;
 
WARN_ON(in_interrupt());
+
+   /*
+* pci_get_subsys() can potentially be called by drivers super-early
+* in boot.  But the down_read() will enable local interrupts, which
+* can cause some machines to crash.  So here we detect and flag that
+* situation and bail out early.
+*/
+   if (unlikely(list_empty(pci_devices))) {
+   printk(KERN_NOTICE pci_get_subsys() called while pci_devices 
+   is still empty\n);
+   return NULL;
+   }
down_read(pci_bus_sem);
n = from ? from-global_list.next : pci_devices.next;
 

--
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/