Received: by 10.213.65.68 with SMTP id h4csp420534imn; Tue, 13 Mar 2018 08:31:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELuxDlLjEiMTB25FPNorsTTv3cDmt9Oe7Aa4fFkP+zmMaS65Xnm3Vd389PkFOV7xdb+j93ec X-Received: by 10.98.92.194 with SMTP id q185mr993368pfb.63.1520955067174; Tue, 13 Mar 2018 08:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520955067; cv=none; d=google.com; s=arc-20160816; b=OJEWwzPATuJ3QkNqpK1YJ/oCP0o/xZ+T0uBH4jFyjvim9iCIh4Z8gvzTmsEq6q9SJf SpBL2bhe00bHQH7jPfMJWpra+SRnKcpkqGfpFwguyY6JWnUQ9x6YAPBOCuX5UP+uYDcA 0Bg3J7cm0C/f+YoKbq82Bw6b//0F47KVcolqOrV+P5uY6iyyCLU4/0/k9RTMGlAlW0rp TK5CXqlkkroAdkeS30O4tBB4zZwAGSCuxsRDvl9IbaHHB0phTgjlD5Im2FV9SPhc5UdH LaycCRK0f55VQJQ57ioEM8vSuRVP2uk+sdxudTzyu1MUM5qzGyUYgKm2HMy8VIbgBUvE ovAw== 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=lK922/lm+jk6dEQgfcgIDkKyKSWomKOkz/qMHaIZK/Q=; b=oDSHYMJJnHowdgSH5BupqkGz6PF+EeHoMuBv4506eIUbpbudwoNZCvnm5p8rPZWZSZ 1bbh9JSq+k6eC8nL56T4Yf96SZgsUf8PIjELFANlUq70Bj+MmJuaAf7AhG27O3lAfz/X 6U/ygNbEijprjlzoUjUx53HYDbJ61ySRc0UnfgplMv19IVkm78cKjXu7nLg2YzDvZ6fb t4VWTg1A0driU4ACFo9osdb4fEthCrX3jKBt+8Kc1qDVDGtaLSktdp/SH69FMAmwgUW5 dxiAlPd8TI/l2SsxsA9CBbmCzvIlCog8IC683qjdaOoOuCiftUhnAdAms+tp6idSeDcy ehJQ== 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 e30si262441pgn.261.2018.03.13.08.30.51; Tue, 13 Mar 2018 08:31:07 -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 S932943AbeCMP3Y (ORCPT + 99 others); Tue, 13 Mar 2018 11:29:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58350 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751735AbeCMP3W (ORCPT ); Tue, 13 Mar 2018 11:29:22 -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 4B15BF80; Tue, 13 Mar 2018 15:29:21 +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.15 041/146] MIPS: ath25: Check for kzalloc allocation failure Date: Tue, 13 Mar 2018 16:23:28 +0100 Message-Id: <20180313152323.760025151@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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) {