diff options
| author | Jason Gunthorpe <[email protected]> | 2025-05-14 12:48:55 +0000 |
|---|---|---|
| committer | Joerg Roedel <[email protected]> | 2025-05-16 12:29:16 +0000 |
| commit | 5e2ff240b31a37226260587e33707efc3c41e451 (patch) | |
| tree | e7b529a34d92754c2d64cde87d52512b2d8e8b6b /drivers/iommu/intel/nested.c | |
| parent | iommu: make inclusion of arm/arm-smmu-v3 directory conditional (diff) | |
| download | kernel-5e2ff240b31a37226260587e33707efc3c41e451.tar.gz kernel-5e2ff240b31a37226260587e33707efc3c41e451.zip | |
iommu: Clear the freelist after iommu_put_pages_list()
The commit below reworked how iommu_put_pages_list() worked to not do
list_del() on every entry. This was done expecting all the callers to
already re-init the list so doing a per-item deletion is not
efficient.
It was missed that fq_ring_free_locked() re-uses its list after calling
iommu_put_pages_list() and so the leftover list reaches free'd struct
pages and will crash or WARN/BUG/etc.
Reinit the list to empty in fq_ring_free_locked() after calling
iommu_put_pages_list().
Audit to see if any other callers of iommu_put_pages_list() need the list
to be empty:
- iommu_dma_free_fq_single() and iommu_dma_free_fq_percpu() immediately
frees the memory
- iommu_v1_map_pages(), v1_free_pgtable(), domain_exit(),
riscv_iommu_map_pages() uses a stack variable which goes out of scope
- intel_iommu_tlb_sync() uses a gather in a iotlb_sync() callback, the
caller re-inits the gather
Fixes: 13f43d7cf3e0 ("iommu/pages: Formalize the freelist API")
Reported-by: Borah, Chaitanya Kumar <[email protected]>
Closes: https://lore.kernel.org/r/SJ1PR11MB61292CE72D7BE06B8810021CB997A@SJ1PR11MB6129.namprd11.prod.outlook.com
Tested-by: Borah, Chaitanya Kumar <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
Diffstat (limited to 'drivers/iommu/intel/nested.c')
0 files changed, 0 insertions, 0 deletions
