Skip to content

Commit 338b32a

Browse files
Mikulas Patockagregkh
authored andcommitted
Revert: "dm-verity: restart or panic on an I/O error"
commit 4627632 upstream. This reverts commit e6a3531. The problem that the commit e6a3531 fixes was reported as a security bug, but Google engineers working on Android and ChromeOS didn't want to change the default behavior, they want to get -EIO rather than restarting the system, so I am reverting that commit. Note also that calling machine_restart from the I/O handling code is potentially unsafe (the reboot notifiers may wait for the bio that triggered the restart), but Android uses the reboot notifiers to store the reboot reason into the PMU microcontroller, so machine_restart must be used. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Fixes: e6a3531 ("dm-verity: restart or panic on an I/O error") Suggested-by: Sami Tolvanen <samitolvanen@google.com> Suggested-by: Will Drewry <wad@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b126f1b commit 338b32a

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

drivers/md/dm-verity-target.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
272272
if (v->mode == DM_VERITY_MODE_LOGGING)
273273
return 0;
274274

275-
if (v->mode == DM_VERITY_MODE_RESTART) {
276-
pr_emerg("dm-verity device corrupted\n");
277-
emergency_restart();
278-
}
275+
if (v->mode == DM_VERITY_MODE_RESTART)
276+
kernel_restart("dm-verity device corrupted");
279277

280278
if (v->mode == DM_VERITY_MODE_PANIC)
281279
panic("dm-verity device corrupted");
@@ -598,23 +596,6 @@ static void verity_finish_io(struct dm_verity_io *io, blk_status_t status)
598596
if (!static_branch_unlikely(&use_bh_wq_enabled) || !io->in_bh)
599597
verity_fec_finish_io(io);
600598

601-
if (unlikely(status != BLK_STS_OK) &&
602-
unlikely(!(bio->bi_opf & REQ_RAHEAD)) &&
603-
!verity_is_system_shutting_down()) {
604-
if (v->mode == DM_VERITY_MODE_RESTART ||
605-
v->mode == DM_VERITY_MODE_PANIC)
606-
DMERR_LIMIT("%s has error: %s", v->data_dev->name,
607-
blk_status_to_str(status));
608-
609-
if (v->mode == DM_VERITY_MODE_RESTART) {
610-
pr_emerg("dm-verity device corrupted\n");
611-
emergency_restart();
612-
}
613-
614-
if (v->mode == DM_VERITY_MODE_PANIC)
615-
panic("dm-verity device corrupted");
616-
}
617-
618599
bio_endio(bio);
619600
}
620601

0 commit comments

Comments
 (0)