From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 5/7] iommu/amd: Set global pointers to NULL after freeing them
Date: Fri, 16 Jun 2017 16:09:58 +0200 [thread overview]
Message-ID: <1497622200-18188-6-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1497622200-18188-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
Avoid any tries to double-free these pointers.
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/iommu/amd_iommu_init.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index a31f375..d04898c 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2112,18 +2112,22 @@ static void __init free_iommu_resources(void)
kmemleak_free(irq_lookup_table);
free_pages((unsigned long)irq_lookup_table,
get_order(rlookup_table_size));
+ irq_lookup_table = NULL;
kmem_cache_destroy(amd_iommu_irq_cache);
amd_iommu_irq_cache = NULL;
free_pages((unsigned long)amd_iommu_rlookup_table,
get_order(rlookup_table_size));
+ amd_iommu_rlookup_table = NULL;
free_pages((unsigned long)amd_iommu_alias_table,
get_order(alias_table_size));
+ amd_iommu_alias_table = NULL;
free_pages((unsigned long)amd_iommu_dev_table,
get_order(dev_table_size));
+ amd_iommu_dev_table = NULL;
free_iommu_all();
@@ -2193,6 +2197,7 @@ static void __init free_dma_resources(void)
{
free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
get_order(MAX_DOMAIN_ID/8));
+ amd_iommu_pd_alloc_bitmap = NULL;
free_unity_maps();
}
--
2.7.4
next prev parent reply other threads:[~2017-06-16 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 14:09 [PATCH 0/7] iommu/amd: Disable previously enabled IOMMUs at boot Joerg Roedel
2017-06-16 14:09 ` [PATCH 1/7] iommu/amd: Disable IOMMUs at boot if they are enabled Joerg Roedel
[not found] ` <1497622200-18188-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-06-16 14:09 ` [PATCH 2/7] iommu/amd: Rename free_on_init_error() Joerg Roedel
2017-06-16 14:09 ` [PATCH 3/7] iommu/amd: Add new init-state IOMMU_CMDLINE_DISABLED Joerg Roedel
2017-06-16 14:09 ` [PATCH 4/7] iommu/amd: Check for error states first in iommu_go_to_state() Joerg Roedel
2017-06-16 14:09 ` Joerg Roedel [this message]
2017-06-16 14:09 ` [PATCH 6/7] iommu/amd: Free IOMMU resources when disabled on command line Joerg Roedel
2017-06-16 14:10 ` [PATCH 7/7] iommu/amd: Remove amd_iommu_disabled check from amd_iommu_detect() 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=1497622200-18188-6-git-send-email-joro@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=jroedel-l3A5Bk7waGM@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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).