Geert Uytterhoeven
6d4fabc6c7
PCI: Fix pci_register_io_range() memory leak
...
[ Upstream commit f6bda644fa3a7070621c3bf12cd657f69a42f170 ]
Kmemleak reports:
unreferenced object 0xc328de40 (size 64):
comm "kworker/1:1", pid 21, jiffies 4294938212 (age 1484.670s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 e0 d8 fc eb 00 00 00 00 ................
00 00 10 fe 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ad758d10>] pci_register_io_range+0x3c/0x80
[<2c7f139e>] of_pci_range_to_resource+0x48/0xc0
[<f079ecc8>] devm_of_pci_get_host_bridge_resources.constprop.0+0x2ac/0x3ac
[<e999753b>] devm_of_pci_bridge_init+0x60/0x1b8
[<a895b229>] devm_pci_alloc_host_bridge+0x54/0x64
[<e451ddb0>] rcar_pcie_probe+0x2c/0x644
In case a PCI host driver's probe is deferred, the same I/O range may be
allocated again, and be ignored, causing a memory leak.
Fix this by (a) letting logic_pio_register_range() return -EEXIST if the
passed range already exists, so pci_register_io_range() will free it, and
by (b) making pci_register_io_range() not consider -EEXIST an error
condition.
Link: https://lore.kernel.org/r/20210202100332.829047-1-geert+renesas@glider.be
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-17 17:06:25 +01:00
..
2021-03-17 17:06:24 +01:00
2020-08-05 18:23:14 -05:00
2020-10-22 12:41:00 -07:00
2021-03-17 17:06:24 +01:00
2020-07-31 11:23:45 -05:00
2020-08-05 18:24:16 -05:00
2020-08-05 18:24:22 -05:00
2020-07-07 17:33:41 -05:00
2020-09-17 12:27:43 -05:00
2020-09-21 14:42:11 -06:00
2020-07-29 14:25:18 -05:00
2020-10-22 12:41:00 -07:00
2020-09-16 16:52:37 +02:00
2020-08-05 18:24:22 -05:00
2020-10-22 12:41:00 -07:00
2020-12-30 11:54:05 +01:00
2021-03-04 11:38:15 +01:00
2020-10-22 12:41:00 -07:00
2020-06-30 13:05:09 -05:00
2020-09-17 12:40:20 -05:00
2020-10-21 09:58:36 -05:00
2021-03-17 17:06:25 +01:00
2020-09-30 17:01:46 -05:00
2020-10-21 09:58:39 -05:00
2020-08-23 17:36:59 -05:00
2021-03-11 14:17:26 +01:00
2020-05-14 16:36:35 -05:00
2020-08-23 17:36:59 -05:00
2021-03-04 11:37:18 +01:00
2020-12-30 11:54:28 +01:00
2021-03-04 11:38:12 +01:00
2020-08-05 18:23:14 -05:00
2020-10-06 07:07:03 +02:00