From: Luo Meng Date: Tue, 29 Nov 2022 02:48:49 +0000 (+0800) Subject: dm cache: Fix UAF in destroy() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=034cbc8d3b47a56acd89453c29632a9c117de09d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git dm cache: Fix UAF in destroy() commit 6a459d8edbdbe7b24db42a5a9f21e6aa9e00c2aa upstream. Dm_cache also has the same UAF problem when dm_resume() and dm_destroy() are concurrent. Therefore, cancelling timer again in destroy(). Cc: stable@vger.kernel.org Fixes: c6b4fcbad044e ("dm: add cache target") Signed-off-by: Luo Meng Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1b7d77080d6b..03dcb4ec4225 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -2321,6 +2321,7 @@ static void destroy(struct cache *cache) if (cache->prison) dm_bio_prison_destroy(cache->prison); + cancel_delayed_work_sync(&cache->waker); if (cache->wq) destroy_workqueue(cache->wq);