]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm cache: Fix UAF in destroy()
authorLuo Meng <luomeng12@huawei.com>
Tue, 29 Nov 2022 02:48:49 +0000 (10:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:47 +0000 (11:41 +0100)
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 <luomeng12@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c

index f595e9867cbec1d531458a6eb544d4c7012412b1..5abce95ab22a71a765443b23a4f1e2a56af13903 100644 (file)
@@ -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);