Skip to content

iommu: Fix SVA, iommufd, and iommupt error paths

Shuai Xue linux-iommu lkml 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 9 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4iommu/sva: Set handle->dev before the SVA handle is visibledrivers/iommu/iommu-sva.c+1 -13 replies
2/4iommufd: Avoid locking internal accesses during unmapdrivers/iommu/iommufd/device.c+2 -21 reply
3/4iommufd: Release current IOAS on xa_store() failuredrivers/iommu/iommufd/ioas.c+2 -01 reply
4/4iommupt: Return zero for invalid iova_to_phys() rangesdrivers/iommu/generic_pt/iommu_pt.h+1 -12 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKevin TianLu BaoluJason Gunthorpe
SeriesR-b
1/4R-b R-b
2/4R-b
3/4R-b
4/4R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/4] iommu: Fix SVA, iommufd, and iommupt error paths

This series fixes four independent error-path/lifetime issues in the IOMMU core helpers, iommufd, and generic page table code.

Patch 1 fixes an SVA race where an attach handle becomes visible before handle->dev is initialized. A racing bind can reuse the handle and later unbind can dereference a NULL handle->dev.

Patches 2 and 3 fix iommufd reference/lock leaks. Patch 2 avoids taking an object reference for internal accesses that are skipped by the unmap notification path. Patch 3 releases the current IOAS rwsem and object reference if xa_store() fails before the IOAS is inserted into the unwind list.

Patch 4 fixes the generic page table iova_to_phys() op to return 0 on range validation failures. Returning a negative errno from a phys_addr_t function can make callers consume a bogus physical address.

All patches are small fixes with Fixes tags and Cc: stable.

Shuai Xue (4):
iommu/sva: Set handle->dev before the SVA handle is visible
iommufd: Avoid locking internal accesses during unmap
iommufd: Release current IOAS on xa_store() failure
iommupt: Return zero for invalid iova_to_phys() ranges

 drivers/iommu/generic_pt/iommu_pt.h | 2 +-
 drivers/iommu/iommu-sva.c           | 2 +-
 drivers/iommu/iommufd/device.c      | 4 ++--
 drivers/iommu/iommufd/ioas.c        | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.3