This is a note to let you know that I've just added the patch titled dm cache: set needs_check flag after aborting metadata to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: dm-cache-set-needs_check-flag-after-aborting-metadata.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6b9973861cb2e96dcd0bb0f1baddc5c034207c5c Mon Sep 17 00:00:00 2001 From: Mike Snitzer <snitzer@xxxxxxxxxx> Date: Wed, 30 Nov 2022 14:02:47 -0500 Subject: dm cache: set needs_check flag after aborting metadata From: Mike Snitzer <snitzer@xxxxxxxxxx> commit 6b9973861cb2e96dcd0bb0f1baddc5c034207c5c upstream. Otherwise the commit that will be aborted will be associated with the metadata objects that will be torn down. Must write needs_check flag to metadata with a reset block manager. Found through code-inspection (and compared against dm-thin.c). Cc: stable@xxxxxxxxxxxxxxx Fixes: 028ae9f76f29 ("dm cache: add fail io mode and needs_check flag") Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/dm-cache-target.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -915,16 +915,16 @@ static void abort_transaction(struct cac if (get_cache_mode(cache) >= CM_READ_ONLY) return; - if (dm_cache_metadata_set_needs_check(cache->cmd)) { - DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); - set_cache_mode(cache, CM_FAIL); - } - DMERR_LIMIT("%s: aborting current metadata transaction", dev_name); if (dm_cache_metadata_abort(cache->cmd)) { DMERR("%s: failed to abort metadata transaction", dev_name); set_cache_mode(cache, CM_FAIL); } + + if (dm_cache_metadata_set_needs_check(cache->cmd)) { + DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); + set_cache_mode(cache, CM_FAIL); + } } static void metadata_operation_failed(struct cache *cache, const char *op, int r) Patches currently in stable-queue which might be from snitzer@xxxxxxxxxx are queue-5.15/dm-integrity-fix-uaf-in-dm_integrity_dtr.patch queue-5.15/dm-cache-fix-abba-deadlock-between-shrink_slab-and-dm_cache_metadata_abort.patch queue-5.15/dm-clone-fix-uaf-in-clone_dtr.patch queue-5.15/dm-thin-use-last-transaction-s-pmd-root-when-commit-failed.patch queue-5.15/dm-thin-resume-even-if-in-fail-mode.patch queue-5.15/dm-cache-set-needs_check-flag-after-aborting-metadata.patch queue-5.15/dm-cache-fix-uaf-in-destroy.patch queue-5.15/dm-thin-fix-abba-deadlock-between-shrink_slab-and-dm_pool_abort_metadata.patch queue-5.15/dm-thin-fix-uaf-in-run_timer_softirq.patch