Linux/linux e615a19drivers/pci p2pdma.c

PCI/P2PDMA: fix the gen_pool_add_virt() failure path

The pci_p2pdma_add_resource() implementation immediately frees the pgmap
if gen_pool_add_virt() fails.  However, that means that when @dev
triggers a devres release devm_memremap_pages_release() will crash
trying to access the freed @pgmap.

Use the new devm_memunmap_pages() to manually free the mapping in the
error path.

Link: http://lkml.kernel.org/r/155727337603.292046.13101332703665246702.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams at intel.com>
Fixes: 52916982af48 ("PCI/P2PDMA: Support peer-to-peer memory")
Reviewed-by: Ira Weiny <ira.weiny at intel.com>
Acked-by: Bjorn Helgaas <bhelgaas at google.com>
Reviewed-by: Logan Gunthorpe <logang at deltatee.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: "Jérôme Glisse" <jglisse at redhat.com>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
DeltaFile
+3-1drivers/pci/p2pdma.c
+3-11 files

UnifiedSplitRaw