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-next>] [day] [month] [year] [list]
Date:	Wed, 20 Aug 2014 15:40:13 +0100
From:	Markos Chandras <markos.chandras@...tec.com>
To:	<linux-kernel@...r.kernel.org>
CC:	Markos Chandras <markos.chandras@...tec.com>,
	Mark Brown <broonie@...nel.org>,
	Himangi Saraogi <himangi774@...il.com>,
	<linux-spi@...r.kernel.org>, <linux-mips@...ux-mips.org>
Subject: [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove

Commit 30670539b867 ("spi: au1550: Fix bug in deallocation of memory")
switched from release_resource to release_mem_region to release
memory regions allocated using the request_mem_region. However,
a build problem was introduced due to 'r' being undefined in that
function. We fix this by having 'r' being defined as the platform's
IORESROUCE_MEM region.

This fixes a problem triggered by the db1xxx defconfig in the MIPS tree:

drivers/spi/spi-au1550.c: In function 'au1550_spi_remove':
drivers/spi/spi-au1550.c:948:21: error: 'r' undeclared (first use in this
							function)
release_mem_region(r->start, sizeof(psc_spi_t));

Cc: Mark Brown <broonie@...nel.org>
Cc: Himangi Saraogi <himangi774@...il.com>
Cc: linux-spi@...r.kernel.org
Cc: linux-mips@...ux-mips.org
Signed-off-by: Markos Chandras <markos.chandras@...tec.com>
---
This has only been compile tested
---
 drivers/spi/spi-au1550.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c
index 40c3d43c9292..f7edb504df78 100644
--- a/drivers/spi/spi-au1550.c
+++ b/drivers/spi/spi-au1550.c
@@ -937,6 +937,7 @@ err_nomem:
 
 static int au1550_spi_remove(struct platform_device *pdev)
 {
+	struct resource *r;
 	struct au1550_spi *hw = platform_get_drvdata(pdev);
 
 	dev_info(&pdev->dev, "spi master remove: bus_num=%d\n",
@@ -945,6 +946,13 @@ static int au1550_spi_remove(struct platform_device *pdev)
 	spi_bitbang_stop(&hw->bitbang);
 	free_irq(hw->irq, hw);
 	iounmap((void __iomem *)hw->regs);
+
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!r) {
+		dev_err(&pdev->dev, "no mmio resource\n");
+		return -ENODEV;
+	}
+
 	release_mem_region(r->start, sizeof(psc_spi_t));
 
 	if (hw->usedma) {
-- 
2.0.4

--
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