]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/PCI: Fix NULL dereference in sys_pciconfig_iobase() list traversal
authorMike Qiu <qiudayu@linux.vnet.ibm.com>
Mon, 14 Apr 2014 22:12:35 +0000 (16:12 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 14 Apr 2014 22:12:35 +0000 (16:12 -0600)
commit05b7d3ff69645d9c5d5b2e5075682cb2e36917cf
tree6cc7d886506931f27419040efd98e096508fb501
parent03a169e57a9a3fd69c1713c317a06f163ad63b5c
powerpc/PCI: Fix NULL dereference in sys_pciconfig_iobase() list traversal

b05a2717ad85 ("powerpc/PCI: Use list_for_each_entry() for bus traversal")
caused a NULL pointer dereference because the loop body set the iterator to
NULL:

  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

Fix it by using a temporary variable for the iterator.

[bhelgaas: changelog, drop tmp_bus initialization]
Fixes: b05a2717ad85 powerpc/PCI: Use list_for_each_entry() for bus traversal
Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
arch/powerpc/kernel/pci_64.c