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:   Thu,  7 Mar 2019 11:30:08 +0100
From:   Volker Haspel <volker.haspel@...utronix.de>
To:     linux-kernel@...r.kernel.org
Cc:     linux-spi@...r.kernel.org, Han Xu <han.xu@....com>,
        Mark Brown <broonie@...nel.org>, john.ogness@...utronix.de,
        volker.haspel@...utronix.de
Subject: [PATCH] spi: spi-fsl-qspi: call spi_unregister_controller

The driver does not clearly unregister the spi controller.
Therefore calling an unbind and bind again will end up in a
Kernel crash.
Each driver who calls spi_register_controller() in the probe function
has to call spi_unregister_controller() too.

Signed-off-by: Volker Haspel <volker.haspel@...utronix.de>
Signed-off-by: John Ogness <john.ogness@...utronix.de>
---
 drivers/spi/spi-fsl-qspi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 6a713f78a62e..373c4a82e8e3 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -248,6 +248,7 @@ struct fsl_qspi {
 	struct mutex lock;
 	struct pm_qos_request pm_qos_req;
 	int selected;
+	struct spi_controller *ctlr;
 };
 
 static inline int needs_swap_endian(struct fsl_qspi *q)
@@ -812,6 +813,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 			  SPI_TX_DUAL | SPI_TX_QUAD;
 
 	q = spi_controller_get_devdata(ctlr);
+	q->ctlr = ctlr;
 	q->dev = dev;
 	q->devtype_data = of_device_get_match_data(dev);
 	if (!q->devtype_data) {
@@ -912,6 +914,7 @@ static int fsl_qspi_remove(struct platform_device *pdev)
 	fsl_qspi_clk_disable_unprep(q);
 
 	mutex_destroy(&q->lock);
+	spi_unregister_controller(q->ctlr);
 
 	return 0;
 }
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ