OSDN Git Service

iio: adc: xilinx: fix potential use-after-free on remove
authorSven Van Asbroeck <thesven73@gmail.com>
Sun, 10 Mar 2019 18:58:24 +0000 (14:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 17:45:05 +0000 (19:45 +0200)
commit45679938dc6fe01ac423812e0c3f033c6285590a
treeaccd0a1af585e9bc99bc1213e57682c781c29d19
parent619c8933e4affe90e67031b6a5caa90b2707248a
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>
drivers/iio/adc/xilinx-xadc-core.c