Commit 8e924910 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Joerg Roedel

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: default avatarDmitry Osipenko <digetx@gmail.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent c3086fad
...@@ -260,9 +260,9 @@ static void gart_iommu_domain_free(struct iommu_domain *domain) ...@@ -260,9 +260,9 @@ static void gart_iommu_domain_free(struct iommu_domain *domain)
if (gart) { if (gart) {
spin_lock(&gart->client_lock); spin_lock(&gart->client_lock);
if (!list_empty(&gart->client)) { if (!list_empty(&gart->client)) {
struct gart_client *c; struct gart_client *c, *tmp;
list_for_each_entry(c, &gart->client, list) list_for_each_entry_safe(c, tmp, &gart->client, list)
__gart_iommu_detach_dev(domain, c->dev); __gart_iommu_detach_dev(domain, c->dev);
} }
spin_unlock(&gart->client_lock); spin_unlock(&gart->client_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment