Received: by 10.223.176.46 with SMTP id f43csp1340576wra; Fri, 19 Jan 2018 10:05:24 -0800 (PST) X-Google-Smtp-Source: ACJfBovSg8Grt6ZBxcIIYMFvwBRSsg3xQyBRVuIqwDd/mULqvdeRIR5zLiu9y3tK/yU8uClVkXNi X-Received: by 10.99.113.11 with SMTP id m11mr32287328pgc.57.1516385124385; Fri, 19 Jan 2018 10:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516385124; cv=none; d=google.com; s=arc-20160816; b=fE9/bUciihDMIQME0VdDc+EBtj8HitBshvqcnlz7wmYz1wpj/GY5lALlLUtjdv5sFc Eysv82xeaxE5luEL3Lh2EGh4dZ380VArgmbOK4LLbbNeDLcjVrkxi2Oz0zI1DHDNgrlz ulqUW045CFo4CdS+9vNC4I26fYXw1J68uFPt5303cuD3wCIhg4vqrrNg3/nGVKuSxINa xmn1c47zLFNjLftagXCq36mKCM4R5VoW3tKE96nZqxeO6RHzzjrdxojBiY37HyFhCzYM a61fNKjP6WiCoUMZCjrPkBJ6PP9QIpUNjbnlrQ+c+vTLOGJvDsvqAoY+9+efzuHJHdHo ACOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=8SIDwfg8Ro3Pu+wR3fKb+uGABYp0rfBMgrlolvkPe5s=; b=iZE/laaHtUBn5sRK8fBI4JZ2JPY2z0FwfU6a3vzmcAfUO1A4U/ybtVb40RCafvKCe2 r9g9/7A4K89kvhrZoPfb7FdggJ15lRLaiGHSlBW2knNgi7as1MtJi1GQ34erclvWcfX2 7BUzDlRIdLAEkHGlBj7K8wHKtM7gwHKXu/lPnwn7v4Dc8kh7meVg9/FFO7zPqGHyrkg0 M8uNcEcnuilDGmD1aDuoI5P7icfOI+XB3tluIm46Wngh2y8Mn73nuB3nEsIjmmZQIZ/L BdeIiG6pFiBCuIUWt+E6IRa49/JkwEte4tOzKoea2Ww6N9t1dLIhIgLMhVuOTe5krg4H vCCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si5782172pgq.384.2018.01.19.10.05.10; Fri, 19 Jan 2018 10:05:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932480AbeASSEX (ORCPT + 99 others); Fri, 19 Jan 2018 13:04:23 -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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180119180310.GA31540@lenoch> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.15.1