Date: Sat, 25 Mar 2017 10:47:35 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315934 - head/sys/x86/iommu Message-ID: <201703251047.v2PAlZHx035031@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Mar 25 10:47:35 2017 New Revision: 315934 URL: https://svnweb.freebsd.org/changeset/base/315934 Log: Avoid leaking allocated but unused context after creation race. As noted in the comment, nothing special needs to be done to destroy the unneeded context after the allocation race, but the context memory itself still should to be freed. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/iommu/intel_ctx.c Modified: head/sys/x86/iommu/intel_ctx.c ============================================================================== --- head/sys/x86/iommu/intel_ctx.c Sat Mar 25 10:45:16 2017 (r315933) +++ head/sys/x86/iommu/intel_ctx.c Sat Mar 25 10:47:35 2017 (r315934) @@ -472,13 +472,15 @@ dmar_get_ctx_for_dev(struct dmar_unit *d 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703251047.v2PAlZHx035031>