Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp628425pxv; Thu, 15 Jul 2021 11:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlS7cfrkyX0ZHTORYql9qPujJHZwemNmMM8eQeWIVGgsENP5/3/MYKrGA99UR+vN+QRMbK X-Received: by 2002:a05:6402:b8a:: with SMTP id cf10mr9097196edb.61.1626375370531; Thu, 15 Jul 2021 11:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375370; cv=none; d=google.com; s=arc-20160816; b=Ke0kFJj5YyVzC07gFEODZO4d+f2ae8sNYsImPNZ9fDZgBCzQ/ZiKFp5MMICuWUTC7D 7/l55/6OKJ+D41NQVVbYRTQ0BFlAdYEzZZiRHJHKTewtwX6aIC+ZOcDS8yswS4A+Xf+B x8mzBqD+LyQ6YkNLfCf10BG/y3SOKzP2CLqd3XEMck1isLW+4zLfgyy+olDXyXTqhnOv k/iOP1b/tZZpHOuSwbuCnLAot2/8uT8oO1IUGNClM90yGSl21gMzdCQVaY1F0bc3qyJx ePhwLYMSvnXiwb2XtLeoAjTb9u7F85ZMvu7ZewbwGzP8EZpir105wOgo3VZmPACxH4gR ag3Q== 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=cRlLxONI81pxEtfmlkW42AQw36PmyfjZ1Q4vyHtI14cfz6JPSRVHlLPdhh02gO0w6V BqKWEXj9HlIy79c5S6glUygdQq6Qve8r4L9Rtdc7kZEAmpsQBrpV53UVvCTI2BfCajjn SqO7r9FORkgzuewBVA90GUY132+ITTAVltqsF7/QJjvYLS4WZTKEHsNSwMrziE5iUh4p u58qKovyYwe1NU6hv9aDx0rzAZA8mvhO7H0ZQB62C2XjlyWzHvgwJGVdgHyjBQZeiEkJ aMLKGaNgSk0qiu4+AUaEaaCl1dSIxm+28mdmFhi14rHgvguovbRVmTQvtA6oecKGBWar 1VEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zS2umLkX; 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 eb13si10060386edb.245.2021.07.15.11.55.46; Thu, 15 Jul 2021 11:56:10 -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=zS2umLkX; 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 S240899AbhGOS5Q (ORCPT + 99 others); Thu, 15 Jul 2021 14:57:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:54368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235390AbhGOSvL (ORCPT ); Thu, 15 Jul 2021 14:51:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20F61613D8; Thu, 15 Jul 2021 18:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374896; bh=KZaRLMtRE0FWoJ0aN/q7uQVN7VWE0e1ynuofh4g/AEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zS2umLkXCyuALu4aVo8V/rsnKNm6q8nMRqVi39TXmhuJSrupGx8NNYVjAQS+hRCIy 3IBOzQHnXdG8CF6e3u+uq5FU+BHJ4XJG52R8vTxbRzqJ7yrCN8jqGrHGSNBLQzTygw BQejquY6Sr/Q1EW1G/mxfllhMiBn0e2rQ95iW0TE= 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.10 073/215] fjes: check return value after calling platform_get_resource() Date: Thu, 15 Jul 2021 20:37:25 +0200 Message-Id: <20210715182612.356171948@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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