Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4774EC433EF for ; Mon, 10 Jan 2022 07:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240108AbiAJHge (ORCPT ); Mon, 10 Jan 2022 02:36:34 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58092 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240070AbiAJH2Y (ORCPT ); Mon, 10 Jan 2022 02:28:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C407BB81211; Mon, 10 Jan 2022 07:28:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED8C5C36AE9; Mon, 10 Jan 2022 07:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1641799701; bh=bOAqiS43WsOTF10mso47tS6oxlOJDrSUMlDHatGCKEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1Mzf+Yn1ofgXpKRld4k1kwRerHjEBvTzA1keUOkkfCt3jPbnpI3D5afVqj+mU9U8 IyoLCrx3PU7lXA9Wig+m/g/1QmI8MLSck20U8SvAOvIjsFM7+apYp1IKwX2A7kzHak BVHnOCGtSFAcTOCot/wV7RG8IfCJUz92N/2YhJ20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashwin Vijayavel , Karen Sornek , Konrad Jankowski , Tony Nguyen Subject: [PATCH 5.4 07/34] iavf: Fix limit of total number of queues to active queues of VF Date: Mon, 10 Jan 2022 08:23:02 +0100 Message-Id: <20220110071815.897462914@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110071815.647309738@linuxfoundation.org> References: <20220110071815.647309738@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: Karen Sornek commit b712941c8085e638bb92456e866ed3de4404e3d5 upstream. In the absence of this validation, if the user requests to configure queues more than the enabled queues, it results in sending the requested number of queues to the kernel stack (due to the asynchronous nature of VF response), in which case the stack might pick a queue to transmit that is not enabled and result in Tx hang. Fix this bug by limiting the total number of queues allocated for VF to active queues of VF. Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Ashwin Vijayavel Signed-off-by: Karen Sornek Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/iavf/iavf_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2604,8 +2604,11 @@ static int iavf_validate_ch_config(struc total_max_rate += tx_rate; num_qps += mqprio_qopt->qopt.count[i]; } - if (num_qps > IAVF_MAX_REQ_QUEUES) + if (num_qps > adapter->num_active_queues) { + dev_err(&adapter->pdev->dev, + "Cannot support requested number of queues\n"); return -EINVAL; + } ret = iavf_validate_tx_bandwidth(adapter, total_max_rate); return ret;