linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Wolfram Sang <w.sang@pengutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 1/2] devres: Fix double mem region release in devm_ioremap_resource()
Date: Fri, 19 Jan 2018 19:04:08 +0100	[thread overview]
Message-ID: <20180119180408.GB31540@lenoch> (raw)
In-Reply-To: <20180119180310.GA31540@lenoch>

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 <ladis@linux-mips.org>
---
 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

  reply	other threads:[~2018-01-19 18:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 18:03 [PATCH 0/2] Fix double mem region release Ladislav Michl
2018-01-19 18:04 ` Ladislav Michl [this message]
2018-01-19 18:05 ` [PATCH 2/2] PCI: Fix double mem region release in devm_pci_remap_cfg_resource() Ladislav Michl
2018-01-19 23:36 ` [PATCH 0/2] Fix double mem region release Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180119180408.GB31540@lenoch \
    --to=ladis@linux-mips.org \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=w.sang@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).