svn commit: r316346 - stable/11/sys/x86/iommu

Konstantin Belousov kib at FreeBSD.org
Sat Apr 1 08:40:49 UTC 2017


Author: kib
Date: Sat Apr  1 08:40:47 2017
New Revision: 316346
URL: https://svnweb.freebsd.org/changeset/base/316346

Log:
  MFC r315934:
  Avoid leaking allocated but unused context after creation race.

Modified:
  stable/11/sys/x86/iommu/intel_ctx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/iommu/intel_ctx.c
==============================================================================
--- stable/11/sys/x86/iommu/intel_ctx.c	Sat Apr  1 08:37:19 2017	(r316345)
+++ stable/11/sys/x86/iommu/intel_ctx.c	Sat Apr  1 08:40:47 2017	(r316346)
@@ -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 */


More information about the svn-src-stable mailing list