Skip to contentSkip to conversation

dm-integrity: don't attempt to commit journal on disabled device

PATCH New Mikulas Patocka 1 participant 1 message Nov 11 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

PATCH v2 1/1 dm-integrity: don't attempt to commit journal on disabled device

If the device is disabled due to an error, we shouldn't attempt to flush the journal. We jump straight to the label release_flush_bios, that will call do_endio on all queued bios. do_endio will terminate the bios with the error.

This fixes WARN_ON in the function pad_uncommitted reported by syzkaller.

Reported-by [email protected]
Fixes 7eada909bfd7 ("dm: add integrity target")
---
 drivers/md/dm-integrity.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/dm-integrity.c +5 -1
Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
@@ -2908,6 +2908,11 @@ static void integrity_commit(struct work
 
 	spin_lock_irq(&ic->endio_wait.lock);
 	flushes = bio_list_get(&ic->flush_bio_list);
+	if (unlikely(dm_integrity_failed(ic))) {
+		wake_up_locked(&ic->endio_wait);
+		spin_unlock_irq(&ic->endio_wait.lock);
+		goto release_flush_bios;
+	}
 	if (unlikely(ic->mode != 'J')) {
 		spin_unlock_irq(&ic->endio_wait.lock);
 		dm_integrity_flush_buffers(ic, true);
@@ -5409,7 +5414,6 @@ try_smaller_buffer:
 		r = create_journal(ic, &ti->error);
 		if (r)
 			goto bad;
-
 	}
 
 	if (ic->mode == 'B') {