Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2657376pxj; Mon, 31 May 2021 07:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlA5oZd1Hmnuh85Ykb3ehvzECxPsnfSovy569X53gNsfHEXxivmcgwM4AXRjzPs26oqVz/ X-Received: by 2002:a6b:d918:: with SMTP id r24mr17302416ioc.25.1622471639440; Mon, 31 May 2021 07:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471639; cv=none; d=google.com; s=arc-20160816; b=0ihnw8LYondjVAL1B2xhvyky2D667zjHFcgXPqdlF/lyohQ2TsBv1DF8kWgHIIpP7p XIK1j864SL0ZBNKmETOImWQfu4P6/2dGNabgc4xYLHiti48auD+EU4v2s+wSRH8jkuu8 YWT7kwIYnxauzsBv0s3eU7UyenTSTuxgAQhITINsxnwKuAdVvqwVEalMoWilYqJd1n2Z fm/vvoRg/ov8zv8Vqe2DCLEfnubEZiSyrpDDH1XFxIJJFh7NMEwbW7dnJ2xD09Lqk8+L OCvdHshviFEz3956Th7sqvaFIZxO4dbnXLda2jQ6kFwwTCqf246wHT6SUMdY0b4GZASz FcEg== 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=pEWU8wtYFR6o3M8uKsdvG9ovf0GNZ1sS2uOHs3nWvYI=; b=jacB+uuZTWfdpY+dZX+LqDMJvzETnMHfHXxxUlUQkQoIvJ/x+FG9f24tD2nQcxRhqh ljfnsdo5bsOATwJY4XAdSPR2IxiamRxkGQco89FAIjFzugm4BMOpXaoQuhAvm4B3T1wN sRFbrespCGDqC02V6n3yVwG1lSz/+PUAyUHd1nJ4ilxDntVPRmTBKXRCPfGifU0x6Ye3 J4xxTWX2QjpBSlzvOPHOR+/nfL3NONIIXjCtAw0zHzeQftw4lDsGmApSByG/52e9/7Jg eaO33b/fRW1GcKF3zjR0aVjs4xQ1c7mEth4N/8U+M0sKJ/EJKQlKoHIuSZc0X4m1cF6I 7oiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QIjswZTp; 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 z8si6226624jao.3.2021.05.31.07.33.46; Mon, 31 May 2021 07:33:59 -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=QIjswZTp; 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 S230412AbhEaOev (ORCPT + 99 others); Mon, 31 May 2021 10:34:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:59926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231985AbhEaNzX (ORCPT ); Mon, 31 May 2021 09:55:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8B8161922; Mon, 31 May 2021 13:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468054; bh=LsoKiz0LgUvPdMrttrhSxXoUXHbqGH7qU/UCtULSC+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QIjswZTpKJNp13pwS0f6Rjlhy5SGFktXYTmHTyyBSzHuIlHoiBlkyMFUaZk0FRzbu I0Dgv/FXen8cMMIFzHPi4EhiIHYS+xDICRscS80jGTMvDX+UcWAi2W0+9M+wEtXUg9 paHqLl6zw6HuYaJ4vh+WEw7+ES3LiTAh7EEiTlrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Maxim Mikityanskiy , Saeed Mahameed Subject: [PATCH 5.10 099/252] net/mlx5e: Fix error path of updating netdev queues Date: Mon, 31 May 2021 15:12:44 +0200 Message-Id: <20210531130701.350912511@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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: Aya Levin commit 5e7923acbd86d0ff29269688d8a9c47ad091dd46 upstream. Avoid division by zero in the error flow. In the driver TC number can be either 1 or 8. When TC count is set to 1, driver zero netdev->num_tc. Hence, need to convert it back from 0 to 1 in the error flow. Fixes: fa3748775b92 ("net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues") Signed-off-by: Aya Levin Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2920,7 +2920,7 @@ static int mlx5e_update_netdev_queues(st int err; old_num_txqs = netdev->real_num_tx_queues; - old_ntc = netdev->num_tc; + old_ntc = netdev->num_tc ? : 1; nch = priv->channels.params.num_channels; ntc = priv->channels.params.num_tc;