Received: by 10.213.65.68 with SMTP id h4csp523939imn; Fri, 16 Mar 2018 10:20:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELv4/Jl1nFqK5pcbJd1KeJL7Lifq8aECiltXka45weHHRzAkOaCQFaYskUq5WAEuURFIRCii X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr3012174plm.160.1521220841636; Fri, 16 Mar 2018 10:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521220841; cv=none; d=google.com; s=arc-20160816; b=nvf9nsQPL/h8k94KLzR182C9nov6PP3m+xl92Ig6SD47ApSj7skCsY8QNcQmk5Ysp2 0LwRtdHBoWlZoOPKke6Tx+vTSEg2A1YtJcjOLEkhZQguaFk23FqRIa66iicFoMqjbY2p SHNcs1fm4l4uLAutH7fJDxo2xUVN4Um3CQR5Z4EqbX5iSE+lmdJqQTGcgBow9F9o0zqi jX646di/vBESElirHV2gUS2buuIByRqTmFA6sWbyS3N5em5owGtc6UY5NDd3OggXEDiS JHROJL91S9N6kv0yh3SHG2Pn5DhvHMaH8sVpWfJPELdxX0JG/wnuyAwMBXjb3GHTE5A/ dhQQ== 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=YQAR7MU8EA3kzQnU3kH99+9iPiBzVxr2+DMdQ96zfFg=; b=v4lSu9p54qswSWzNyFMIm3NJSc3JjSBw/Kyco7PYY4eDBG31RgP88Q4IzexqkeSQwu 5z65OtmG8uV1tckD5w344HhRDo/V53ZWOiEugFau8KlsGlIG5eUqcaLQIa8SvpnqlyWL WpycPU7GyHixxKS+D7ZDhJ4z2xl3EOV7n4m0x2xOk8QV9rsx3wst4SvPlycumrhg9GeH jhFewJu87vs9hTP6wkQiAVU4rooaVP08O3Z2yAWBWtKCmhkASMnCsQ2f9rvZzw0pSsJ8 NXxsE3xSO/xNBRMPoqCyX04sppAZ8FtjoJtkQAuhdJEgVkLhaGVL3eMDr6LmSW42wA5i 2C9w== 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 f5-v6si6622251plf.223.2018.03.16.10.20.27; Fri, 16 Mar 2018 10:20:41 -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 S932881AbeCPPaX (ORCPT + 99 others); Fri, 16 Mar 2018 11:30:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36450 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752875AbeCPPaT (ORCPT ); Fri, 16 Mar 2018 11:30:19 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C8E4D110D; Fri, 16 Mar 2018 15:30:18 +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.9 18/86] MIPS: ath25: Check for kzalloc allocation failure Date: Fri, 16 Mar 2018 16:22:41 +0100 Message-Id: <20180316152318.571317500@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@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.9-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) {