From nobody Thu Jan 15 14:19:00 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dsQ8P6Lxtz6P2V1 for ; Thu, 15 Jan 2026 14:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dsQ8P0c4Sz4Qcf for ; Thu, 15 Jan 2026 14:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768486741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T2SbX+Ov5w3v9v4U2RU3HXpwV0lC4/zRzzs2SzoggsY=; b=PIEDayxBQUJgzQmxNeLyOH3xXlQ+yYdo8PW9MBgXkvdEJOGLshxuqwf5Q00oCf5NmY3HTy 1WAXwogHH0TFFwXJx1o1l+sLKfZNpQpeqY7yP+d+Uo0iS7Pcjlq1FZ+UiUgO2NfRp4VPEG jCaS7c8oN3eZRyRk9ZxfZA4/4MwAgboD9CRMYV8688+Lh/HpAuGb6AhQSHj8DHcPMimflA wlJqexDWCzQ+evvO25DjWf83ERpJ+laOoJZoU3RkRax0zdA9nbBWFWNS0PIbdWQ8CcUc5v r0ddYP0Tjf6xa8/tERQOAigDA6w/Pw4Gsx37P8tuVi3T+2piQPWwcjbVa/LH3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768486741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T2SbX+Ov5w3v9v4U2RU3HXpwV0lC4/zRzzs2SzoggsY=; b=wEhjL9khwMmPgzYkGi/0y8Y00s7u9+bCQZAd8RD1V2fSXmVhyptiSTuV47KmDxwI42hiTW Td9pIw5HXsXkupqb3Y0os5aep7L/GRvFmoyqJ+OqLS/sWO0SsEs3nwd5zXi15AM0YX6bNc Po6Pgg9I2vrymi1WjDJBIbghYMPjJgXy1vsAWIyia+37I9KY7JcKVdxZo4VuMlNYG5t180 chWcVVNW4Vk8wuZrr81RhKcVP9GYDQgesbBCL5K5e9aKZmZj5gqX+0cXlLN/OzRHcjOXSk Fu3yKTN7OPKbWTSBzXLxguH5agX6lYrYotGH+x1LztLRmn1efxlDE0FIGF1Ruw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768486741; a=rsa-sha256; cv=none; b=AXxPwf7wOvy/ikqa/DLQG5WLBbhNW6PpcvME9LN5jGmDYct+1Tp9UH7+Dp8W+QZUjFzk9l gYqDm6KzchYIZOlIyQoJ71zvsw63XISfNyhSjVw6B42is5Uah5ve3Tp43QQ3VHk5BBFRXS uc865XP4t9k8fnsoS19HLxzhU84IGX64k/cPZbrVPa20ZdjuQ+gYpsEAy05QLI4xFeXS2w dmRsJe0y91ElSOGxqUSji+nytFVYohJ6/BdTHS9JIDWH3Oo+Sz8dNZhoRf2aVpr3H3V0Bu 9htEz9r6aWjTX10omqrfPSj4M8Z+BYP5Uf8ZhJP5u+t+ZNS6s9wmUU5CT6mPew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dsQ8N6DNbzXZV for ; Thu, 15 Jan 2026 14:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id f1f1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 15 Jan 2026 14:19:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6740cccb1eff - main - arm64/iommu: Fix a resource leak in smmu_domain_alloc() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6740cccb1eff2a0e1e6d451fa9676a21736937d2 Auto-Submitted: auto-generated Date: Thu, 15 Jan 2026 14:19:00 +0000 Message-Id: <6968f754.f1f1.6a01e806@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6740cccb1eff2a0e1e6d451fa9676a21736937d2 commit 6740cccb1eff2a0e1e6d451fa9676a21736937d2 Author: Mark Johnston AuthorDate: 2026-01-15 14:04:19 +0000 Commit: Mark Johnston CommitDate: 2026-01-15 14:04:19 +0000 arm64/iommu: Fix a resource leak in smmu_domain_alloc() We should free the allocated ASID if smmu_init_cd() fails. Move the allocation of "domain" to simplify the first error path. Reported by: Kevin Day Reviewed by: br MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54676 --- sys/arm64/iommu/smmu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c index ec8e04ce117b..a84ef4ae347e 100644 --- a/sys/arm64/iommu/smmu.c +++ b/sys/arm64/iommu/smmu.c @@ -1698,22 +1698,21 @@ smmu_domain_alloc(device_t dev, struct iommu_unit *iommu) unit = (struct smmu_unit *)iommu; - domain = malloc(sizeof(*domain), M_SMMU, M_WAITOK | M_ZERO); - error = smmu_asid_alloc(sc, &new_asid); if (error) { - free(domain, M_SMMU); device_printf(sc->dev, "Could not allocate ASID for a new domain.\n"); return (NULL); } + domain = malloc(sizeof(*domain), M_SMMU, M_WAITOK | M_ZERO); domain->asid = (uint16_t)new_asid; smmu_pmap_pinit(&domain->p); error = smmu_init_cd(sc, domain); if (error) { + smmu_asid_free(sc, domain->asid); free(domain, M_SMMU); device_printf(sc->dev, "Could not initialize CD\n"); return (NULL);