diff options
author | kib <kib@FreeBSD.org> | 2017-04-01 08:40:47 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-04-01 08:40:47 +0000 |
commit | 8704b0b19561ae51f61022fc7b5cbe100ca76014 (patch) | |
tree | 1c97b7e5ddaeae473b32dde6cc33549069c69cc5 /sys/x86/iommu | |
parent | 69e89f2e142c3d80156e2a67eb11411ea3c2e244 (diff) | |
download | FreeBSD-src-8704b0b19561ae51f61022fc7b5cbe100ca76014.zip FreeBSD-src-8704b0b19561ae51f61022fc7b5cbe100ca76014.tar.gz |
MFC r315934:
Avoid leaking allocated but unused context after creation race.
Diffstat (limited to 'sys/x86/iommu')
-rw-r--r-- | sys/x86/iommu/intel_ctx.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index af68f8b..73ceb0e 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -472,13 +472,15 @@ dmar_get_ctx_for_dev(struct dmar_unit *dmar, device_t dev, uint16_t rid, dmar->unit, dmar->segment, bus, slot, func, rid, domain->domain, domain->mgaw, domain->agaw, id_mapped ? "id" : "re"); + dmar_unmap_pgtbl(sf); } else { - /* Nothing needs to be done to destroy ctx1. */ + dmar_unmap_pgtbl(sf); dmar_domain_destroy(domain1); + /* Nothing needs to be done to destroy ctx1. */ + free(ctx1, M_DMAR_CTX); domain = ctx->domain; ctx->refs++; /* tag referenced us */ } - dmar_unmap_pgtbl(sf); } else { domain = ctx->domain; ctx->refs++; /* tag referenced us */ |