Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp802938pxy; Wed, 21 Apr 2021 15:45:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysD1t5DyrzHIbqGENsdU+CjNgnuFI3Cex2xwm3EuXSdur6mzY59fYtCMPBMTpP46RMlRav X-Received: by 2002:a05:6a00:1687:b029:253:f417:4dba with SMTP id k7-20020a056a001687b0290253f4174dbamr257900pfc.5.1619045100162; Wed, 21 Apr 2021 15:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619045100; cv=none; d=google.com; s=arc-20160816; b=ALok4TB3QWvdKvfNxlEM/CY9U9iCg9g/qaAGV/q/0YcF4K3fZRoVAbB9dakYAwzLYl Qz5dQquGsfBgrjVSEkwkHLSin7OueSmHnVrty9afuMK7azAFD5FjQz7UIN4PlQDRpntC 3OWzw05RafXrgNUGrK4A+bLdoqL4dKoU22D1lp0zcnqUOGePokdu6BrhAmrTtnuwepoP UV/Jd1yjD/XDtytmFXHOZFEuxR5znyyyYNOBiVlQwfTNkLIfGfRGoGeHbPt0QyfoybOt vzmog2A7YNrpjjyMWD30Q1PvNzSYke6ynEuWLv3j2OcOiMnMQ9NO4IFlTfXmKW1Fi08I Fk1g== 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 :organization:message-id:date:subject:cc:to:from; bh=j/aRnhWwlT1weVReLxFSSP+CZEqQ+UihGXFLSDJUxBs=; b=FhnZhr8/dTSIMrPpKyLN9AVHMlwe795/sMHwFhhj3Bew8dw3SGeCCLMTEOphPQG/AZ VOCT9ZHWB6kYEe8JaHD0pfS0Lqwi5jqF6DBT5LSxuHx8FtmmfTAwASysS3vVE1QyDNWE jEGauF+7pkZjI2aN8Lnj6QCiiCIdrss5b2m4qfUFk6v60vNsejXqL4R0iYSbf03IVZXt i7zXjONIFlaIqG3MFkeHawKexWfbd5QQAF8Zte7PBtEc49q9WbVj414ZZJkc3w22+rEL qxFzScpyIKlibVwhAlR/8/FtWNieJd/mKH0V7zOzTZT8PJEpHJMdUiT6Zz+LJq4K+GXO LbUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si1072634pgf.471.2021.04.21.15.44.48; Wed, 21 Apr 2021 15:44:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243392AbhDUPNR convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Apr 2021 11:13:17 -0400 Received: from mx1.emlix.com ([136.243.223.33]:33072 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240356AbhDUPNR (ORCPT ); Wed, 21 Apr 2021 11:13:17 -0400 Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 465176078C; Wed, 21 Apr 2021 17:12:42 +0200 (CEST) From: Rolf Eike Beer To: Joerg Roedel , Will Deacon Cc: David Woodhouse , Lu Baolu , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path Date: Wed, 21 Apr 2021 17:12:41 +0200 Message-ID: <1716403.SmlLz2RZUD@devpool47> Organization: emlix GmbH MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Rolf Eike Beer --- drivers/iommu/intel/dmar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) I have not actually tested this but I guess it should match the code in free_iommu() just below. diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index d5c51b5c20af..fb37a9b79b3a 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) err = iommu_device_register(&iommu->iommu); if (err) - goto err_unmap; + goto err_unregister; } drhd->iommu = iommu; @@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) return 0; +err_unregister: + iommu_device_sysfs_remove(&iommu->iommu); err_unmap: unmap_iommu(iommu); error_free_seq_id: -- 2.31.1 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source