* [PATCH stable 4.9] fdt: Update CRC check for rng-seed
@ 2022-06-28 16:01 Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.14] " Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-06-28 16:01 UTC (permalink / raw)
To: stable
Cc: Hsin-Yi Wang, Geert Uytterhoeven, Will Deacon, Florian Fainelli,
Greg Kroah-Hartman, Sasha Levin, open list
From: Hsin-Yi Wang <hsinyi@chromium.org>
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: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/fdt.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index e797fa92c90d..513558eecfd6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH stable 4.14] fdt: Update CRC check for rng-seed
2022-06-28 16:01 [PATCH stable 4.9] fdt: Update CRC check for rng-seed Florian Fainelli
@ 2022-06-28 16:01 ` Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.19] " Florian Fainelli
2022-06-30 13:21 ` [PATCH stable 4.9] " Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-06-28 16:01 UTC (permalink / raw)
To: stable
Cc: Hsin-Yi Wang, Geert Uytterhoeven, Will Deacon, Florian Fainelli,
Greg Kroah-Hartman, Sasha Levin, open list
From: Hsin-Yi Wang <hsinyi@chromium.org>
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: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/fdt.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 1d4090d2b91e..512d3a8439c9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1159,6 +1159,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 */
@@ -1272,6 +1276,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;
}
@@ -1297,8 +1303,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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH stable 4.19] fdt: Update CRC check for rng-seed
2022-06-28 16:01 [PATCH stable 4.9] fdt: Update CRC check for rng-seed Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.14] " Florian Fainelli
@ 2022-06-28 16:01 ` Florian Fainelli
2022-06-30 13:21 ` [PATCH stable 4.9] " Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-06-28 16:01 UTC (permalink / raw)
To: stable
Cc: Hsin-Yi Wang, Geert Uytterhoeven, Will Deacon, Florian Fainelli,
Greg Kroah-Hartman, Sasha Levin, open list
From: Hsin-Yi Wang <hsinyi@chromium.org>
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: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/fdt.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 2e9ea7f1e719..9fecac72c358 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1119,6 +1119,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 */
@@ -1223,6 +1227,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;
}
@@ -1248,8 +1254,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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH stable 4.9] fdt: Update CRC check for rng-seed
2022-06-28 16:01 [PATCH stable 4.9] fdt: Update CRC check for rng-seed Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.14] " Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.19] " Florian Fainelli
@ 2022-06-30 13:21 ` Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-30 13:21 UTC (permalink / raw)
To: Florian Fainelli
Cc: stable, Hsin-Yi Wang, Geert Uytterhoeven, Will Deacon,
Sasha Levin, open list
On Tue, Jun 28, 2022 at 09:01:09AM -0700, Florian Fainelli wrote:
> From: Hsin-Yi Wang <hsinyi@chromium.org>
>
> 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: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Will Deacon <will@kernel.org>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/of/fdt.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
All now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-30 13:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 16:01 [PATCH stable 4.9] fdt: Update CRC check for rng-seed Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.14] " Florian Fainelli
2022-06-28 16:01 ` [PATCH stable 4.19] " Florian Fainelli
2022-06-30 13:21 ` [PATCH stable 4.9] " Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.