aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorSven Van Asbroeck <thesven73@gmail.com>2019-03-10 14:58:25 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-03-16 15:48:51 +0000
commit862e4644fd2d7df8998edc65e0963ea2f567bde9 (patch)
tree0c5e475e1ebba1a363f44f4fc8a347c47c0c6cba /drivers/iio
parentiio: adc: xilinx: fix potential use-after-free on remove (diff)
downloadlinux-dev-862e4644fd2d7df8998edc65e0963ea2f567bde9.tar.xz
linux-dev-862e4644fd2d7df8998edc65e0963ea2f567bde9.zip
iio: adc: xilinx: fix potential use-after-free on probe
If probe errors out after request_irq(), its error path does not explicitly cancel the delayed work, which may have been scheduled by the interrupt handler. This means the delayed work may still be running when the core frees the private structure (struct xadc). This is a potential use-after-free. Fix by inserting cancel_delayed_work_sync() in the probe error path. Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/xilinx-xadc-core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index ef3afaeed194..5a1b63f9d041 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1292,6 +1292,7 @@ static int xadc_probe(struct platform_device *pdev)
err_free_irq:
free_irq(xadc->irq, indio_dev);
+ cancel_delayed_work_sync(&xadc->zynq_unmask_work);
err_clk_disable_unprepare:
clk_disable_unprepare(xadc->clk);
err_free_samplerate_trigger: