dm-integrity: don't attempt to commit journal on disabled device
Mikulas Patocka
maintainerPATCH 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")
Signed-off-by Mikulas Patocka <[email protected]>
--- drivers/md/dm-integrity.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/dm-integrity.c +5 -1
@@ -2908,6 +2908,11 @@ static void integrity_commit(struct workspin_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' ) {