Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp308075rwi; Mon, 10 Oct 2022 00:02:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RFIIq53exnhK8VG/XKpGt58FP7/JuPjIiKzXQ2YHFJOzXsx+nbfPV13ecc5qaDC73Y7Lc X-Received: by 2002:a05:6402:24a0:b0:454:d197:6238 with SMTP id q32-20020a05640224a000b00454d1976238mr16222844eda.274.1665385323526; Mon, 10 Oct 2022 00:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665385323; cv=none; d=google.com; s=arc-20160816; b=cWXwOBwM7qQmgzdit99jFaEJKgY+LAb1H3uDjQgF7UdSBSd7rIJWuHRkNZ5Tjw+pv2 xNl4UhLvgBbWV5hL2EePUzLIoFmgCqWFAGWB5VFYT1kmSrk6c3qMOXSwavUfAeWPZzn3 z/tVi8NOCqxtqdlTLsV9OlLs918JmFQvaM3sHyEL45wEcXeai2+nQ2/yWLTi0ExRbKvu k8nP25ACAZlhihnDtenD6G02icz3kb/eBR1EBGQZDv0uKDHM2D34yjAu/TH2z52YgMCx BQIV+0vCnA/qoSQA2uEWE3ucUdBgKQwnyXpA8UIFLk9SoS0LRfc9zAGz6p/UBzQXVvEX otgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bKC7lpyYXtfPvmNIVM9PoWLAGcD4nCScccaRlGhKYH8=; b=ouMPHICPGRVPYVRK0IGB8TdfLnkgbbdQgm4+RnPfW7HHuigLHqrk5hSowAGPv9I24j EozChIQSlCJ4O/gQByP3dMOw5vmWL4aEFYxlIEsEtn4kUr5e6lpbo6ZJFQ7jIoY1Kpuv Q1jCDDXUWagiHzf4lFvEp3McAbcMRctRbgftDBwXn5c4DGi7pjtb5IW2o6lUmOCnjxn+ k9jIKiqTzhJDRAQnG4PEd/NSRG0b13npuk4qWlDeQxLvXkoRQ+qyU/fdUuERyo44I4c7 /zkFJ9vvGJvO331hhig6BDytzXgssa659yY8a6gthI23iouarcxI6s7W2ZqwdEXvtJxT 4RlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GrBkeCNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a056402440d00b00454424b5c2csi11577087eda.314.2022.10.10.00.01.24; Mon, 10 Oct 2022 00:02:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GrBkeCNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbiJJG4V (ORCPT + 99 others); Mon, 10 Oct 2022 02:56:21 -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: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); return ret; } -- 2.37.2