Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6400212a authored by Sven Van Asbroeck's avatar Sven Van Asbroeck Committed by Greg Kroah-Hartman
Browse files

iio: adc: xilinx: fix potential use-after-free on probe



[ Upstream commit 862e4644fd2d7df8998edc65e0963ea2f567bde9 ]

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: default avatarSven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 06d5ea39
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1290,6 +1290,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: