Skip to content

Commit 8e92491

Browse files
digetxjoergroedel
authored andcommitted
iommu/tegra: gart: Fix NULL pointer dereference
Fix NULL pointer dereference on IOMMU domain destruction that happens because clients list is being iterated unsafely and its elements are getting deleted during the iteration. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent c3086fa commit 8e92491

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iommu/tegra-gart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ static void gart_iommu_domain_free(struct iommu_domain *domain)
260260
if (gart) {
261261
spin_lock(&gart->client_lock);
262262
if (!list_empty(&gart->client)) {
263-
struct gart_client *c;
263+
struct gart_client *c, *tmp;
264264

265-
list_for_each_entry(c, &gart->client, list)
265+
list_for_each_entry_safe(c, tmp, &gart->client, list)
266266
__gart_iommu_detach_dev(domain, c->dev);
267267
}
268268
spin_unlock(&gart->client_lock);

0 commit comments

Comments
 (0)