Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00291c4c authored by Pangyen Chen's avatar Pangyen Chen Committed by Badhri Jagan Sridharan
Browse files

ANDROID dm-verity: fix root device init timing issue.



[Detail] Depending on storage initialization speed, root block device
may not be ready when configuring it to enable dm-verity, this causes
dm-verity critical error and system reboots. To mitigate this issue,
we added retry and timeout mechanism, where timeout value is 2s.

Bug: 68731686
Test: We can reproduce the issue before we apply this patch but we
cannot reproduce the issue after we apply this patch. Device can
always boot up to homescreen after we apply this patch.

Change-Id: Ia360a63c5c90f7d81ef1465f308995fb69406a83
Signed-off-by: default avatarIris Chang <iris.chang@mediatek.com>
parent f5613a0a
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -727,10 +727,22 @@ static int android_verity_ctr(struct dm_target *ti, unsigned argc, char **argv)

	dev = name_to_dev_t(target_device);
	if (!dev) {
		const unsigned int timeout_ms = DM_VERITY_WAIT_DEV_TIMEOUT_MS;
		unsigned int wait_time_ms = 0;

		DMERR("android_verity_ctr: retry %s\n", target_device);
		while (driver_probe_done() != 0 ||
			(dev = name_to_dev_t(target_device)) == 0) {
			msleep(100);
			wait_time_ms += 100;
			if (wait_time_ms > timeout_ms) {
				DMERR("android_verity_ctr: retry timeout(%dms)\n", timeout_ms);
				DMERR("no dev found for %s", target_device);
				handle_error();
				return -EINVAL;
			}
		}
	}

	if (is_eng())
		return create_linear_device(ti, dev, target_device);
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/device-mapper.h>
#include <crypto/hash.h>

#define DM_VERITY_WAIT_DEV_TIMEOUT_MS	(2000)
#define DM_VERITY_MAX_LEVELS		63

enum verity_mode {