Skip to content

Commit 4627632

Browse files
author
Mikulas Patocka
committed
Revert: "dm-verity: restart or panic on an I/O error"
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 <[email protected]> Cc: [email protected] Fixes: e6a3531 ("dm-verity: restart or panic on an I/O error") Suggested-by: Sami Tolvanen <[email protected]> Suggested-by: Will Drewry <[email protected]>
1 parent 9852d85 commit 4627632

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

drivers/md/dm-verity-target.c

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

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

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

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

0 commit comments

Comments
 (0)