Skip to content

Commit

Permalink
iommufd: iommufd_hw_pagetable_dma_fault_destroy check header
Browse files Browse the repository at this point in the history
If guest do not have device buildin,
iommufd_hwpt_alloc cmd->eventfd=-1
iommufd_hw_pagetable_dma_fault_init will not be called
s1->fault_pages is NULL
iommufd_hw_pagetable_dma_fault_destroy fail with NULL pointer

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
  • Loading branch information
zhangfeigao committed Feb 2, 2023
1 parent 316b8f2 commit f3a739e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/iommu/iommufd/hw_pagetable.c
Expand Up @@ -25,6 +25,9 @@ iommufd_hw_pagetable_dma_fault_destroy(struct iommufd_hw_pagetable *hwpt)
struct iommufd_stage1_dma_fault *header =
(struct iommufd_stage1_dma_fault *)s1->fault_pages;

if (!header)
return;

WARN_ON(header->tail != header->head);
iommufd_hw_pagetable_eventfd_destroy(&s1->trigger);
kfree(s1->fault_pages);
Expand Down

0 comments on commit f3a739e

Please sign in to comment.