summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2024-10-02 15:56:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-04 16:30:05 +0200
commitcada2646b7483cce370eb3b046659df31d9d34d1 (patch)
tree01bee65c48ce8903510e74da7fae78b89ca828f4
parent646749b423c4dc039e2793c8025fe33ad1ad271b (diff)
Revert: "dm-verity: restart or panic on an I/O error"
commit 462763212dd71c41f092b48eaa352bc1f5ed5d66 upstream. This reverts commit e6a3531dd542cb127c8de32ab1e54a48ae19962b. The problem that the commit e6a3531dd542cb127c8de32ab1e54a48ae19962b 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: e6a3531dd542 ("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>
-rw-r--r--drivers/md/dm-verity-target.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 442632e60e9c9..3636387ce565a 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -264,10 +264,8 @@ out:
if (v->mode == DM_VERITY_MODE_LOGGING)
return 0;
- if (v->mode == DM_VERITY_MODE_RESTART) {
- pr_emerg("dm-verity device corrupted\n");
- emergency_restart();
- }
+ if (v->mode == DM_VERITY_MODE_RESTART)
+ kernel_restart("dm-verity device corrupted");
if (v->mode == DM_VERITY_MODE_PANIC)
panic("dm-verity device corrupted");
@@ -691,23 +689,6 @@ static void verity_finish_io(struct dm_verity_io *io, blk_status_t status)
if (!static_branch_unlikely(&use_tasklet_enabled) || !io->in_tasklet)
verity_fec_finish_io(io);
- if (unlikely(status != BLK_STS_OK) &&
- unlikely(!(bio->bi_opf & REQ_RAHEAD)) &&
- !verity_is_system_shutting_down()) {
- if (v->mode == DM_VERITY_MODE_RESTART ||
- v->mode == DM_VERITY_MODE_PANIC)
- DMERR_LIMIT("%s has error: %s", v->data_dev->name,
- blk_status_to_str(status));
-
- if (v->mode == DM_VERITY_MODE_RESTART) {
- pr_emerg("dm-verity device corrupted\n");
- emergency_restart();
- }
-
- if (v->mode == DM_VERITY_MODE_PANIC)
- panic("dm-verity device corrupted");
- }
-
bio_endio(bio);
}