Received: by 10.213.65.68 with SMTP id h4csp434626imn; Tue, 13 Mar 2018 08:58:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELthHKbM6R1iBcB6ACguue23hGqBf7OKRG76BIwJlZqAXrVcDuDX4D56S/qOWr3cOxvKR0aN X-Received: by 2002:a17:902:8302:: with SMTP id bd2-v6mr996124plb.322.1520956684339; Tue, 13 Mar 2018 08:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956684; cv=none; d=google.com; s=arc-20160816; b=XrnNEf/BLWrjYCOieJg3f93bApigZrt5osA8tHPH/60LZMSZra828HIfrPwzndPDKq KGuax6dYXiaWr7KCn0g55MZIG7FhTu+Spwcg1da60vTabaCMPM+nQqJMawEz5haigALe bKsZ7wOeEml21vFJz5u5ZMEB7Aq0OooivCm4NQhUvU0xDj3Hnge4uj7IVSr4AWJd15LW ar7hY4g7KGACePsqxsLzejvXlyc0qWeVRxp6VR1mub4HlCGZMGSSe/FRxv6J+frO+V5P 7jFyhRRKyCxX+PtTUFcFpFyYZcOjbeScWGmCL9XpZJUc+pSVQNEWbUNUi7SgaM/+P+OT pETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fm6AodDvrgzLgXBYtUU5uHUdRl6LqCpCHN7ZgQUroV0=; b=qMkO2cOfcWpRugg1vjV/P1354Il+cShYmG0KOigxNkNH0p3wHJX34YwXxuXjX8G89h NObCdvPzZm1nW00/Hvcm9m/N4BWkAH91IKNHgsvoj4s6lEv/EUH9dmtTT+mza0/fCvBe ijR2r0K+g3oRo27tHofojq2+1FQh3JAHYuU2iHYc098wpK8RFeX2kNbxGTRaTTy+JmaN /UxrLAUx8r19Wh3hdFeLzzlL68+QIwYnvPxGWbp0HldV5S9XpBJFvtM7AXhtTa1ZxuUC 9cbBMbmFIMbaXr959I6o5TcLNpaqH9q/c8iLZINFkGKM86QcyC7iHYRm9uSUGMcPFTdR x/LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 80si342316pfn.73.2018.03.13.08.57.50; Tue, 13 Mar 2018 08:58:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934595AbeCMPiq (ORCPT + 99 others); Tue, 13 Mar 2018 11:38:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34974 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934584AbeCMPio (ORCPT ); Tue, 13 Mar 2018 11:38:44 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 84A63F2D; Tue, 13 Mar 2018 15:38:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Ralf Baechle , linux-mips@linux-mips.org, James Hogan Subject: [PATCH 4.14 079/140] MIPS: ath25: Check for kzalloc allocation failure Date: Tue, 13 Mar 2018 16:24:42 +0100 Message-Id: <20180313152503.444009904@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King commit 1b22b4b28fd5fbc51855219e3238b3ab81da8466 upstream. Currently there is no null check on a failed allocation of board_data, and hence a null pointer dereference will occurr. Fix this by checking for the out of memory null pointer. Fixes: a7473717483e ("MIPS: ath25: add board configuration detection") Signed-off-by: Colin Ian King Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Cc: # 3.19+ Patchwork: https://patchwork.linux-mips.org/patch/18657/ Signed-off-by: James Hogan Signed-off-by: Greg Kroah-Hartman --- arch/mips/ath25/board.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/mips/ath25/board.c +++ b/arch/mips/ath25/board.c @@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t } board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL); + if (!board_data) + goto error; ath25_board.config = (struct ath25_boarddata *)board_data; memcpy_fromio(board_data, bcfg, 0x100); if (broken_boarddata) {