* [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal'
@ 2014-04-10 6:51 Mike Qiu
2014-04-10 7:54 ` Benjamin Herrenschmidt
2014-04-10 15:27 ` Bjorn Helgaas
0 siblings, 2 replies; 5+ messages in thread
From: Mike Qiu @ 2014-04-10 6:51 UTC (permalink / raw)
To: linuxppc-dev; +Cc: wangyijing, Mike Qiu, anton, bhelgaas, paulus
Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc000000000041d78
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP [c000000000041d78] .sys_pciconfig_iobase+0x68/0x1f0
LR [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0
Call Trace:
[c0000003b4787db0] [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0 (unreliable)
[c0000003b4787e30] [c000000000009ed8] syscall_exit+0x0/0x98
This bug was introduced by commit 3bc955987fb377f3c95bc29deb498e96819b8451
The root cause was the 'bus' has been set to null while try to access
bus->next.
Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
---
arch/powerpc/kernel/pci_64.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 2a47790..7b6c1ae 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -209,6 +209,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
{
struct pci_controller* hose;
struct pci_bus *bus = NULL;
+ struct pci_bus *tmp_bus = NULL;
struct device_node *hose_node;
/* Argh ! Please forgive me for that hack, but that's the
@@ -229,10 +230,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
* used on pre-domains setup. We return the first match
*/
- list_for_each_entry(bus, &pci_root_buses, node) {
- if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
+ list_for_each_entry(tmp_bus, &pci_root_buses, node) {
+ if (in_bus >= tmp_bus->number &&
+ in_bus <= tmp_bus->busn_res.end) {
+ bus = tmp_bus;
break;
- bus = NULL;
+ }
}
if (bus == NULL || bus->dev.of_node == NULL)
return -ENODEV;
--
1.8.0.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal'
2014-04-10 6:51 [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal' Mike Qiu
@ 2014-04-10 7:54 ` Benjamin Herrenschmidt
2014-04-10 10:03 ` Mike Qiu
2014-04-10 15:27 ` Bjorn Helgaas
1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2014-04-10 7:54 UTC (permalink / raw)
To: Mike Qiu; +Cc: bhelgaas, paulus, wangyijing, linuxppc-dev, anton
On Thu, 2014-04-10 at 02:51 -0400, Mike Qiu wrote:
> Unable to handle kernel paging request for data at address 0x00000000
> Faulting instruction address: 0xc000000000041d78
> Oops: Kernel access of bad area, sig: 11 [#1]
> ...
> NIP [c000000000041d78] .sys_pciconfig_iobase+0x68/0x1f0
> LR [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0
> Call Trace:
> [c0000003b4787db0] [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0 (unreliable)
> [c0000003b4787e30] [c000000000009ed8] syscall_exit+0x0/0x98
>
> This bug was introduced by commit 3bc955987fb377f3c95bc29deb498e96819b8451
> The root cause was the 'bus' has been set to null while try to access
> bus->next.
Good catch. Out of curiosity, what is using that syscall nowadays ? It's
been long buggy in all sort of ways and is pretty much deprecated...
Cheers,
Ben.
> Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
> ---
> arch/powerpc/kernel/pci_64.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 2a47790..7b6c1ae 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -209,6 +209,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
> {
> struct pci_controller* hose;
> struct pci_bus *bus = NULL;
> + struct pci_bus *tmp_bus = NULL;
> struct device_node *hose_node;
>
> /* Argh ! Please forgive me for that hack, but that's the
> @@ -229,10 +230,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
> * used on pre-domains setup. We return the first match
> */
>
> - list_for_each_entry(bus, &pci_root_buses, node) {
> - if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
> + list_for_each_entry(tmp_bus, &pci_root_buses, node) {
> + if (in_bus >= tmp_bus->number &&
> + in_bus <= tmp_bus->busn_res.end) {
> + bus = tmp_bus;
> break;
> - bus = NULL;
> + }
> }
> if (bus == NULL || bus->dev.of_node == NULL)
> return -ENODEV;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal'
2014-04-10 7:54 ` Benjamin Herrenschmidt
@ 2014-04-10 10:03 ` Mike Qiu
0 siblings, 0 replies; 5+ messages in thread
From: Mike Qiu @ 2014-04-10 10:03 UTC (permalink / raw)
To: linuxppc-dev
On 04/10/2014 03:54 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2014-04-10 at 02:51 -0400, Mike Qiu wrote:
>> Unable to handle kernel paging request for data at address 0x00000000
>> Faulting instruction address: 0xc000000000041d78
>> Oops: Kernel access of bad area, sig: 11 [#1]
>> ...
>> NIP [c000000000041d78] .sys_pciconfig_iobase+0x68/0x1f0
>> LR [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0
>> Call Trace:
>> [c0000003b4787db0] [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0 (unreliable)
>> [c0000003b4787e30] [c000000000009ed8] syscall_exit+0x0/0x98
>>
>> This bug was introduced by commit 3bc955987fb377f3c95bc29deb498e96819b8451
>> The root cause was the 'bus' has been set to null while try to access
>> bus->next.
> Good catch. Out of curiosity, what is using that syscall nowadays ? It's
> been long buggy in all sort of ways and is pretty much deprecated...
>
I just boot my Power7 machine with newest mainline kernel, it happens
and block the system.
I really do not know which software use this syscall, need to do some
research on it.
Thanks
Mike
> Cheers,
> Ben.
>
>> Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/kernel/pci_64.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
>> index 2a47790..7b6c1ae 100644
>> --- a/arch/powerpc/kernel/pci_64.c
>> +++ b/arch/powerpc/kernel/pci_64.c
>> @@ -209,6 +209,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
>> {
>> struct pci_controller* hose;
>> struct pci_bus *bus = NULL;
>> + struct pci_bus *tmp_bus = NULL;
>> struct device_node *hose_node;
>>
>> /* Argh ! Please forgive me for that hack, but that's the
>> @@ -229,10 +230,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
>> * used on pre-domains setup. We return the first match
>> */
>>
>> - list_for_each_entry(bus, &pci_root_buses, node) {
>> - if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
>> + list_for_each_entry(tmp_bus, &pci_root_buses, node) {
>> + if (in_bus >= tmp_bus->number &&
>> + in_bus <= tmp_bus->busn_res.end) {
>> + bus = tmp_bus;
>> break;
>> - bus = NULL;
>> + }
>> }
>> if (bus == NULL || bus->dev.of_node == NULL)
>> return -ENODEV;
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal'
2014-04-10 6:51 [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal' Mike Qiu
2014-04-10 7:54 ` Benjamin Herrenschmidt
@ 2014-04-10 15:27 ` Bjorn Helgaas
2014-04-10 20:55 ` Benjamin Herrenschmidt
1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2014-04-10 15:27 UTC (permalink / raw)
To: Mike Qiu; +Cc: Yijing Wang, linuxppc-dev, anton, paulus
On Thu, Apr 10, 2014 at 12:51 AM, Mike Qiu <qiudayu@linux.vnet.ibm.com> wrote:
> Unable to handle kernel paging request for data at address 0x00000000
> Faulting instruction address: 0xc000000000041d78
> Oops: Kernel access of bad area, sig: 11 [#1]
> ...
> NIP [c000000000041d78] .sys_pciconfig_iobase+0x68/0x1f0
> LR [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0
> Call Trace:
> [c0000003b4787db0] [c000000000041e0c] .sys_pciconfig_iobase+0xfc/0x1f0 (unreliable)
> [c0000003b4787e30] [c000000000009ed8] syscall_exit+0x0/0x98
>
> This bug was introduced by commit 3bc955987fb377f3c95bc29deb498e96819b8451
> The root cause was the 'bus' has been set to null while try to access
> bus->next.
>
> Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
> ---
> arch/powerpc/kernel/pci_64.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 2a47790..7b6c1ae 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -209,6 +209,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
> {
> struct pci_controller* hose;
> struct pci_bus *bus = NULL;
> + struct pci_bus *tmp_bus = NULL;
> struct device_node *hose_node;
>
> /* Argh ! Please forgive me for that hack, but that's the
> @@ -229,10 +230,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
> * used on pre-domains setup. We return the first match
> */
>
> - list_for_each_entry(bus, &pci_root_buses, node) {
> - if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
> + list_for_each_entry(tmp_bus, &pci_root_buses, node) {
> + if (in_bus >= tmp_bus->number &&
> + in_bus <= tmp_bus->busn_res.end) {
> + bus = tmp_bus;
> break;
> - bus = NULL;
> + }
Good fix, thanks. Sorry we didn't catch it before you tripped over
it. Your code is much cleaner than the previous "clear out 'bus' if
we didn't match" style.
Nit: I don't think you need to initialize tmp_bus to NULL.
Ben, I'll pick this up for v3.15 since the original change
(3bc955987fb3) went through my tree, unless you want to handle it.
Bjorn
> }
> if (bus == NULL || bus->dev.of_node == NULL)
> return -ENODEV;
> --
> 1.8.0.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal'
2014-04-10 15:27 ` Bjorn Helgaas
@ 2014-04-10 20:55 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2014-04-10 20:55 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Yijing Wang, linuxppc-dev, Mike Qiu, anton, paulus
On Thu, 2014-04-10 at 09:27 -0600, Bjorn Helgaas wrote:
> Ben, I'll pick this up for v3.15 since the original change
> (3bc955987fb3) went through my tree, unless you want to handle it.
Nah, go for it, I'm about to go on vacation for a week :-)
Thanks !
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-10 20:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 6:51 [PATCH] Fix 3bc95598 'powerpc/PCI: Use list_for_each_entry() for bus traversal' Mike Qiu
2014-04-10 7:54 ` Benjamin Herrenschmidt
2014-04-10 10:03 ` Mike Qiu
2014-04-10 15:27 ` Bjorn Helgaas
2014-04-10 20:55 ` Benjamin Herrenschmidt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.