]> git.baikalelectronics.ru Git - kernel.git/commit
vfio iommu type1: Fix memory leak in vfio_iommu_type1_pin_pages
authorXiaoyang Xu <xuxiaoyang2@huawei.com>
Fri, 16 Oct 2020 09:35:58 +0000 (17:35 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 20 Oct 2020 16:12:17 +0000 (10:12 -0600)
commit1ee90a71b1bcb1b8405b999eeb24c204b55e0fc3
treee3d4ec36020175bfb34add2a2aaf72e2a3711782
parenta04ab1eb805574a79f6186cdc42781026fafdef3
vfio iommu type1: Fix memory leak in vfio_iommu_type1_pin_pages

pfn is not added to pfn_list when vfio_add_to_pfn_list fails.
vfio_unpin_page_external will exit directly without calling
vfio_iova_put_vfio_pfn.  This will lead to a memory leak.

Fixes: 576a8392f4c4 ("vfio iommu type1: Add support for mediated devices")
Signed-off-by: Xiaoyang Xu <xuxiaoyang2@huawei.com>
[aw: simplified logic, add Fixes]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c