[PATCH 01/13] PCI/P2PDMA: Release the per-cpu ref of pgmap when vm_insert_page() fails
Logan Gunthorpe
logang at deltatee.com
Mon Dec 22 08:49:41 PST 2025
On 2025-12-19 21:04, Hou Tao wrote:
> From: Hou Tao <houtao1 at huawei.com>
>
> When vm_insert_page() fails in p2pmem_alloc_mmap(), p2pmem_alloc_mmap()
> doesn't invoke percpu_ref_put() to free the per-cpu ref of pgmap
> acquired after gen_pool_alloc_owner(), and memunmap_pages() will hang
> forever when trying to remove the PCIe device.
>
> Fix it by adding the missed percpu_ref_put().
>
> Fixes: 7e9c7ef83d78 ("PCI/P2PDMA: Allow userspace VMA allocations through sysfs")
> Signed-off-by: Hou Tao <houtao1 at huawei.com>
Nice catch, thanks:
Reviewed-by: Logan Gunthorpe <logang at deltatee.com>
Logan
More information about the Linux-nvme
mailing list