Sergei Shtylyov
3934e010d8
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:12:40 +02:00
..
2016-10-12 11:01:37 -07:00
2016-10-05 10:11:24 -07:00
2017-02-18 15:11:40 +01:00
2017-03-15 10:02:51 +08:00
2018-08-24 13:12:40 +02:00
2016-10-11 15:06:33 -07:00
2018-07-03 11:23:11 +02:00
2016-10-17 16:26:29 +01:00
2017-03-15 10:02:46 +08:00
2016-10-07 08:35:35 -07:00
2018-04-13 19:48:19 +02:00
2018-04-13 19:48:04 +02:00
2018-08-03 07:55:22 +02:00
2018-05-01 15:13:07 -07:00
2018-08-03 07:55:13 +02:00
2016-10-03 19:43:08 -07:00
2016-11-05 13:45:02 +05:30
2018-03-22 09:17:50 +01:00
2017-01-19 20:18:07 +01:00
2016-10-22 17:08:07 -04:00
2016-10-07 09:45:43 -07:00
2018-03-22 09:17:44 +01:00
2016-09-30 09:14:10 -07:00
2017-09-27 14:39:18 +02:00
2018-05-25 16:13:04 +02:00
2017-12-20 10:07:26 +01:00
2018-07-22 14:27:41 +02:00
2016-09-27 12:54:03 +02:00
2017-10-08 10:26:06 +02:00
2016-10-11 15:06:31 -07:00
2016-10-11 15:06:31 -07:00
2018-04-24 09:34:18 +02:00
2018-04-24 09:34:18 +02:00
2016-10-07 18:46:26 -07:00
2016-10-14 12:18:50 -07:00
2016-10-09 17:32:20 -07:00
2018-07-03 11:23:18 +02:00
2016-10-07 18:46:28 -07:00
2018-01-17 09:38:55 +01:00
2018-01-31 12:55:57 +01:00
2017-12-09 22:01:54 +01:00
2018-01-31 12:55:51 +01:00
2017-01-06 10:40:13 +01:00
2017-09-27 14:39:20 +02:00
2018-03-31 18:11:33 +02:00
2017-06-14 15:06:00 +02:00
2016-10-17 15:27:27 -07:00
2016-10-07 18:46:29 -07:00
2017-03-12 06:41:44 +01:00
2018-08-15 18:14:42 +02:00
2018-07-22 14:27:35 +02:00
2018-07-03 11:23:07 +02:00
2016-11-11 08:12:37 -08:00
2017-07-05 14:40:26 +02:00
2018-08-15 18:14:53 +02:00
2016-10-20 16:35:50 +02:00
2018-01-02 20:35:17 +01:00
2018-05-30 07:50:26 +02:00
2017-10-12 11:51:25 +02:00
2018-01-10 09:29:52 +01:00
2018-02-25 11:05:44 +01:00
2016-10-11 15:06:30 -07:00
2018-02-28 10:18:33 +01:00
2018-05-30 07:50:16 +02:00
2017-03-22 12:43:33 +01:00
2017-03-15 10:02:44 +08:00
2017-03-12 06:41:44 +01:00
2017-07-15 12:16:11 +02:00
2016-09-26 22:16:41 +05:30
2018-08-03 07:55:22 +02:00
2017-12-14 09:28:11 +01:00
2018-05-22 16:57:58 +02:00
2016-10-14 14:26:58 -07:00
2016-10-06 09:07:44 -04:00
2017-05-14 14:00:22 +02:00
2016-10-03 09:11:14 -07:00
2017-07-12 15:01:02 +02:00
2018-02-13 12:36:00 +01:00
2017-12-09 22:01:56 +01:00
2018-01-17 09:38:58 +01:00
2016-11-11 08:12:37 -08:00
2018-03-22 09:18:00 +01:00
2017-06-17 06:41:52 +02:00
2018-01-10 09:29:52 +01:00
2017-03-31 10:31:46 +02:00
2018-03-28 18:39:23 +02:00
2016-10-07 18:46:26 -07:00
2017-08-06 18:59:43 -07:00
2016-10-06 11:48:41 -07:00
2017-12-14 09:28:22 +01:00
2017-05-14 14:00:22 +02:00
2017-05-25 15:44:41 +02:00
2018-04-24 09:34:12 +02:00
2016-11-17 09:46:56 -08:00
2016-10-07 18:46:29 -07:00
2017-10-27 10:38:08 +02:00
2016-09-24 10:48:18 +02:00
2016-09-24 08:01:26 -04:00
2016-10-07 23:50:39 -04:00
2018-04-29 11:32:01 +02:00
2018-04-08 12:12:52 +02:00
2017-03-12 06:41:43 +01:00
2016-10-26 15:45:38 +10:00
2016-10-20 15:51:28 +11:00
2018-01-02 20:35:11 +01:00
2017-02-09 08:08:31 +01:00
2018-02-22 15:43:48 +01:00
2018-04-08 12:12:45 +02:00
2017-01-19 20:17:59 +01:00
2016-10-03 13:22:39 -07:00
2018-02-22 15:43:55 +01:00
2016-10-16 11:02:31 +02:00
2016-10-27 18:43:43 -07:00
2018-05-30 07:50:26 +02:00
2016-10-09 12:23:38 -07:00
2018-02-28 10:18:34 +01:00
2016-10-11 15:06:33 -07:00
2017-10-27 10:38:11 +02:00
2016-10-11 15:06:33 -07:00
2017-05-25 15:44:47 +02:00
2016-10-11 15:06:33 -07:00
2016-10-05 10:11:24 -07:00
2018-05-30 07:50:30 +02:00
2018-07-17 11:37:52 +02:00
2017-03-15 10:02:47 +08:00
2017-07-21 07:42:21 +02:00
2018-04-08 12:12:50 +02:00
2016-09-24 10:48:32 +02:00
2017-06-17 06:41:51 +02:00
2017-10-27 10:38:08 +02:00
2016-09-27 12:33:47 +02:00
2017-08-24 17:12:19 -07:00
2017-04-08 09:30:35 +02:00
2017-02-09 08:08:28 +01:00
2017-06-17 06:41:54 +02:00
2017-01-19 20:17:59 +01:00
2017-08-11 08:49:29 -07:00
2018-05-19 10:27:00 +02:00
2017-12-20 10:07:29 +01:00
2017-12-14 09:28:16 +01:00
2018-01-31 12:55:53 +01:00
2018-02-13 12:35:58 +01:00
2017-03-15 10:02:44 +08:00
2016-09-25 23:41:39 -04:00
2016-09-25 23:41:39 -04:00
2016-10-07 09:20:53 -07:00
2017-11-18 11:22:21 +01:00
2016-09-25 14:38:48 +02:00
2016-09-25 23:34:19 +02:00
2017-02-01 08:33:08 +01:00
2017-08-11 08:49:28 -07:00
2017-06-17 06:41:57 +02:00
2018-05-22 16:58:02 +02:00
2016-10-19 11:36:22 -06:00
2016-09-28 17:43:15 +02:00
2016-10-03 23:38:11 +02:00
2016-11-29 23:17:02 -05:00
2016-09-28 08:53:14 +05:30
2017-12-14 09:28:16 +01:00
2016-10-07 18:46:28 -07:00
2016-10-07 18:46:27 -07:00
2016-10-07 18:46:27 -07:00
2018-03-22 09:17:44 +01:00
2017-09-09 17:39:41 +02:00
2018-02-25 11:05:51 +01:00
2018-08-24 13:12:40 +02:00
2018-01-05 15:46:35 +01:00
2017-02-09 08:08:28 +01:00
2017-12-09 22:01:52 +01:00
2018-01-17 09:38:53 +01:00
2017-08-24 17:12:21 -07:00
2016-10-05 18:24:00 -04:00
2016-10-14 11:36:59 -07:00
2017-01-06 10:40:15 +01:00
2016-09-27 21:52:00 -04:00
2016-10-08 11:06:08 -04:00
2018-03-24 11:00:09 +01:00
2017-11-15 15:53:17 +01:00
2016-10-09 12:23:38 -07:00
2018-05-30 07:50:21 +02:00
2018-04-20 08:21:05 +02:00
2017-08-06 18:59:43 -07:00
2018-05-30 07:50:27 +02:00
2017-06-14 15:05:54 +02:00
2016-10-11 15:06:30 -07:00
2017-04-12 12:41:15 +02:00
2017-12-16 16:25:45 +01:00
2017-01-26 08:24:37 +01:00
2016-10-29 12:14:39 -06:00
2016-10-11 15:06:32 -07:00
2016-10-02 22:50:21 -07:00
2018-03-31 18:11:33 +02:00
2018-08-09 12:17:59 +02:00
2018-07-28 07:49:14 +02:00
2018-05-22 16:58:01 +02:00
2016-10-11 15:06:33 -07:00
2016-10-07 18:46:30 -07:00
2018-08-03 07:55:25 +02:00
2018-01-17 09:38:53 +01:00
2018-05-22 16:57:57 +02:00
2017-08-30 10:21:40 +02:00
2018-07-28 07:49:12 +02:00
2017-08-11 08:49:36 -07:00
2016-10-05 18:23:36 -04:00
2018-07-22 14:27:42 +02:00
2018-05-30 07:50:24 +02:00
2017-01-19 20:17:59 +01:00
2018-08-15 18:14:45 +02:00
2017-01-26 08:24:44 +01:00
2016-10-17 09:50:56 -07:00
2018-08-15 18:14:43 +02:00
2017-12-14 09:28:11 +01:00
2018-06-06 16:44:34 +02:00
2016-09-27 14:35:21 +08:00
2018-08-09 12:18:00 +02:00
2017-06-29 13:00:30 +02:00
2018-01-02 20:35:17 +01:00
2017-10-12 11:51:21 +02:00
2017-09-27 14:39:19 +02:00
2018-05-01 15:13:05 -07:00
2016-09-30 11:46:40 +02:00
2017-04-21 09:31:21 +02:00
2017-03-18 19:14:29 +08:00
2018-01-31 12:55:52 +01:00
2017-07-27 15:08:03 -07:00
2017-02-04 09:47:09 +01:00
2017-12-25 14:23:37 +01:00
2018-05-01 15:13:05 -07:00
2018-01-02 20:35:18 +01:00
2016-09-30 10:54:03 +02:00
2016-10-08 10:27:10 +02:00
2018-03-18 11:18:48 +01:00
2016-10-07 18:46:27 -07:00
2016-10-07 21:48:36 -04:00