Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4664233pxb; Thu, 14 Oct 2021 09:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNJkuZaoikxYXhPxpjDBvg0Q9EVoQ3hp3oS5SxgyjoDMgv+J2uZzV0XptXgVcYTbE+Mwjo X-Received: by 2002:a62:1553:0:b0:44c:67cf:e669 with SMTP id 80-20020a621553000000b0044c67cfe669mr6324233pfv.55.1634229089991; Thu, 14 Oct 2021 09:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634229089; cv=none; d=google.com; s=arc-20160816; b=HkRjds3oXYEkBd53L5rE848XjpTIfkJt5m+UdUwBn2NAxRGDV6GRGFpiwqy2cIYopN zgM/P0oFF3tdjIaLdjU4CVtD107zu8kgFY0MHh2LDEo5Z5EaNmBN9ndu1gZsEUSyQ6PP NvyuqWIh/zylfD4tfwTH+yOgiQwhdqjyCFe24pyJJWjq9ZzzfqNc3Ua7u6QXCVLS37NF UrTzCWwHbbA6idHHWHL37iMRwaL+7flpwGLrNnlZzyfgDzSsI+dyGLbeQIH3rQJXfckL GbO6MHrMrNdcuwVmNtdNo7X5AKLBhrQcvQFtRcSjVScMNVtqH1rbhmpIuvg2daRiNU39 IBxw== 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=pXef2+Dbuv5SdhQQamL4G4yv8B5438L85Qp4FXB+868=; b=TvOLYgnhf/8XKmnnspIKO6VGpEiW6SRuxY88dA2KSLk7i2VhjEhHY9u97opfYcTYbA sI8q76u+lhEQft8yHWgppy+KwCtNtAp5kZVaK0xGQI6GD15l+KGqybqkShmIvEyvAqFb dd15PML3cb6A5QSnunqh6odrdHpM84XxFUI9myS5n4XAA+plz8kSDiKj2QmtMBvM/weh rkIl4BYc80xGy6gOAgKNWsCWxhJQYzYiQZgr558WewhKC+aZwGRjLT3p+hFgh7a58GGZ 6qH2FNM/q2E9OaqG+/TVXcRQNHJqCCnAYYmVt85vT+EOm8nSlts/MvCVgZ6QuMG11OWP fRXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rKZgZRsU; 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 m23si3889195pgv.246.2021.10.14.09.31.13; Thu, 14 Oct 2021 09:31:29 -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=rKZgZRsU; 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 S232194AbhJNO5v (ORCPT + 99 others); Thu, 14 Oct 2021 10:57:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:42606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbhJNO5e (ORCPT ); Thu, 14 Oct 2021 10:57:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85B7360F4A; Thu, 14 Oct 2021 14:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634223330; bh=VF5lKsLQQsITUR//vef+l4lwrc7TTkYf8hXoH096Z8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKZgZRsUJse8u1vMZrmuTRIUi3XIPdgUSao4mqqlSYUogkrBJT/BQVdmvUbsR6WfY e4RRkzlpDeocy0iwhGDgTSW8DkZb9e6KyUj0Us4gSQQvu1rw2cGHd0iQZEA3cV7XkE eZzNJo2oTCdacI81O2WAVMrqPCm8tsv55pO2fPuM= 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 4.4 10/18] i40e: fix endless loop under rtnl Date: Thu, 14 Oct 2021 16:53:42 +0200 Message-Id: <20211014145206.653594767@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014145206.330102860@linuxfoundation.org> References: <20211014145206.330102860@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 d6d4faa5c542..2137c4e7289e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -6574,7 +6574,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