Received: by 10.213.65.68 with SMTP id h4csp528375imn; Fri, 16 Mar 2018 10:28:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELth+0evS8zQF6G2SwsiRfdt+ycFZCzCc0LoIBYG95o9+Kg+Wys2gRK3MH9lloSqw6RHhxxT X-Received: by 10.99.119.9 with SMTP id s9mr2056255pgc.276.1521221326803; Fri, 16 Mar 2018 10:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521221326; cv=none; d=google.com; s=arc-20160816; b=RghZlxS8nh4UizInRR32KFFhcAfQSCkVBXAHlBaiZ3hoyauPqtgsfTP/QfugIy6jzk ZI3VQZ7m6EBPSxDRNRWLW49x24plYdnDclVapc4xmQV5PnTbzxWzClxQfNdF1mfadVvs HWTyXl/MB0CwgHJtIN93mZcv2lFSqmUQAQotDxxxC+o9MsLq5kbNL+oN6Md1fuaGLLMJ GOA8PIk9TCpilLqRZhcu6x6Gfw5XRzcigB/e5pviS97ISTXa6MhYXRKkrZqNhbtCr/CA sURQStEffJGC7Sw3/F2amCpHO2ypouJ9bAwF6qWQn+g3ZEPv7yqoBSwaPSG/NOPfqqmJ H37Q== 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=BPO/Dx5hrLZ8A6f4TJUpWOWxKMcZIGKgpX49B3xg4Ik=; b=cvd+HuNdMxMGYjCDmuMz7BDtF0mdTC2vnVGniLyf8KeK1zSQCCv6JbpmsMZ4pVSGMJ lEze/AK6h5qPojc5q6igdX5Tzxy5wTesiBs4jBbYxN/+7rtb2H2IQE1/cPetfN15w7N+ dQEQeH4FTdVbHxK0BbQEnmxTu18+xJnJtjdtebDR7I3UygXYneN5hgkWFjTzkMzYHdkw U7DNg09ZURJlj9lqROb0eFl++t6NLDVgtuUMltVVTge5z5TkQtwcgy42+oWbNTTI3qBy 01T+QQxTVO4Xiy0iAPR38ImsJuzF+YOmiYWCBEp5SZLzxmJrnbw+zI09ZHBb0aXc1cQt r9FQ== 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 n3si5257530pgc.12.2018.03.16.10.28.32; Fri, 16 Mar 2018 10:28:46 -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 S1754055AbeCPP2a (ORCPT + 99 others); Fri, 16 Mar 2018 11:28:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35668 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754324AbeCPP20 (ORCPT ); Fri, 16 Mar 2018 11:28:26 -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 DAA1C1003; Fri, 16 Mar 2018 15:28:25 +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.4 15/63] MIPS: OCTEON: irq: Check for null return on kzalloc allocation Date: Fri, 16 Mar 2018 16:22:47 +0100 Message-Id: <20180316152301.710281577@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 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 @@ -2246,6 +2246,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);