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]
Message-Id: <1445540169-20715-1-git-send-email-moritz.fischer@ettus.com>
Date:	Thu, 22 Oct 2015 11:56:09 -0700
From:	Moritz Fischer <moritz.fischer@...us.com>
To:	atull@...nsource.altera.com
Cc:	michal.simek@...inx.com, soren.brinkmann@...inx.com,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	joshc@...com, gregkh@...uxfoundation.org,
	Moritz Fischer <moritz.fischer@...us.com>
Subject: [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten.

Upon registering a FPGA Manager low level driver, FPGA Manager
core overwrites the platform drvdata pointer. Prior to this commit
zynq-fpga falsely relied on this pointer to still be valid at remove()
time.

Reported-by: Alan Tull <atull@...nsource.altera.com>
Signed-off-by: Moritz Fischer <moritz.fischer@...us.com>
---
 drivers/fpga/zynq-fpga.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index 31db550..c2fb412 100644
--- a/drivers/fpga/zynq-fpga.c
+++ b/drivers/fpga/zynq-fpga.c
@@ -416,7 +416,6 @@ static int zynq_fpga_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	platform_set_drvdata(pdev, priv);
 	priv->dev = dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -477,10 +476,12 @@ static int zynq_fpga_probe(struct platform_device *pdev)
 static int zynq_fpga_remove(struct platform_device *pdev)
 {
 	struct zynq_fpga_priv *priv;
+	struct fpga_manager *mgr;
 
-	fpga_mgr_unregister(&pdev->dev);
+	mgr = platform_get_drvdata(pdev);
+	priv = mgr->priv;
 
-	priv = platform_get_drvdata(pdev);
+	fpga_mgr_unregister(&pdev->dev);
 
 	clk_unprepare(priv->clk);
 
-- 
2.6.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