diff mbox series

[v2,2/4] dm clone: Fix UAF in clone_dtr()

Message ID 20221129024850.1842973-3-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_clone also has the same UAF problem when dm_resume()
and dm_destroy() are concurrent.

Therefore, canceling timer again in clone_dtr().

Fixes: 7431b7835f554 (dm: add clone target)
Signed-off-by: Luo Meng <luomeng12@huawei.com>
---
 drivers/md/dm-clone-target.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/md/dm-clone-target.c b/drivers/md/dm-clone-target.c
index 2f1cc66d2641..29e0b85eeaf0 100644
--- a/drivers/md/dm-clone-target.c
+++ b/drivers/md/dm-clone-target.c
@@ -1958,6 +1958,7 @@  static void clone_dtr(struct dm_target *ti)
 
 	mempool_exit(&clone->hydration_pool);
 	dm_kcopyd_client_destroy(clone->kcopyd_client);
+	cancel_delayed_work_sync(&clone->waker);
 	destroy_workqueue(clone->wq);
 	hash_table_exit(clone);
 	dm_clone_metadata_close(clone->cmd);