summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorSven Van Asbroeck <thesven73@gmail.com>2019-03-10 14:58:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-16 19:42:19 +0200
commit46ddbd4ef83f2151f99ed4f180da7cf3bca5c890 (patch)
tree687c015d0cfcf051f2f776bc11a510c73fc2cae2 /drivers/iio
parentfedc5219fdde202a0599fd82709e3df46f12fef8 (diff)
iio: adc: xilinx: fix potential use-after-free on remove
[ Upstream commit 62039b6aef63380ba7a37c113bbaeee8a55c5342 ] 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> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/xilinx-xadc-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 4a60497a1f19..e89711b30ae8 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1302,7 +1302,7 @@ static int xadc_remove(struct platform_device *pdev)
}
free_irq(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);