[dm-devel] [dm-devel v2 3/4] dm cache: Fix UAF in destroy()

Luo Meng luomeng12 at huawei.com
Tue Nov 29 02:48:49 UTC 2022


Dm_cache also has the same UAF problem when dm_resume()
and dm_destroy() are concurrent.

Therefore, canceling timer again in destroy().

Fixes: c6b4fcbad044e (dm: add cache target)
Signed-off-by: Luo Meng <luomeng12 at huawei.com>
---
 drivers/md/dm-cache-target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 54a8d5c9a44e..624a6335c832 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -1887,6 +1887,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);
 
-- 
2.31.1



More information about the dm-devel mailing list