Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2652875imj; Mon, 11 Feb 2019 06:30:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYs7/svCB8rXj9xZXeqwI9vejhGnt1zqBKeUcVPp/QH4Ju8n9KneK+gFeXLCk2cXDAvnoq4 X-Received: by 2002:a63:555b:: with SMTP id f27mr18844180pgm.313.1549895452193; Mon, 11 Feb 2019 06:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895452; cv=none; d=google.com; s=arc-20160816; b=yvcY9F6CjYE+7/Z7MvzFAoBBESQvphTxbMxRCodcE2jwNAqKGiSkdgcRQEp3f/bghz 3qoE/LJTvfX7n5SMJ6IkVlCqPzncH3CX2GoypqH6/rIA/cEQihkzb0rvOiumtlW5TM9i W5XPkQEkYEdKDLhS6m0gic5u3KA+I7B/vlx+abOtg/Wjh5blhlPeTswis6pB8Yan9NME 69bVaBiQLFlqzS8Fwq3NfuSJL35c0KDKOw1QyZwTLQSvULl63eH2VLtrxXRW2kO1y/0j L/MEe/9cTBIoPY7yoE+8XjDu00CdT2BvyGTvAjyWQ6GeaU/ahb2sRxsr01BXv+D100rD 3Qwg== 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=1h8j6mRTg07LyGBGgBmPvdZba3YYZ4fPVdi9txZ1fGE=; b=hOgEl2VvzlUy1xZ7HrM3lcPEE0kF4B04BZwFd5qEr68C7N38d+QK7p70BZM5wIzZrU Z55QNGVOzwTJ60i8weqynV5xUH/7aG8u9AKFUzI2gq52CbKrn9WYE5iuXg9A7TBQ8Rs4 pAKXACmjBNZiDUQrYIabBt/rvW/Wsq7BEaXxqcxaR//wMvKiz0cGRY8Ed7p+Rz9NwMMR kEIEmlGAmliLHdnSgozRNEcd8hoc0z3KqtVrxHStUjI1uoORhU/yDbj4E0SXvG+LdJk8 6PkiPb3sIb0pWkyAOVPqSXHlHc1eRoNOv4AVRAxnigRoBZtQUmj5Hjg3VdAcwKQV59b3 BidA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D8OHMcka; 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 t11si8952028pgv.251.2019.02.11.06.30.36; Mon, 11 Feb 2019 06:30:52 -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=D8OHMcka; 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 S1729036AbfBKO2X (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:34134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729819AbfBKO2O (ORCPT ); Mon, 11 Feb 2019 09:28:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 D179220838; Mon, 11 Feb 2019 14:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895294; bh=7iOROcqyaUcX2UXjDcWYzmbQqsO2UMxdIiaDQlsG+4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8OHMckay90O4CCJgnx8jW4xtLwFh+evsgIA80eZVxBY8gIqyqSHunzlVeDG+k55s nR8szRo+O63L9tPd4G0ev0aTKNmTssJPTkc3hho9DbeyGj7bIlD7c6p3hDRE+ZqyDR OlkT2HKCDMvm5AycC8oZl0OcZ4NrNz9MFi9DJCrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nir Dotan , Jiri Pirko , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 158/352] mlxsw: spectrum_acl: Limit priority value Date: Mon, 11 Feb 2019 15:16:25 +0100 Message-Id: <20190211141856.882877007@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d7263ab35be25505ab57ebecd93cbc5dba8be717 ] In Spectrum-2, higher priority value wins and priority valid values are in the range of {1,cap_kvd_size-1}. mlxsw_sp_acl_tcam_priority_get converts from lower-bound priorities alike tc flower to Spectrum-2 HW range. Up until now tc flower did not provide priority 0 or reached the maximal value, however multicast routing does provide priority 0. Therefore, Change mlxsw_sp_acl_tcam_priority_get to verify priority is in the correct range. Make sure priority is never set to zero and never exceeds the maximal allowed value. Signed-off-by: Nir Dotan Reviewed-by: Jiri Pirko Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c index e171513bb32a..30931a2c025b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c @@ -95,8 +95,9 @@ int mlxsw_sp_acl_tcam_priority_get(struct mlxsw_sp *mlxsw_sp, if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, KVD_SIZE)) return -EIO; - max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE); - if (rulei->priority > max_priority) + /* Priority range is 1..cap_kvd_size-1. */ + max_priority = MLXSW_CORE_RES_GET(mlxsw_sp->core, KVD_SIZE) - 1; + if (rulei->priority >= max_priority) return -EINVAL; /* Unlike in TC, in HW, higher number means higher priority. */ -- 2.19.1