Received: by 10.213.65.68 with SMTP id h4csp464170imn; Tue, 13 Mar 2018 09:53:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELvLGP/FuQVFLf2rVbz4tCJfE8zTQwLjrEmhQwz5+OHvuo4yDHzr1X2KOC7E4Xp9JdVx5Xq0 X-Received: by 10.98.238.2 with SMTP id e2mr1266358pfi.68.1520959996242; Tue, 13 Mar 2018 09:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520959996; cv=none; d=google.com; s=arc-20160816; b=txlPYpHMENzGlu+kJ8Ix+a4Z08C9YEr6DyuqPt6cdMV6xH0dwtvWbXlpJZDgNnPS3f NzHzdJQd7nm0YUTYBZbIdj+/xZj/Ya5Doud1hfwq5BuJfHTGkDPWH5Z1G0RdoddNEp8N 8l6Zj4y2r16TSRt1Y8DvpnE/wDE0+nhcKVz6EvISE5prjTb4UDZ/oewx4/9EVaOBAPR4 GvZ2e9vamOV4p48M8QDeu3C7oyel/C/EnDKytUSmrG0t+50uheY2hFXM5xIM2s5JdDG6 zTzHxM/1ShBE0/C5aEGgvAEe1A+SgX8Vj2x2U/jOy1eiyXvMmZxZwIGnoJGoC3pX0ONL 9law== 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=xk722ifFwffHNojg4iW2tdaZbJ7n3u0icedOW2OWNvI=; b=lZy/geicehJ7LrxcZSn72A6C9c9E/aFsMDHIBmfykj38YinuxVJ2II17K0HYs+lcan aWFpbP+d87KMKXXx9bZhqFXqz5roklVW1eqCcgdpsxpM+ASUWKK3qLCSrM1dEmPC0pE6 HmGsVA+3RvmQtURGnMaNsQlBR4mJ1LVAEJFnFqfrfHR4FUquZD6EhZ2Ct9cigk02gaK9 Jqdo/NO/7P6GsBGsSoflMP+9Tzzdh4TYwZWPP85FZ+nkBr4GqG39fU0bAmESLaCHORTJ BYXRbjhf0QwgwUvBU0QfKwLJgOyr4mbeVH0Af7UwpoH7H+pVypTA+uKX2moePvE5hzN1 +6pg== 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 y6-v6si337271plr.174.2018.03.13.09.53.00; Tue, 13 Mar 2018 09:53:16 -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 S933322AbeCMQv0 (ORCPT + 99 others); Tue, 13 Mar 2018 12:51:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59078 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbeCMPbD (ORCPT ); Tue, 13 Mar 2018 11:31:03 -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 7630411DA; Tue, 13 Mar 2018 15:31:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , David Daney , Ralf Baechle , "Steven J. Hill" , linux-mips@linux-mips.org, James Hogan Subject: [PATCH 4.15 042/146] MIPS: OCTEON: irq: Check for null return on kzalloc allocation Date: Tue, 13 Mar 2018 16:23:29 +0100 Message-Id: <20180313152323.843219417@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 902f4d067a50ccf645a58dd5fb1d113b6e0f9b5b upstream. The allocation of host_data is not null checked, leading to a null pointer dereference if the allocation fails. Fix this by adding a null check and return with -ENOMEM. Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes") Signed-off-by: Colin Ian King Acked-by: David Daney Cc: Ralf Baechle Cc: "Steven J. Hill" Cc: linux-mips@linux-mips.org Cc: # 4.0+ Patchwork: https://patchwork.linux-mips.org/patch/18658/ Signed-off-by: James Hogan Signed-off-by: Greg Kroah-Hartman --- arch/mips/cavium-octeon/octeon-irq.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -2277,6 +2277,8 @@ static int __init octeon_irq_init_cib(st } host_data = kzalloc(sizeof(*host_data), GFP_KERNEL); + if (!host_data) + return -ENOMEM; raw_spin_lock_init(&host_data->lock); addr = of_get_address(ciu_node, 0, NULL, NULL);