dm cache: Fix UAF in destroy()

commit 6a459d8edb 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: c6b4fcbad0 ("dm: add cache target")
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Luo Meng 2022-11-29 10:48:49 +08:00 committed by Greg Kroah-Hartman
parent 7ee059d06a
commit 034cbc8d3b
1 changed files with 1 additions and 0 deletions

View File

@ -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);