From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sven Van Asbroeck <thesven73@gmail.com>,
Sven Van Asbroeck <TheSven73@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Sasha Levin <sashal@kernel.org>,
linux-iio@vger.kernel.org
Subject: [PATCH AUTOSEL 3.18 01/10] iio: adc: xilinx: fix potential use-after-free on remove
Date: Tue, 7 May 2019 01:42:37 -0400 [thread overview]
Message-ID: <20190507054247.537-1-sashal@kernel.org> (raw)
From: Sven Van Asbroeck <thesven73@gmail.com>
[ 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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index a483747cdc9b..b520de11fc17 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1315,7 +1315,7 @@ static int xadc_remove(struct platform_device *pdev)
}
free_irq(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);
--
2.20.1
next reply other threads:[~2019-05-07 5:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 5:42 Sasha Levin [this message]
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 02/10] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 03/10] s390/dasd: Fix capacity calculation for large volumes Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 04/10] s390/3270: fix lockdep false positive on view->lock Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 05/10] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 06/10] tools lib traceevent: Fix missing equality check for strcmp Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 07/10] init: initialize jump labels before command line option parsing Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 08/10] s390: ctcm: fix ctcm_new_device error return code Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 09/10] selftests/net: correct the return value for run_netsocktests Sasha Levin
2019-05-07 5:42 ` [PATCH AUTOSEL 3.18 10/10] gpu: ipu-v3: dp: fix CSC handling Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507054247.537-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thesven73@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).