diff mbox series

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

Message ID 20221129024850.1842973-4-luomeng12@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm: Fix UAF in run_timer_softirq() | expand

Commit Message

Luo Meng Nov. 29, 2022, 2:48 a.m. UTC
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@huawei.com>
---
 drivers/md/dm-cache-target.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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