Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35225890 authored by Liam Mark's avatar Liam Mark Committed by Patrick Daly
Browse files

iommu: msm: use list_for_each_entry_safe for deletion



Use list_for_each_entry_safe to safely delete mappings while
iterating over the mappings list.

CRs-Fixed: 1067012
Change-Id: I5326ee8e58d291b1d9b07649b87632d7e9102e0d
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent ebc95a77
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -347,10 +347,12 @@ int msm_dma_unmap_all_for_dev(struct device *dev)
	meta_node = rb_first(root);
	while (meta_node) {
		struct msm_iommu_map *iommu_map;
		struct msm_iommu_map *iommu_map_next;

		meta = rb_entry(meta_node, struct msm_iommu_meta, node);
		mutex_lock(&meta->lock);
		list_for_each_entry(iommu_map, &meta->iommu_maps, lnode)
		list_for_each_entry_safe(iommu_map, iommu_map_next,
						&meta->iommu_maps, lnode)
			if (iommu_map->dev == dev)
				if (!kref_put(&iommu_map->ref,
						msm_iommu_map_release))