Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3203318pxb; Mon, 9 Nov 2020 05:31:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKwqAeJ1zr9Z08ldqYUQ6D4Ytg+qMwmhqlLZPOrmUIpmFXzdi46TO1l/1mkZej5IbwZdr3 X-Received: by 2002:a05:6402:b3b:: with SMTP id bo27mr14831806edb.376.1604928678955; Mon, 09 Nov 2020 05:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928678; cv=none; d=google.com; s=arc-20160816; b=iaXyzRWVmWnJOd5hPHXHzUAcGVm2OSi0dPnoQAAn2YV8I/Jz8nDqRn3m/nIQkgqqhk 0VWkbZPgAkgq9lmK08Sz6jv4O+p+yY2I/JnYTUEy7vnN/m2iEQgUS+rzK9j8lc6M324Q QosE1LXfLWFVf804YA4vVbJu6WJz3/zTqN60GwJqPQs20DMBYCEDuCRo+a3CYEDiYOiI 5a/Dg4bDTRRTWYScxD1foMA8rtjDYiaedR2SlXh7q1E/A7ynNNJqo+JqBz7rfQSsVnZx xtrAUBI/s2swviwWs4RiXwtyv3G+xYlrI7qTonDwiQtqp/BH0jZPadefnfQKrmP+7ffl 2r9A== 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=HjG6OBvUhsJN6Z9Kk+QN8n/UAKG+yOXs96O6NT3B2U4=; b=pH50n8N0jQ+MzqFfLsoGHiXlbSfALgluLyOAO0IegLgBCpLoOI8qa1cgDTK4ATIm7j BnYM+xJrce7bbJuohUOJvNxowLfbEDy4/VgtGFrg6SJ3ohP5KNOhe1Z8VhdrOWHa96J0 YMSVdNw06ODi2k4e8bwNyEbAxV2DkU9Trp3Ins8fDQPmu2xXTj+n+7wwDCwk2QTOKhLb uW/3uHyzhV7ce/RfkE0xzWnawp8Bxeqd4CHsqpcS31bqP2wdmWFfF06cP3xYRhOU/1RY v0AgOV3KIfWGb0uPgj65mWe2RFY5stMr/aXTqQ8LXAnaD38aGD6UVPXWfdyRm2bN0L5R EsPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cicXjg37; 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=fail (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 l12si6958082ejx.101.2020.11.09.05.30.55; Mon, 09 Nov 2020 05:31:18 -0800 (PST) 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=@kernel.org header.s=default header.b=cicXjg37; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732718AbgKIN3i (ORCPT + 99 others); Mon, 9 Nov 2020 08:29:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:37534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732507AbgKINL7 (ORCPT ); Mon, 9 Nov 2020 08:11:59 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 59DF820663; Mon, 9 Nov 2020 13:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927519; bh=k4bdtbA0dFbR9aFZwYxBWMXTGB4kKHFu9Z/ClaWl9Ro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cicXjg37GJRMSqXhYg+kpyLN6IexJu/ulytXkvagT9gnDWSRmBuAoIVkLVgWQyt6m kgwn32hZFbwL/jaiKVH2L66YzrNKl8gUsrPlxVG5w/toarXB1fw6/QGxTp+0nUHXz3 IffDI8aeLJ25M0UnFoXiZrDyQCoCofuLrYK2ZJTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shannon Nelson , Jakub Kicinski Subject: [PATCH 5.4 16/85] ionic: check port ptr before use Date: Mon, 9 Nov 2020 13:55:13 +0100 Message-Id: <20201109125023.366063108@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125022.614792961@linuxfoundation.org> References: <20201109125022.614792961@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: Shannon Nelson [ Upstream commit 2bcbf42add911ef63a6d90e92001dc2bcb053e68 ] Check for corner case of port_init failure before using the port_info pointer. Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support") Signed-off-by: Shannon Nelson Link: https://lore.kernel.org/r/20201104195606.61184-1-snelson@pensando.io Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -125,6 +125,11 @@ static int ionic_get_link_ksettings(stru ethtool_link_ksettings_zero_link_mode(ks, supported); + if (!idev->port_info) { + netdev_err(netdev, "port_info not initialized\n"); + return -EOPNOTSUPP; + } + /* The port_info data is found in a DMA space that the NIC keeps * up-to-date, so there's no need to request the data from the * NIC, we already have it in our memory space.