From: Luo Meng Date: Tue, 29 Nov 2022 02:48:49 +0000 (+0800) Subject: dm cache: Fix UAF in destroy() X-Git-Tag: baikal/aarch64/sdk5.9~340 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f89767a25ac7d096beb86325769eb60ff1805846;p=kernel.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: 583abdd06fb81 ("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 f595e9867cbec..5abce95ab22a7 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -1992,6 +1992,7 @@ static void destroy(struct cache *cache) if (cache->prison) dm_bio_prison_destroy_v2(cache->prison); + cancel_delayed_work_sync(&cache->waker); if (cache->wq) destroy_workqueue(cache->wq);