Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp422322pxk; Fri, 11 Sep 2020 10:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkNPb0bmNRtZvAJVni0XZhohWR2aBVC1VfV8sbc2o3Z63VvWhvW0fJ2jn11T5ZHEuQGnvl X-Received: by 2002:a17:906:c0d1:: with SMTP id bn17mr2916920ejb.311.1599845170805; Fri, 11 Sep 2020 10:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845170; cv=none; d=google.com; s=arc-20160816; b=AIhfbSk1yfn9EtDaDhodMemjZvz4JKReGSwiSTQorPWo8PtVxjubsEtSaAQ1tcWj4j 9nQnmgPPdbO16aDSCkIm0d225hC7AYuQXe0Eg74w5XnIrnqUaYfnCkAZyxxZRIClQBkr TzFM9rgyuRYRpNYMLwQ7dyHp53B/Sm82URZZITM5H/K1G83SPF1KF9fIKPg51vXc0zXq XZOnrbD8o8aTH8zFhDfe1mZIlfXzaPRA9nw9Q4Afp1AeqHCVljIp3qJVBbkY9h6a85+I NOZGxZaKOQrNdwYz47l+gv8tAay1wEmiB0OuX+B8O/PnKigMyyrZNWsYTM1JfvXQ6TX3 3EKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0M/qP7q1WoNhC7OtcFntP9guw97qGMvVqjS1wFwD5+g=; b=mE+ay/uQ4hk5U/dn5yDeebleReoLobat0KYgpiP1k6Uv54bAKaUX9GuOXToYzy9G1v Eq67YUm/gfVpydveS1quSGZuwbJqOt4dyPTuiOG+2ln+sKnvh88uv3iVYjgbs6nWIWMR 1CC3Febe4Mgd4gRewbI5eajhkMPiFuVoD/m2u+ScPTetxHexVLeUGmEnkoqD9El52qkr qY4X+fB99aoxklXP3MsUEmFdgdbiHMkckCtRQOiM2nTRwFuZRkFLJkK+vwHNFUT+eMT6 Q23Mm1O7Jugel8wYe+QSIQL/LWHhM7CQXj3TcxTpBeU1AeEzGSOSgt5m0XnzQmrvUqyb TsQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wsAdRma6; 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 a15si1756884eds.350.2020.09.11.10.25.47; Fri, 11 Sep 2020 10:26: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=@kernel.org header.s=default header.b=wsAdRma6; 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 S1726285AbgIKRZH (ORCPT + 99 others); Fri, 11 Sep 2020 13:25:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbgIKNAK (ORCPT ); Fri, 11 Sep 2020 09:00:10 -0400 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 7A46722260; Fri, 11 Sep 2020 12:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828989; bh=JmnsJnkpVh3JbHgKr0d5rfFBpXO5QKOnk0jagEXIPDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsAdRma6TF6o/sZZprAWhP6/TF5bGDLE2nxU3+5kH+2ASryNorTDBuJtOYvXmJX2Z XS0r1DLUQlufVlu8xPqoOMjaAMFtPMk0DAJELT4YhaCKuf6NMOiMVFfSrLw5yT75wt sJFCAxLMvbgs+UBaebKXOIjxGrQPLxhlNkfyKFHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasundhara Volam , Michael Chan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 22/71] bnxt_en: Check for zero dir entries in NVRAM. Date: Fri, 11 Sep 2020 14:46:06 +0200 Message-Id: <20200911122506.048311314@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasundhara Volam [ Upstream commit dbbfa96ad920c50d58bcaefa57f5f33ceef9d00e ] If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware command may return zero dir entries. Return error in such case to avoid zero length dma buffer request. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 427d4dbc97354..ac03bba10e4fd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1457,6 +1457,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) if (rc != 0) return rc; + if (!dir_entries || !entry_length) + return -EIO; + /* Insert 2 bytes of directory info (count and size of entries) */ if (len < 2) return -EINVAL; -- 2.25.1