lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1290415467.5471.7.camel@mola>
Date:	Mon, 22 Nov 2010 16:44:27 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	Chris Ball <cjb@...top.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Vipin Bhandari <vipin.bhandari@...com>,
	David Brownell <dbrownell@...rs.sourceforge.net>,
	linux-mmc@...r.kernel.org
Subject: [PATCH 1/4] [ARM] davinci_mmc: fix a memory leak

request_mem_region() will call kzalloc to allocate memory for struct resource.
release_resource() unregisters the resource but does not free the allocated
memory, thus use release_mem_region() instead to fix the memory leak.

Signed-off-by: Axel Lin <axel.lin@...il.com>
---
 drivers/mmc/host/davinci_mmc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index e15547c..7c7d268 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1297,7 +1297,7 @@ cpu_freq_fail:
 		mmc_free_host(mmc);
 
 	if (mem)
-		release_resource(mem);
+		release_mem_region(mem->start, resource_size(mem));
 
 	dev_dbg(&pdev->dev, "probe err %d\n", ret);
 
@@ -1322,7 +1322,8 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
 
 		iounmap(host->base);
 
-		release_resource(host->mem_res);
+		release_mem_region(host->mem_res->start,
+					resource_size(host->mem_res));
 
 		mmc_free_host(host->mmc);
 	}
-- 
1.7.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ