Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3487357imu; Sun, 11 Nov 2018 16:12:38 -0800 (PST) X-Google-Smtp-Source: AJdET5e2/PEZEpJEKC5K32uRc6xbcs7FLN+CeucOwkbBBVVzkoHEcaXVxIuMb0DdAZA5A71+QLtz X-Received: by 2002:a63:ed15:: with SMTP id d21mr11476874pgi.305.1541981558271; Sun, 11 Nov 2018 16:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981558; cv=none; d=google.com; s=arc-20160816; b=FSjaApOGJhjqYS1AS1O4T+UnIRS4tH5IikYKqUDLwX7NQpBeN17VP/dx7K5iKWgON+ M+PeA909hwllPgvqgdVgo9l6ve9ZM4WOKQl+m9UKHKDlrTt0cmKPbzfa20RD3Mle8Qj8 Vs+6UdJNl5mVpkcrihc7E3MBzxB/ooU8S8gux8b+G4BrGFGBRY2LSaHrIqIRxtw89YQv OLON/E+6RQ2ISdsDKHca258me+77bcRFUTUJ0JoBUQDOsvUr08Di5Oxpkl1kVe3hM/pW OJMWHbqdQeuwqy/uL8Ymsn7evNu/BskRD3bA/8eCOGxGB9xJjj/3hrJJj0iJmdAhiKcu 7Mbw== 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=rEeIXaX1Uj7e0oNbRbFSu37fYu3lkrb2PsLNeY7ehGA=; b=wPmOQ5roQpMseilQmEz1FOe0QbxHz30PZ9VcQ6GneQMEQzGax/SSg89DGZWNaocsDv F4Nq2tsSiGSUuK/IZbrN6lQBQW32zCfLmm7KfNihoC6ZIhDprBvs3iKskD3QDRqG1miD 91rMbjlBXfV3I2G6BtyGEcc/7/SKMupFEj00eXbf/+vu2K5/JkyD8PvBEo5R0swJ7O9i czod3/PC++1dKDwonNVwSweviswpxpPaMifOLooIcUOBFZum1v5iKACDEreWofsaAm/w o6fnYlSNqmFBbItNyXvST3kz3OqglHMbYJHCGmioQxzAbEs+IJ4KRRiWXw15LBgjFXB0 HxSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wXGn36fd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si15588637pgl.268.2018.11.11.16.12.23; Sun, 11 Nov 2018 16:12:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wXGn36fd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730876AbeKLKCb (ORCPT + 99 others); Mon, 12 Nov 2018 05:02:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:59948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730602AbeKLIRU (ORCPT ); Mon, 12 Nov 2018 03:17:20 -0500 Received: from localhost (unknown [206.108.79.134]) (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 38CD221731; Sun, 11 Nov 2018 22:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975245; bh=O/6OSDq2hPNWDbAMujHW7PrQ15PFoelAHOsQnJzyfYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXGn36fd3hxQAOG/5XIXZAypm1SvUv5JBWxKiH6+9exJWwiRtK3EenIJ6lBDGGDbO /bajAt0pMrz3KvazsAczhedC7h1EUOBW3RcRAWASaPeox0olgOZvtNrS2pAvmL/HN7 /CIyus1pmN2jAcFUA/egM1MHfpyLdNI/h6iHZFYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Peng Li , Salil Mehta , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 096/361] net: hns3: Fix ets validate issue Date: Sun, 11 Nov 2018 14:17:23 -0800 Message-Id: <20181111221633.201598990@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jian Shen [ Upstream commit adefc0a2ff465f4ac4a88450fe69d336c8b074c5 ] There is a defect in hclge_ets_validate(). If each member of tc_tsa is not IEEE_8021QAZ_TSA_ETS, the variable total_ets_bw won't be updated. In this case, the check for value of total_ets_bw will fail. This patch fixes it by checking total_ets_bw only after it has been updated. Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -73,6 +73,7 @@ static int hclge_ieee_getets(struct hnae static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, u8 *tc, bool *changed) { + bool has_ets_tc = false; u32 total_ets_bw = 0; u8 max_tc = 0; u8 i; @@ -100,13 +101,14 @@ static int hclge_ets_validate(struct hcl *changed = true; total_ets_bw += ets->tc_tx_bw[i]; - break; + has_ets_tc = true; + break; default: return -EINVAL; } } - if (total_ets_bw != BW_PERCENT) + if (has_ets_tc && total_ets_bw != BW_PERCENT) return -EINVAL; *tc = max_tc + 1;