Skip to content

Commit cada264

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 646749b commit cada264

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
@@ -264,10 +264,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
264264
if (v->mode == DM_VERITY_MODE_LOGGING)
265265
return 0;
266266

267-
if (v->mode == DM_VERITY_MODE_RESTART) {
268-
pr_emerg("dm-verity device corrupted\n");
269-
emergency_restart();
270-
}
267+
if (v->mode == DM_VERITY_MODE_RESTART)
268+
kernel_restart("dm-verity device corrupted");
271269

272270
if (v->mode == DM_VERITY_MODE_PANIC)
273271
panic("dm-verity device corrupted");
@@ -691,23 +689,6 @@ static void verity_finish_io(struct dm_verity_io *io, blk_status_t status)
691689
if (!static_branch_unlikely(&use_tasklet_enabled) || !io->in_tasklet)
692690
verity_fec_finish_io(io);
693691

694-
if (unlikely(status != BLK_STS_OK) &&
695-
unlikely(!(bio->bi_opf & REQ_RAHEAD)) &&
696-
!verity_is_system_shutting_down()) {
697-
if (v->mode == DM_VERITY_MODE_RESTART ||
698-
v->mode == DM_VERITY_MODE_PANIC)
699-
DMERR_LIMIT("%s has error: %s", v->data_dev->name,
700-
blk_status_to_str(status));
701-
702-
if (v->mode == DM_VERITY_MODE_RESTART) {
703-
pr_emerg("dm-verity device corrupted\n");
704-
emergency_restart();
705-
}
706-
707-
if (v->mode == DM_VERITY_MODE_PANIC)
708-
panic("dm-verity device corrupted");
709-
}
710-
711692
bio_endio(bio);
712693
}
713694

0 commit comments

Comments
 (0)