From patchwork Fri Jan 19 18:05:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10175837 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 214BA601E7 for ; Fri, 19 Jan 2018 18:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09ABA28753 for ; Fri, 19 Jan 2018 18:05:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFB482876D; Fri, 19 Jan 2018 18:05:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 846E628753 for ; Fri, 19 Jan 2018 18:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932555AbeASSFK (ORCPT ); Fri, 19 Jan 2018 13:05:10 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:42650 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932231AbeASSFJ (ORCPT ); Fri, 19 Jan 2018 13:05:09 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990656AbeASSFIZHxOI (ORCPT + 1 other); Fri, 19 Jan 2018 19:05:08 +0100 Date: Fri, 19 Jan 2018 19:05:04 +0100 From: Ladislav Michl To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wolfram Sang , Bjorn Helgaas , Greg Kroah-Hartman , Thomas Gleixner Subject: [PATCH 2/2] PCI: Fix double mem region release in devm_pci_remap_cfg_resource() Message-ID: <20180119180504.GC31540@lenoch> References: <20180119180310.GA31540@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180119180310.GA31540@lenoch> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_release_mem_region() is called explicitely in case devm_pci_remap_cfgspace() fails, however the same release function is later called also as devres release of devm_request_mem_region() causing double resource free. Fixes: 490cb6ddb17d ("PCI: Implement devm_pci_remap_cfgspace()") Signed-off-by: Ladislav Michl --- drivers/pci/pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 764ca7b8840d..8f9d81a23ca5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3607,7 +3607,6 @@ void __iomem *devm_pci_remap_cfg_resource(struct device *dev, dest_ptr = devm_pci_remap_cfgspace(dev, res->start, size); if (!dest_ptr) { dev_err(dev, "ioremap failed for resource %pR\n", res); - devm_release_mem_region(dev, res->start, size); dest_ptr = IOMEM_ERR_PTR(-ENOMEM); }