Sergei Shtylyov
0e66392d98
PCI: OF: Fix I/O space page leak
commit a5fb9fb023 upstream.
When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY
driver was left disabled, the kernel crashed with this BUG:
kernel BUG at lib/ioremap.c:72!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
Hardware name: Renesas Condor board based on r8a77980 (DT)
Workqueue: events deferred_probe_work_func
pstate: 80000005 (Nzcv daif -PAN -UAO)
pc : ioremap_page_range+0x370/0x3c8
lr : ioremap_page_range+0x40/0x3c8
sp : ffff000008da39e0
x29: ffff000008da39e0 x28: 00e8000000000f07
x27: ffff7dfffee00000 x26: 0140000000000000
x25: ffff7dfffef00000 x24: 00000000000fe100
x23: ffff80007b906000 x22: ffff000008ab8000
x21: ffff000008bb1d58 x20: ffff7dfffef00000
x19: ffff800009c30fb8 x18: 0000000000000001
x17: 00000000000152d0 x16: 00000000014012d0
x15: 0000000000000000 x14: 0720072007200720
x13: 0720072007200720 x12: 0720072007200720
x11: 0720072007300730 x10: 00000000000000ae
x9 : 0000000000000000 x8 : ffff7dffff000000
x7 : 0000000000000000 x6 : 0000000000000100
x5 : 0000000000000000 x4 : 000000007b906000
x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
x1 : 0000000040000000 x0 : 00e80000fe100f07
Process kworker/0:1 (pid: 39, stack limit = 0x (ptrval))
Call trace:
ioremap_page_range+0x370/0x3c8
pci_remap_iospace+0x7c/0xac
pci_parse_request_of_pci_ranges+0x13c/0x190
rcar_pcie_probe+0x4c/0xb04
platform_drv_probe+0x50/0xbc
driver_probe_device+0x21c/0x308
__device_attach_driver+0x98/0xc8
bus_for_each_drv+0x54/0x94
__device_attach+0xc4/0x12c
device_initial_probe+0x10/0x18
bus_probe_device+0x90/0x98
deferred_probe_work_func+0xb0/0x150
process_one_work+0x12c/0x29c
worker_thread+0x200/0x3fc
kthread+0x108/0x134
ret_from_fork+0x10/0x18
Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)
It turned out that pci_remap_iospace() wasn't undone when the driver's
probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER,
the probe was retried, finally causing the BUG due to trying to remap
already remapped pages.
Introduce the devm_pci_remap_iospace() managed API and replace the
pci_remap_iospace() call with it to fix the bug.
Fixes: dbf9826d57 ("PCI: generic: Convert to DT resource parsing API")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[lorenzo.pieralisi@arm.com: split commit/updated the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-24 13:09:19 +02:00
..
2018-08-24 13:09:18 +02:00
2018-06-05 11:41:58 +02:00
2018-03-21 12:06:43 +01:00
2018-07-22 14:28:44 +02:00
2018-08-03 07:50:36 +02:00
2018-06-21 04:02:59 +09:00
2018-08-03 07:50:23 +02:00
2018-08-03 07:50:40 +02:00
2018-07-25 11:25:11 +02:00
2018-05-25 16:17:41 +02:00
2018-07-08 15:30:46 +02:00
2018-07-22 14:28:50 +02:00
2018-07-22 14:28:43 +02:00
2018-07-22 14:28:49 +02:00
2018-04-24 09:36:39 +02:00
2018-05-30 07:52:09 +02:00
2018-04-08 14:26:30 +02:00
2018-04-24 09:36:29 +02:00
2018-07-03 11:25:05 +02:00
2018-02-22 15:42:23 +01:00
2018-03-31 18:10:40 +02:00
2018-06-21 04:02:42 +09:00
2018-08-15 18:12:47 +02:00
2018-07-22 14:28:41 +02:00
2018-07-03 11:24:49 +02:00
2018-08-15 18:13:00 +02:00
2018-02-22 15:42:20 +01:00
2018-04-26 11:02:21 +02:00
2018-02-16 20:23:00 +01:00
2018-07-11 16:29:22 +02:00
2018-05-30 07:51:47 +02:00
2018-08-03 07:50:38 +02:00
2018-03-19 08:42:47 +01:00
2018-08-03 07:50:35 +02:00
2018-02-22 15:42:23 +01:00
2018-05-22 18:54:00 +02:00
2018-04-26 11:02:19 +02:00
2018-06-21 04:02:48 +09:00
2018-02-22 15:42:23 +01:00
2018-03-21 12:06:43 +01:00
2018-03-28 18:24:43 +02:00
2018-04-29 11:33:16 +02:00
2018-06-21 04:02:49 +09:00
2018-02-22 15:42:23 +01:00
2018-04-24 09:36:37 +02:00
2018-04-29 11:33:16 +02:00
2018-05-30 07:52:22 +02:00
2018-03-15 10:54:36 +01:00
2018-02-22 15:42:24 +01:00
2018-02-22 15:42:26 +01:00
2018-02-28 10:19:41 +01:00
2018-04-26 11:02:20 +02:00
2018-06-21 04:02:57 +09:00
2018-07-17 11:39:25 +02:00
2018-03-28 18:24:39 +02:00
2018-02-22 15:42:31 +01:00
2018-02-22 15:42:23 +01:00
2018-07-11 16:29:20 +02:00
2018-02-22 15:42:23 +01:00
2018-07-22 14:28:44 +02:00
2018-02-16 20:22:58 +01:00
2018-05-22 18:54:04 +02:00
2018-05-16 10:10:27 +02:00
2018-08-24 13:09:19 +02:00
2018-06-21 04:03:00 +09:00
2018-03-31 18:10:39 +02:00
2018-04-26 11:02:12 +02:00
2018-02-16 20:22:56 +01:00
2018-05-30 07:51:54 +02:00
2018-03-31 18:10:40 +02:00
2018-08-09 12:16:38 +02:00
2018-06-21 04:03:00 +09:00
2018-06-21 04:02:54 +09:00
2018-05-22 18:54:04 +02:00
2018-02-25 11:07:53 +01:00
2018-08-03 07:50:39 +02:00
2018-07-28 07:55:43 +02:00
2018-02-22 15:42:23 +01:00
2018-07-03 11:25:04 +02:00
2018-07-22 14:28:52 +02:00
2018-06-21 04:02:51 +09:00
2018-04-26 11:02:16 +02:00
2018-08-15 18:12:51 +02:00
2018-06-05 11:41:58 +02:00
2018-08-03 07:50:20 +02:00
2018-04-29 11:33:10 +02:00
2018-05-01 12:58:13 -07:00
2018-05-25 16:17:37 +02:00
2018-02-25 11:07:45 +01:00
2018-06-26 08:06:28 +08:00
2018-05-01 12:58:11 -07:00
2018-05-16 10:10:25 +02:00
2018-03-15 10:54:29 +01:00