All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] iio: adc: xilinx: fix potential use-after-free on remove
@ 2019-03-10 18:58 ` Sven Van Asbroeck
  0 siblings, 0 replies; 14+ messages in thread
From: Sven Van Asbroeck @ 2019-03-10 18:58 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek, Manish Narani, linux-iio, linux-arm-kernel,
	linux-kernel

When cancel_delayed_work() returns, the delayed work may still
be running. This means that the core could potentially free
the private structure (struct xadc) while the delayed work
is still using it. This is a potential use-after-free.

Fix by calling cancel_delayed_work_sync(), which waits for
any residual work to finish before returning.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 3f6be5ac049a..1960694e8007 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1320,7 +1320,7 @@ static int xadc_remove(struct platform_device *pdev)
 	}
 	free_irq(xadc->irq, indio_dev);
 	clk_disable_unprepare(xadc->clk);
-	cancel_delayed_work(&xadc->zynq_unmask_work);
+	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
 	kfree(xadc->data);
 	kfree(indio_dev->channels);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-03-17 16:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-10 18:58 [PATCH 1/3] iio: adc: xilinx: fix potential use-after-free on remove Sven Van Asbroeck
2019-03-10 18:58 ` Sven Van Asbroeck
2019-03-10 18:58 ` [PATCH 2/3] iio: adc: xilinx: fix potential use-after-free on probe Sven Van Asbroeck
2019-03-10 18:58   ` Sven Van Asbroeck
2019-03-16 15:49   ` Jonathan Cameron
2019-03-16 15:49     ` Jonathan Cameron
2019-03-10 18:58 ` [PATCH 3/3] iio: adc: xilinx: prevent touching unclocked h/w on remove Sven Van Asbroeck
2019-03-10 18:58   ` Sven Van Asbroeck
2019-03-16 15:51   ` Jonathan Cameron
2019-03-16 15:51     ` Jonathan Cameron
2019-03-17 16:07     ` Sven Van Asbroeck
2019-03-17 16:07       ` Sven Van Asbroeck
2019-03-16 15:47 ` [PATCH 1/3] iio: adc: xilinx: fix potential use-after-free " Jonathan Cameron
2019-03-16 15:47   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.