Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp652428pxv; Thu, 15 Jul 2021 12:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfY2wdvZ3HMDIzbTA4NYPULPBeuyK2F19aP7uvTNHckYepCWAbLY9Z7GyhCXVhCSMAF5OO X-Received: by 2002:a05:6402:4314:: with SMTP id m20mr9200841edc.71.1626377518117; Thu, 15 Jul 2021 12:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377518; cv=none; d=google.com; s=arc-20160816; b=b34JaZVnCmrAFM5thGSlC6EkFg8EJ7OplwWIAkXHzam75tvDcXFoWE+jmvlMTBPjfr jS1vhfhZXDnxCZKvU7wWLKqDt158fwQceIqLceIhvKyrpfHn1MVp6sggXuqQFTCURfIX t6E7FZmiZwW5UlO+tI6xj1KLg5mOZZvp195tMHaa0P/PpD8rVICB103M2Xnc5iRxu0dl fW+ATslG5gp2vsK6R2aK+25zZzRgjAEbif/kEU3SsuSZ74onoPhMYoMiTFtuqOgHnEtp wMn3/jptv+eUwdmBOrzLlNMBw7kz9ZXhqgG7dbrLt3lUv80TvDhMOWSjj1UWq8Eibe2m JRGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IzMN/m+AU1tzMJ9nqMzM6cf+oXHvcKgeiMqOeM76Q8Y=; b=uu3mS4B1kzE7J81zduS+1rVl+nGBqDF0A90fT088aWTn6UTVookU2o9XmGuwtU4Zy+ Da3wgHck0O6OkoyE8gI56UsaDpEIIgXdC+8znDYdj6GPpBYIyHS/Qa7cYT930MWUOAa1 h2R2taUsqPj4DMxclGVIEbQa+s5nB4pwNLdr4I1ZmDVRPZ6b/j2T0x5sHrhox8hijV6b sS4PrnF9Ygq7EHFmRI361dfexEzjIBjIramS2+rMX9pjbgmDfDlVUqfANMuLC/qZGLXn HU45Y2WsebNhWvuHGqlmoBFW42Q21iODV8EV/yf1O0hncRCW19eI6mImzTytpSRM09YN bGnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NVrvCqpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn7si6910611ejc.635.2021.07.15.12.31.34; Thu, 15 Jul 2021 12:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NVrvCqpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243862AbhGOTcK (ORCPT + 99 others); Thu, 15 Jul 2021 15:32:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:46406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243890AbhGOTKL (ORCPT ); Thu, 15 Jul 2021 15:10:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 521516127C; Thu, 15 Jul 2021 19:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376021; bh=KZaRLMtRE0FWoJ0aN/q7uQVN7VWE0e1ynuofh4g/AEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVrvCqpQt9VSN86NhrKb/5YDXb7Ou5RJoACxg1Gd/WzJsrqkj+qbzzsTeZw/gf7BI 9aGUg3fQPdz/DS6lUNfmK5Jhs6JjCkZNtSLvl5PAh45pkjL6nEbBNn7nRi8A0G4ZKx Bu8z/LEu28oSo9qfTR2nHAYvYIWtmEOrRmFBcqEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.13 093/266] fjes: check return value after calling platform_get_resource() Date: Thu, 15 Jul 2021 20:37:28 +0200 Message-Id: <20210715182630.547292659@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit f18c11812c949553d2b2481ecaa274dd51bed1e7 ] It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/fjes/fjes_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 466622664424..e449d9466122 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1262,6 +1262,10 @@ static int fjes_probe(struct platform_device *plat_dev) adapter->interrupt_watch_enable = false; res = platform_get_resource(plat_dev, IORESOURCE_MEM, 0); + if (!res) { + err = -EINVAL; + goto err_free_control_wq; + } hw->hw_res.start = res->start; hw->hw_res.size = resource_size(res); hw->hw_res.irq = platform_get_irq(plat_dev, 0); -- 2.30.2