From nobody Tue Apr 7 01:53:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED035C433F5 for ; Mon, 10 Oct 2022 06:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbiJJG4W (ORCPT ); Mon, 10 Oct 2022 02:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiJJG4T (ORCPT ); Mon, 10 Oct 2022 02:56:19 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A40623B959 for ; Sun, 9 Oct 2022 23:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665384974; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bKC7lpyYXtfPvmNIVM9PoWLAGcD4nCScccaRlGhKYH8=; b=GrBkeCNI744jQyVpIq6u1x5jEa4E28Jhz7xgB0dYTJhFdPSOvDrNFUJiLtxdzZb6ARMabW ZRHv2Za/aVEf4ummQoqNGT2iHiXEdstJzccdaro6/GEdA+eI4T47xhEfN4Tiyf+2ugvfSU NbtBbpqJ6PHHQ1YCJ/N/CBq0Gx99p9k= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-F7nXsxT3NUCgXvt2vCoUuQ-1; Mon, 10 Oct 2022 02:56:12 -0400 X-MC-Unique: F7nXsxT3NUCgXvt2vCoUuQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 811A5380673D; Mon, 10 Oct 2022 06:56:12 +0000 (UTC) Received: from cantor.redhat.com (unknown [10.2.16.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87A75AC944; Mon, 10 Oct 2022 06:56:11 +0000 (UTC) From: Jerry Snitselaar To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy Subject: [PATCH] iommu/vt-d: Clean up si_domain in the init_dmars() error path Date: Sun, 9 Oct 2022 23:56:08 -0700 Message-Id: <20221010065608.281860-1-jsnitsel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" A splat from kmem_cache_destroy() was seen with a kernel prior to commit ee2653bbe89d ("iommu/vt-d: Remove domain and devinfo mempool") when there was a failure in init_dmars(), because the iommu_domain cache still had objects. While the mempool code is now gone, there still is a leak of the si_domain memory if init_dmars() fails. So clean up si_domain in the init_dmars() error path. Cc: Lu Baolu Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Fixes: 86080ccc223a ("iommu/vt-d: Allocate si_domain in init_dmars()") Signed-off-by: Jerry Snitselaar --- drivers/iommu/intel/iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 31bc50e538a3..8f1f80a4d0c5 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3042,6 +3042,8 @@ static int __init init_dmars(void) disable_dmar_iommu(iommu); free_dmar_iommu(iommu); } + if (si_domain) + domain_exit(si_domain); =20 return ret; } --=20 2.37.2