Patchwork arm64: kexec_file: return successfully even if kaslr-seed doesn't exist

login
register
mail settings
Submitter AKASHI Takahiro
Date Jan. 11, 2019, 7:40 a.m.
Message ID <20190111074021.23639-1-takahiro.akashi@linaro.org>
Download mbox | patch
Permalink /patch/697463/
State New
Headers show

Comments

AKASHI Takahiro - Jan. 11, 2019, 7:40 a.m.
In kexec_file_load, kaslr-seed property of the current dtb will be deleted
any way before setting a new value if possible. It doesn't matter whether
it exists in the current dtb.

So "ret" should be reset to 0 here.

Fixes: commit 884143f60c89 ("arm64: kexec_file: add kaslr support")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 arch/arm64/kernel/machine_kexec_file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
James Morse - Jan. 11, 2019, 3:33 p.m.
Hi Akashi,

On 11/01/2019 07:40, AKASHI Takahiro wrote:
> In kexec_file_load, kaslr-seed property of the current dtb will be deleted
> any way before setting a new value if possible. It doesn't matter whether
> it exists in the current dtb.

Could you describe what goes wrong without this patch?

If the rng isn't ready yet, this stale error causes us to return an error,
causing kexec_file_load() to fail unnecessarily.

> So "ret" should be reset to 0 here.
> 
> Fixes: commit 884143f60c89 ("arm64: kexec_file: add kaslr support")

Reviewed-by: James Morse <james.morse@arm.com>


Thanks!

James

Patch

diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c
index 10e33860e47a..f2c211a6229b 100644
--- a/arch/arm64/kernel/machine_kexec_file.c
+++ b/arch/arm64/kernel/machine_kexec_file.c
@@ -87,7 +87,9 @@  static int setup_dtb(struct kimage *image,
 
 	/* add kaslr-seed */
 	ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED);
-	if (ret && (ret != -FDT_ERR_NOTFOUND))
+	if  (ret == -FDT_ERR_NOTFOUND)
+		ret = 0;
+	else if (ret)
 		goto out;
 
 	if (rng_is_initialized()) {