From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 171A6C55185 for ; Wed, 22 Apr 2020 11:03:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D82212076E for ; Wed, 22 Apr 2020 11:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587553408; bh=XQndNtV6aYdAMvOJ3MtddVAuklQSYHjHVv89qNnbkPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ROnLlJWhAk7EDRGGbI2xcYyCHJ3xyhoD5HFVLI6P5JHjEkGiY+Yu+hzxkWPL1EsaS tp4Vb03hKVDWMaxhGXAYRCWrH76+4npfIsn6X9WflsqEiRR0FaYzqVGftcgoY1BM6A tXpSO8AWCyI8zJjpxX7YvC9+2IoA/nswvjt/B6yY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726581AbgDVJ76 (ORCPT ); Wed, 22 Apr 2020 05:59:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbgDVJ75 (ORCPT ); Wed, 22 Apr 2020 05:59:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBD9820774; Wed, 22 Apr 2020 09:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587549597; bh=XQndNtV6aYdAMvOJ3MtddVAuklQSYHjHVv89qNnbkPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/3cj62pwcYIvYUvrceO5BW6PfAzpnOLZxgQBcSS0vI2Vd+SFd2mLJAlFgOUJNJmE JebKRfk8hkZtYMjFQpde1vZTtxqsEHV1q0qFWAX+DYMdDC/aEQkl2vyMhfs80OBazC 8JnqTWW1AHhjG/Obtcy6bIA/q/tO8TXJb2K9BoWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Thomas Bogendoerfer Subject: [PATCH 4.4 029/100] MIPS: OCTEON: irq: Fix potential NULL pointer dereference Date: Wed, 22 Apr 2020 11:55:59 +0200 Message-Id: <20200422095028.120151869@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095022.476101261@linuxfoundation.org> References: <20200422095022.476101261@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gustavo A. R. Silva commit 792a402c2840054533ef56279c212ef6da87d811 upstream. There is a potential NULL pointer dereference in case kzalloc() fails and returns NULL. Fix this by adding a NULL check on *cd* This bug was detected with the help of Coccinelle. Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/cavium-octeon/octeon-irq.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -2168,6 +2168,9 @@ static int octeon_irq_cib_map(struct irq } cd = kzalloc(sizeof(*cd), GFP_KERNEL); + if (!cd) + return -ENOMEM; + cd->host_data = host_data; cd->bit = hw;