iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Joerg Roedel <joro@8bytes.org>,
	Jonathan Hunter <jonathanh@nvidia.com>
Cc: iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/3] iommu/tegra-smmu: Properly release domain resources
Date: Thu,  7 Mar 2019 01:50:08 +0300	[thread overview]
Message-ID: <20190306225009.3391-3-digetx@gmail.com> (raw)
In-Reply-To: <20190306225009.3391-1-digetx@gmail.com>

Release all memory allocations associated with a released domain and emit
warning if domain is in-use at the time of destruction.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/iommu/tegra-smmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 8d30653cd13a..27b1249f0773 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -327,6 +327,9 @@ static void tegra_smmu_domain_free(struct iommu_domain *domain)
 
 	/* TODO: free page directory and page tables */
 
+	WARN_ON_ONCE(as->use_count);
+	kfree(as->count);
+	kfree(as->pts);
 	kfree(as);
 }
 
-- 
2.20.1

  parent reply	other threads:[~2019-03-06 22:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 22:50 [PATCH v1 0/3] IOMMU: Tegra SMMU fixes Dmitry Osipenko
     [not found] ` <20190306225009.3391-1-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-06 22:50   ` [PATCH v1 1/3] iommu/tegra-smmu: Fix invalid ASID bits on Tegra30/114 Dmitry Osipenko
     [not found]     ` <20190306225009.3391-2-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-04-03  8:41       ` Thierry Reding
2019-04-03 10:27         ` Dmitry Osipenko
2019-03-06 22:50 ` Dmitry Osipenko [this message]
2019-04-03  8:43   ` [PATCH v1 2/3] iommu/tegra-smmu: Properly release domain resources Thierry Reding
2019-03-06 22:50 ` [PATCH v1 3/3] iommu/tegra-smmu: Respect IOMMU API read-write protections Dmitry Osipenko
2019-04-03  8:44   ` Thierry Reding
2019-04-03  5:14 ` [PATCH v1 0/3] IOMMU: Tegra SMMU fixes Dmitry Osipenko
2019-04-11 12:52   ` Joerg Roedel
2019-04-11 12:52     ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190306225009.3391-3-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).