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

Commit eb581547 authored by Hsin-Yi Wang's avatar Hsin-Yi Wang Committed by Greg Kroah-Hartman
Browse files

fdt: Update CRC check for rng-seed



commit dd753d961c4844a39f947be115b3d81e10376ee5 upstream.

Commit 428826f5358c ("fdt: add support for rng-seed") moves of_fdt_crc32
from early_init_dt_verify() to early_init_dt_scan() since
early_init_dt_scan_chosen() may modify fdt to erase rng-seed.

However, arm and some other arch won't call early_init_dt_scan(), they
call early_init_dt_verify() then early_init_dt_scan_nodes().

Restore of_fdt_crc32 to early_init_dt_verify() then update it in
early_init_dt_scan_chosen() if fdt if updated.

Fixes: 428826f5358c ("fdt: add support for rng-seed")
Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c0d07641
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1110,6 +1110,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,

		/* try to clear seed so it won't be found. */
		fdt_nop_property(initial_boot_params, node, "rng-seed");

		/* update CRC check value */
		of_fdt_crc32 = crc32_be(~0, initial_boot_params,
				fdt_totalsize(initial_boot_params));
	}

	/* break now */
@@ -1213,6 +1217,8 @@ bool __init early_init_dt_verify(void *params)

	/* Setup flat device-tree pointer */
	initial_boot_params = params;
	of_fdt_crc32 = crc32_be(~0, initial_boot_params,
				fdt_totalsize(initial_boot_params));
	return true;
}

@@ -1238,8 +1244,6 @@ bool __init early_init_dt_scan(void *params)
		return false;

	early_init_dt_scan_nodes();
	of_fdt_crc32 = crc32_be(~0, initial_boot_params,
				fdt_totalsize(initial_boot_params));
	return true;
}