Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1764596pxk; Fri, 4 Sep 2020 19:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdJIImbpqCweBgemDl4IFB7RNXjXTz8oYLmEGwAak3iV2vgQ09n/WO4t4rcUHTX5TxflH/ X-Received: by 2002:a50:8c66:: with SMTP id p93mr11907515edp.156.1599274300755; Fri, 04 Sep 2020 19:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599274300; cv=none; d=google.com; s=arc-20160816; b=M2/dXxGd61h8/JlbmFWmIH+xQQNlCqAdgJzsWNTmFMCoanxDDi6TA0qnNHv+VpL4xZ SKE9Ny0j5BkVGxUSrXpi4fBjjZ8Y4ADc9qUQQdy21XUfPhQFNcsNHSE8uU2T/IBYNUDG osP7kr7V/AkRz6q1n6pTJ1hC9tUlt5I+yv2lJ4afeO+TlD8veowZCDaQKOlg+c8+CNV4 T37vsb5pkYz7Fbnpv7byevS5nr6rWwRfD5xmRVG4cVWf8l+cT1Pat6aRt/l0dEhkOr+v +qaXmbuBLNPAI5nvsxJ2eV2bKHXFRbuWDG1q2blwcQY6ctsydcf/VS0CrIwWVD28eaWz t5DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Rgdv/VI4fo9joiYLWsqR7MDaRrQVlnlyFipGw3AsroI=; b=IOggXmRSldm8bWrHBgfS5zB++b1QTMcpQPai7IggljRO6P3QDyHOic2mic6oXcoRth OoZnGFmNelwG0wHMrFIrWaEyelUPa10vY1+q5ut1ZPaxi+ek4mchH2SAGPjWwC0RH3LD hSswjGdQPUJfq1GyFZukvp9stil/YfVqOBU788M24Qfdevp6jSli4Jxulcr5FLpbByZT 6Al3tz5iyDXsu792vE7cI56NE5/kLnE/e4GQ958fwapI+B1U7YHTzJNYjymrG+xm/i3w zNxCI3QewwsN1CfNl0hKLWnvYN5uOmSQ9dvWnKrSYfZGfT/4+fnqMuggrDNflJmUq72a ppZA== 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 k25si5705864ejk.235.2020.09.04.19.50.42; Fri, 04 Sep 2020 19:51:40 -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 S1726948AbgIECt0 (ORCPT + 99 others); Fri, 4 Sep 2020 22:49:26 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:58130 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726406AbgIECtZ (ORCPT ); Fri, 4 Sep 2020 22:49:25 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 68EEBEB0DB26FD01E358; Sat, 5 Sep 2020 10:49:21 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 5 Sep 2020 10:49:11 +0800 From: Yang Yingliang To: , , CC: , , , , , Subject: [PATCH] arm64: PCI: fix memleak when calling pci_iomap/unmap() Date: Sat, 5 Sep 2020 10:48:11 +0800 Message-ID: <20200905024811.74701-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org config GENERIC_IOMAP is disabled on arm64, so pci_iounmap() does nothing, when we using pci_iomap/pci_iounmap(), it will lead to memory leak. Implements pci_iounmap() for arm64 to fix this leak. Fixes: 09a5723983e3 ("arm64: Use include/asm-generic/io.h") Signed-off-by: Yang Yingliang --- arch/arm64/include/asm/io.h | 5 +++++ arch/arm64/kernel/pci.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index ff50dd731852d..4d8da06ac295f 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -18,6 +18,11 @@ #include #include +#ifdef CONFIG_PCI +struct pci_dev; +#define pci_iounmap pci_iounmap +extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); +#endif /* * Generic IO read/write. These perform native-endian accesses. */ diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 1006ed2d7c604..ddfa1c53def48 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -217,4 +217,9 @@ void pcibios_remove_bus(struct pci_bus *bus) acpi_pci_remove_bus(bus); } +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + iounmap(addr); +} +EXPORT_SYMBOL(pci_iounmap); #endif -- 2.25.1