Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442770
| From | Nate Watterson <nwatters@codeaurora.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] iommu/iova: validate iova_domain input to put_iova_domain |
| Date | 2016-07-13 21:00 +0200 |
| Message-ID | <rUxy2-6WF-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Passing a NULL or uninitialized iova_domain into put_iova_domain will currently crash the kernel when the unconfigured iova_domain data members are accessed. To prevent this from occurring, this patch adds a check to make sure that the domain is non-NULL and that the domain granule is non-zero. The granule can be used to check if the domain was properly initialized because calling init_iova_domain with a granule of zero would have already triggered a BUG statement crashing the kernel. Signed-off-by: Nate Watterson <nwatters@codeaurora.org> --- drivers/iommu/iova.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index e23001b..3511a1c 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -459,6 +459,10 @@ void put_iova_domain(struct iova_domain *iovad) struct rb_node *node; unsigned long flags; + /* Only teardown properly initialized domains */ + if (!iovad || !iovad->granule) + return; + free_iova_rcaches(iovad); spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); node = rb_first(&iovad->rbroot); -- Qualcomm Datacenter Technologies, Inc. on behalf of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] iommu/iova: validate iova_domain input to put_iova_domain Nate Watterson <nwatters@codeaurora.org> - 2016-07-13 21:00 +0200
Re: [PATCH] iommu/iova: validate iova_domain input to put_iova_domain Joerg Roedel <joro@8bytes.org> - 2016-07-14 10:40 +0200
Re: [PATCH] iommu/iova: validate iova_domain input to put_iova_domain Robin Murphy <robin.murphy@arm.com> - 2016-07-14 12:40 +0200
Re: [PATCH] iommu/iova: validate iova_domain input to put_iova_domain Auger Eric <eric.auger@redhat.com> - 2016-07-14 13:30 +0200
Re: [PATCH] iommu/iova: validate iova_domain input to put_iova_domain nwatters@codeaurora.org - 2016-07-14 20:00 +0200
csiph-web