From patchwork Fri Jan 19 18:04:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10175833 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 DB2A0601E7 for ; Fri, 19 Jan 2018 18:04:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C527028753 for ; Fri, 19 Jan 2018 18:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8B462876D; Fri, 19 Jan 2018 18:04:18 +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 0B46E28753 for ; Fri, 19 Jan 2018 18:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932166AbeASSEQ (ORCPT ); Fri, 19 Jan 2018 13:04:16 -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 S1755949AbeASSEQ (ORCPT ); Fri, 19 Jan 2018 13:04:16 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990439AbeASSEOjivZI (ORCPT + 1 other); Fri, 19 Jan 2018 19:04:14 +0100 Date: Fri, 19 Jan 2018 19:04:08 +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 1/2] devres: Fix double mem region release in devm_ioremap_resource() Message-ID: <20180119180408.GB31540@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_ioremap() fails, however the same release function is later called also as devres release of devm_request_mem_region() causing double resource free. Fixes: 72f8c0bfa0de ("lib: devres: add convenience function to remap a resource") Signed-off-by: Ladislav Michl --- lib/devres.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/devres.c b/lib/devres.c index 5f2aedd58bc5..584356a568d0 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -156,7 +156,6 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res) dest_ptr = devm_ioremap(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); }