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
This commit is contained in:
parent
5f8e5c7fa2
commit
3d47c58b98
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315934
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user