diff options
author | Sven Van Asbroeck <thesven73@gmail.com> | 2019-03-10 19:58:24 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-03-16 16:48:30 +0100 |
commit | 62039b6aef63380ba7a37c113bbaeee8a55c5342 (patch) | |
tree | 2d5c5fa8de8ccc3d56a1dafb07865ebe07461548 /drivers | |
parent | iio: dac: mcp4725: add missing powerdown bits in store eeprom (diff) | |
download | linux-62039b6aef63380ba7a37c113bbaeee8a55c5342.tar.xz linux-62039b6aef63380ba7a37c113bbaeee8a55c5342.zip |
iio: adc: xilinx: fix potential use-after-free on remove
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/adc/xilinx-xadc-core.c | 2 |
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 b13c61539d46..ef3afaeed194 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -1322,7 +1322,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); |