From: Jason Gunthorpe Date: Wed, 1 Mar 2023 19:30:18 +0000 (-0400) Subject: iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() X-Git-Tag: v6.6.7~2996^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=085fcc7eb759c2b483f85b322e8c5146610010fd;p=platform%2Fkernel%2Flinux-starfive.git iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() The hwpt->devices list is locked by this, make it clearer. Link: https://lore.kernel.org/r/1-v3-ae9c2975a131+2e1e8-iommufd_hwpt_jgg@nvidia.com Reviewed-by: Kevin Tian Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c index a0c66f4..dcfaf65 100644 --- a/drivers/iommu/iommufd/device.c +++ b/drivers/iommu/iommufd/device.c @@ -186,6 +186,8 @@ static bool iommufd_hw_pagetable_has_group(struct iommufd_hw_pagetable *hwpt, { struct iommufd_device *cur_dev; + lockdep_assert_held(&hwpt->devices_lock); + list_for_each_entry(cur_dev, &hwpt->devices, devices_item) if (cur_dev->group == group) return true;