[PATCH] PCI/P2PDMA: Fix freeing dev_pagemap on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The devres_free() API is only to be used after the resource has been
unlinked from the device tracking it. Calling this functino directly will
hit a kernel BUG_ON. This patch fixes this to use the managed resource
release function, devm_kfree().

Fixes: 1380472e7b855 ("PCI/P2PDMA: Support peer-to-peer memory")
Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Signed-off-by: Keith Busch <keith.busch@xxxxxxxxx>
---
 drivers/pci/p2pdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index da66c7e31730..9c56a10eff15 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -222,7 +222,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size,
 	return 0;
 
 pgmap_free:
-	devres_free(pgmap);
+	devm_kfree(&pci->dev, pgmap);
 	return error;
 }
 EXPORT_SYMBOL_GPL(pci_p2pdma_add_resource);
-- 
2.14.4




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux