Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934930AbcJQQWB (ORCPT ); Mon, 17 Oct 2016 12:22:01 -0400 Received: from mailapp02.imgtec.com ([217.156.133.132]:51208 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933289AbcJQQVw (ORCPT ); Mon, 17 Oct 2016 12:21:52 -0400 From: Matt Redfearn To: Ralf Baechle CC: , Matt Redfearn , "# 4 . 7+" , Subject: [PATCH v2] MIPS: KASLR: Fix handling of NULL FDT Date: Mon, 17 Oct 2016 17:21:46 +0100 Message-ID: <1476721306-14742-1-git-send-email-matt.redfearn@imgtec.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.150.130.83] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1026 Lines: 30 If platform code returns a NULL pointer to the FDT, initial_boot_params will not get set to a valid pointer and attempting to find the /chosen node in it will cause a NULL pointer dereference and the kernel to crash immediately on startup - with no output to the console. Fix this by checking that initial_boot_params is valid before using it. Fixes: 405bc8fd12f5 ("MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE") Cc: # 4.7+ Signed-off-by: Matt Redfearn --- arch/mips/kernel/relocate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index ca1cc30c0891..1958910b75c0 100644 --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/kernel/relocate.c @@ -200,7 +200,7 @@ static inline __init unsigned long get_random_boot(void) #if defined(CONFIG_USE_OF) /* Get any additional entropy passed in device tree */ - { + if (initial_boot_params) { int node, len; u64 *prop; -- 2.7.4