]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitb77eeb8429f5f0e6a1bf05bc7788bd841112fc17
tree68a897366bc1fefc9ed67696ab717ff7b4d48496
parent8a7723e9856c6f4226d1f1b6bd4f343b35e68bf3
iio: adc: xilinx: fix potential use-after-free on remove

BugLink: https://bugs.launchpad.net/bugs/1838576
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iio/adc/xilinx-xadc-core.c