PCI/P2PDMA: Fix freeing dev_pagemap on error
Subsystems (2)
PATCH v2 1/1 PCI/P2PDMA: Fix freeing dev_pagemap on error
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().
---
v1 -> v2:
Fixed compile breaking typo in code
drivers/pci/p2pdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/p2pdma.c +1 -1
@@ -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 (&pdev->dev, pgmap);return error; }EXPORT_SYMBOL_GPL (pci_p2pdma_add_resource);
Signature · 1 line
2.14.4
Quoted 8 lines · Keith Busch
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 kernelBUG_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 <[email protected]>Signed-off-by Keith Busch <[email protected]>
I folded this fix into the original 1380472e7b855 commit (now 31fd98513249 ("PCI/P2PDMA: Support peer-to-peer memory"), thanks!
Quoted 24 lines
---
v1 -> v2:Fixed compile breaking typo in code
drivers/pci/p2pdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/p2pdma.c +1
-1@@ -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 (&pdev->dev, pgmap);return error; }EXPORT_SYMBOL_GPL (pci_p2pdma_add_resource);Signature · 1 line
2.14.4