Skip to content

Commit

Permalink
pci_iounmap(): Fix MMIO mapping leak
Browse files Browse the repository at this point in the history
[ Upstream commit 7626913 ]

The #ifdef ARCH_HAS_GENERIC_IOPORT_MAP accidentally also guards iounmap(),
which means MMIO mappings are leaked.

Move the guard so we call iounmap() for MMIO mappings.

Fixes: 316e8d7 ("pci_iounmap'2: Electric Boogaloo: try to make sense of it all")
Link: https://lore.kernel.org/r/20240131090023.12331-2-pstanner@redhat.com
Reported-by: Danilo Krummrich <dakr@redhat.com>
Suggested-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: <stable@vger.kernel.org> # v5.15+
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Philipp Stanner authored and gregkh committed Apr 3, 2024
1 parent 104a5b2 commit f374934
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pci_iomap.c
Expand Up @@ -170,8 +170,8 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *p)

if (addr >= start && addr < start + IO_SPACE_LIMIT)
return;
iounmap(p);
#endif
iounmap(p);
}
EXPORT_SYMBOL(pci_iounmap);

Expand Down

0 comments on commit f374934

Please sign in to comment.