Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1614575pxb; Mon, 11 Oct 2021 09:31:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs8sA1odpB0FFSpajlPP1aIGYLuyzDXKh8mHPcGhaZvPXjNNHbgcQ5Sus0zMjyzbAPvrht X-Received: by 2002:a05:6a00:887:b0:44b:dee9:b7b1 with SMTP id q7-20020a056a00088700b0044bdee9b7b1mr27040858pfj.84.1633969880024; Mon, 11 Oct 2021 09:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969880; cv=none; d=google.com; s=arc-20160816; b=uBvkkbXv4k7XnMSU64WJDMqT6ycSOl/pkWdOIFIGdsR4m2syHIWjVN/HsL66wGIHhv CUbyWcAIFHqgN/YAOEys/EK+fsUf1+vWBJsWBYhBDIhIuYuwVogZbQwKpu8OX9ME7DP9 /ePLjuT4Ogq1XqnPQECsPfpwWV6vvgeXDfwy7tAl0NYINGRbe/BPTsoKxzZuMPCCC8i4 GNYxvg8bXn3GKvbnLmMv+UcDpsdr1Oi7vNGpmCv2G+e1ejfa7afabJeLIwTHGPMqhs/y tSBl7VI31hLnjP3GdcxS6A51LOcvVmBaf+HJ8o+K5sT3eqH0/rLW2iggUk8eZ8Uu6OD8 FGmw== 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=XrT1aEChquW+rrSNsH0DHc7+I0/IABw6j/WhS04MZ6c=; b=T/CRl9tr+L1C3Rk4jvIFeMXwRoBP3u+rZPeTKSXFmtwklJVU80aN7DT6frBc/fR5CI y0zpuMi4IfSlvM0UQTcKtMBCttFjpU41ps4hG4jytAKCPlo5RC6ehtQb40cYhnHkECZz b7eSD02uxEUt7OvkMFAF2nWteOLcgDF3qXhD9gfQ/uzNCcTwUmjjzqQzZ6VhOI4oXshf OmiNU+wysCI/ZUygPWojmSYW7ujHvPS0A3j64g53jWG5Rn8/k0662vKKFsYdyIf1Rapa V9V5KzBS8Gzfc6GuhcOicJJQM5r1CAk1khjrhlc7zWBVCrm0jJNXO0bRKy9xbOdPsGqW +Hlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AuZl3Fmt; 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 q126si11148830pgq.371.2021.10.11.09.31.07; Mon, 11 Oct 2021 09:31:20 -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=AuZl3Fmt; 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 S237886AbhJKN7b (ORCPT + 99 others); Mon, 11 Oct 2021 09:59:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:49408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237197AbhJKN5m (ORCPT ); Mon, 11 Oct 2021 09:57:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E3A2611AD; Mon, 11 Oct 2021 13:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633960461; bh=kg/z6k8fO919zXYFH8oyU9N0W4WjNu9nmc2Ci3aNeZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AuZl3FmtB0lCa1MCdZw3JHgEXoP9lLmPGh0NvSZop4SDaiHtiILWCy4G3XuVLhXQ1 zhVBDsP3a4bbzC43CRgvwU7wrPzNzBVTp/joMmCVVjpk2Qn5vmRX13P7YWDaw8fyXa m/IP2IiKY0zvTYHdOmm9LzkhoqH0Zq2xSUbSQSts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Assmann , Jiri Benc , Jesse Brandeburg , Dave Switzer , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 64/83] i40e: fix endless loop under rtnl Date: Mon, 11 Oct 2021 15:46:24 +0200 Message-Id: <20211011134510.593929955@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011134508.362906295@linuxfoundation.org> References: <20211011134508.362906295@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: Jiri Benc [ Upstream commit 857b6c6f665cca9828396d9743faf37fd09e9ac3 ] The loop in i40e_get_capabilities can never end. The problem is that although i40e_aq_discover_capabilities returns with an error if there's a firmware problem, the returned error is not checked. There is a check for pf->hw.aq.asq_last_status but that value is set to I40E_AQ_RC_OK on most firmware problems. When i40e_aq_discover_capabilities encounters a firmware problem, it will encounter the same problem on its next invocation. As the result, the loop becomes endless. We hit this with I40E_ERR_ADMIN_QUEUE_TIMEOUT but looking at the code, it can happen with a range of other firmware errors. I don't know what the correct behavior should be: whether the firmware should be retried a few times, or whether pf->hw.aq.asq_last_status should be always set to the encountered firmware error (but then it would be pointless and can be just replaced by the i40e_aq_discover_capabilities return value). However, the current behavior with an endless loop under the rtnl mutex(!) is unacceptable and Intel has not submitted a fix, although we explained the bug to them 7 months ago. This may not be the best possible fix but it's better than hanging the whole system on a firmware bug. Fixes: 56a62fc86895 ("i40e: init code and hardware support") Tested-by: Stefan Assmann Signed-off-by: Jiri Benc Reviewed-by: Jesse Brandeburg Tested-by: Dave Switzer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index bc648ce0743c..0a1eea0846e6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -9662,7 +9662,7 @@ static int i40e_get_capabilities(struct i40e_pf *pf, if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { /* retry with a larger buffer */ buf_len = data_size; - } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) { + } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { dev_info(&pf->pdev->dev, "capability discovery failed, err %s aq_err %s\n", i40e_stat_str(&pf->hw, err), -- 2.33.0