Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1652022pxy; Thu, 6 May 2021 12:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTolYXJp02t2VHxmFkuSSGA1loH5XzbGPCQKzpPX+Kv9IIyCAQ9uq7JngqeOa22XpiOJ9Y X-Received: by 2002:a65:5c4a:: with SMTP id v10mr5797269pgr.73.1620328947765; Thu, 06 May 2021 12:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620328947; cv=none; d=google.com; s=arc-20160816; b=dfhckKB43GSPVXY+fRqiqwP6/etWoHo+Q1XwFWB8ANZFnVbhhlX+C7cVI/5OmNOW9u zn0ZBud7asN2yMn4jLMN4YVWSFWxLe+JLxez8fexcWP2zR0uiqjtda0lkgE9ZXF518KT Qol7vxMKm3P6leXy7ErKmI4BqrAP9n7ufXFRV22KSD7h0iWy7iuGFrJqaKO7sQ/HnJNZ fBBP9S42xO3ze3pnaebE1MOiuMmhW8DCzFtIP6YYE1cDGRhQMFOZamxwNqRaUF3U46I8 cmbxPXuZlnZmQwLvfBqPaqYu3kPGYCe5dEwQ+cVNHrJsBh3WaMnt5b8S5SbjEUsGTqTl N+lw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UoJHvQ3vzZm1pLq2/c8ra9MFqNWXd94mGHvDIeHwYck=; b=gQhS2WBpOypu1ZKMFz25UeN51IRzp03ieBbXfuJELufEqJOKVw9UOKReVGoOF5rZOq Sh2MeSjvYs3dbXQpAGheguwPyZZFnSq/ir1bI1JL44CCTh+R50oufcUXXUVdlahGN4tf OPhtkRFTJe7EUFb5vhMD4D/2sTZgvhF5i6/pBhLWNRWunlbQuZutxP3K5YQZU/J6OLms IlESCP7zb3Ru6L41I7uuHWz4OUFAn5jTahMoAXb0O8+IvgB/oBzlf2o3ZH0nOhsrbC33 t4Q9Zw/vk+B0St7QnIY95B45Pdabsbai5waUN00wFXCgSjll98cc70kYfhdxlv9kBl24 9AjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rb7tDkFK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si3810701pgj.60.2021.05.06.12.22.15; Thu, 06 May 2021 12:22:27 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rb7tDkFK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236049AbhEFPhX (ORCPT + 99 others); Thu, 6 May 2021 11:37:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:46298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235207AbhEFPdv (ORCPT ); Thu, 6 May 2021 11:33:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BADBA61623; Thu, 6 May 2021 15:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620315172; bh=cukb1RYa3CPOxDWIDu0hDutwDBoEWduM1fL88dBLs4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rb7tDkFKtE7FRK/k2f18pwsTzXMm4bFr0ttYvQCxLMbM0iCF2+0X0LTMMu/W+35Bv 1bGFBql7WyK/hns70U+rXulXmJfFeSf1IIt2cGtGPsm35j+wwc5XMgnAK/S+8CH9S4 ztvPfN/aLjjZe2/eOgQ9kYRU1lZWRMEe4wOIqLt6Z7+mQxQD/FiqW8ZZmUBR9nU6ar WNy338Xp7JpoE7JWFLqF7Bn88bz06Wdd4FzWlbcf/m52H61F1ptY2m0kUqRm9zOtRL 1Gy71CSqQ6o0VX8jo5pWsoDgCuNUnbw9LTkYbsqfSXH86MnjtAxxaRE6qaerkiWrJS WPXN5vwBOKroA== Received: by pali.im (Postfix) id 7499B732; Thu, 6 May 2021 17:32:52 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas Cc: Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , Marc Zyngier , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 28/42] PCI: aardvark: Free config space for emulated root bridge when unbinding driver to fix memory leak Date: Thu, 6 May 2021 17:31:39 +0200 Message-Id: <20210506153153.30454-29-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210506153153.30454-1-pali@kernel.org> References: <20210506153153.30454-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do it after disabling and masking all interrupts, since aardvark interrupt handler accesses config space of emulated root bridge. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Fixes: 526a76991b7b ("PCI: aardvark: Implement driver 'remove' function and allow to build it as module") --- drivers/pci/controller/pci-aardvark.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 28ddffce1bec..4b531675db81 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1491,6 +1491,9 @@ static int advk_pcie_remove(struct platform_device *pdev) advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); + /* Free config space for emulated root bridge */ + pci_bridge_emul_cleanup(&pcie->bridge); + return 0; } -- 2.20.1