Received: by 10.213.65.68 with SMTP id h4csp523908imn; Fri, 16 Mar 2018 10:20:38 -0700 (PDT) X-Google-Smtp-Source: AG47ELuWTWZE4pswx8r1i8sAtRnVyScWJiBqKwRrAYXMER/4wd68uTCGjJ9aqo7tbs8urecy9SRy X-Received: by 2002:a17:902:9349:: with SMTP id g9-v6mr795230plp.243.1521220838499; Fri, 16 Mar 2018 10:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521220838; cv=none; d=google.com; s=arc-20160816; b=IbmNECwhRjCTLepTNMuk5iab9xJWUtALlGo3IRVICKnex7FR74d3QD3Yuyk49doCs1 W/vCbFwrHZzY58CmZt90CM7rBjV9iIMJZJyfEuomHD2tqXjHQDCXJA3s376QNhwQZXyX kVi0RhY4/W5ID9scsITD3pECMH93Z3nsDo+GMj80+fh/Rhi6QFNwb48tRPlSXD20YDNw ibo22bxKjSB7Q+ZzdnCfemYSDtS3sCEZBTJ5j+2j9yhy1TAdkBX6yCDkrud88Tt1Ji+L Q7plIvwOBGXDJA+1mWfa5IgEb6jteGrW0W5owbo/Yuu+HFl+0iDexRYZkljGZVemzX6J fB2w== 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=Z3GVr2i4nKrTAmZ5vbRyN6wIAMLhXmHlqx0okn19jUQ=; b=LHJO0oV2Ev6x/Sr7AKue48rat4Zdq7fucoQfmRyjLxPfmBJ/r2WAAHXA+kglyC+K6/ oMvCN0lCfsc8LsRLiVKt/3eQPqpBImGtkVp7AjZV/xAAniTJXayAVTsHAsoaCXNI03al TOum4YzFCVt22c5czO9rSy/GrBkM++g8TINPKZhWZgjOLyz/uIXlCE5s6pFCSidsCGpn Xd3EyIREzXtgO7UmCtWgsiHm7Yc6okKpll/bA0KXxzq7HsAA1eqLq3L/QPeYIDJfPDKg XN9GDWemtIOvmExeUKeglHhpjIwxtlIZidJVGhNRHWlY8arTbk0dOSZMnDTjF/WIQuBo i3pA== 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 d191si5170560pgc.659.2018.03.16.10.20.23; Fri, 16 Mar 2018 10:20:38 -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 S933305AbeCPRSn (ORCPT + 99 others); Fri, 16 Mar 2018 13:18:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36494 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbeCPPaW (ORCPT ); Fri, 16 Mar 2018 11:30:22 -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 9B6DD1131; Fri, 16 Mar 2018 15:30:21 +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.9 19/86] MIPS: OCTEON: irq: Check for null return on kzalloc allocation Date: Fri, 16 Mar 2018 16:22:42 +0100 Message-Id: <20180316152318.629554982@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 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);