Received: by 10.213.65.68 with SMTP id h4csp528795imn; Fri, 16 Mar 2018 10:29:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELvg1pVgI2AWsSqDm7gy+JHtJFK54fiZ3g4hZ4JahpMXioIebVwW5oiUnwQyD43JtuKv3yVs X-Received: by 10.98.248.7 with SMTP id d7mr2235512pfh.117.1521221372964; Fri, 16 Mar 2018 10:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521221372; cv=none; d=google.com; s=arc-20160816; b=nbFYXrabw3FQkelZJLLq0tTVrriY9cRMhbbYJSrVgW8NyfqXIZeuOuUomeBpmlH7Xz 6xIdkrL8hB3truJgUQYlSr7rnY5qU5NiqqAa1fiNu4FX1YNeVDtQMXzgp12gngoAHjML wpYxrJ39mLKtH90MzJgMcyK9i2SLn0JFfJU/G7g25aAJs1uoRUaOlz/fEeMng+XHFGoU S9rqRW9Iwdw0UMGFsoJP9SoVblGVMBNJdRFPwUsmtQxiK4CkMui8SCEPs1VIVEP9VhUJ mDgnrU0+Th8sRVDDIyiNIneO1hK/WdCSUrA2ljqNI/2mpGIhc5xPKvh9ZDufujGnobcD dWWg== 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=k2fZLwGNh6r2TRSHMyUsXztaDNRHYwD2BOhsM2WRUWw=; b=oRGENc1J1AIO8fGOHuCp0hpoM+oF4wDmIwxbBzx2RsJXbp0sF+u8yO2ZL+jMDCM074 zKS4P4SroH2Ghy8QjuXeEFUSmPlYptp4azY+tenSNcgflO60S42LGNf/CAuq96ly+XSf QAhAhHxDpTZKd5X3zv+zlx4c/crcIYU0GwuO+snm16J8MfwUew1FaL9+OPu1/gc7AD4g lC1S32nPimlROqnj6Divz2IoC2ibdtLNAVHSP4HzDP3ehF/vTloLFvu8gYFROReG1owM T5U8vGdbQqTbhr6IWdB5E2L2RPqHsrjydbUbsI789che+7E/qn4P4AUmWMJEzQZ1sXWk 1w+g== 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 2si5275033pgc.114.2018.03.16.10.29.18; Fri, 16 Mar 2018 10:29:32 -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 S1754321AbeCPP20 (ORCPT + 99 others); Fri, 16 Mar 2018 11:28:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35280 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932832AbeCPP2X (ORCPT ); Fri, 16 Mar 2018 11:28:23 -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 0424DD23; Fri, 16 Mar 2018 15:28:22 +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.4 14/63] MIPS: ath25: Check for kzalloc allocation failure Date: Fri, 16 Mar 2018 16:22:46 +0100 Message-Id: <20180316152301.624796460@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152259.964532775@linuxfoundation.org> References: <20180316152259.964532775@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.4-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) {