Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9983811ybi; Wed, 24 Jul 2019 13:32:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4BhTq6BkzDrwiYssq9pZBy4EJDFnq565qvT7WPFT0UBPzB4QBfiqz6GzoZfinXswGB3fa X-Received: by 2002:a17:90a:8c18:: with SMTP id a24mr86809719pjo.111.1564000330376; Wed, 24 Jul 2019 13:32:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000330; cv=none; d=google.com; s=arc-20160816; b=vuInhhPu33YjI3a0hk3YZyiNhTTQEHQnViyup2fhVJ271yNdEoEm+RNMYgRu/atOmc 9Z5l7HUCTI3CoRFD9kjX0iz7HKzmtUPkzM3a6dw4iNEJHaD9JrzKYSOPSVcFs2Y4c8iu i5ycq5qFLAvvknB6aTbKNptrNVhvOkPsPqTVUyvM7QKC1lpH9KLPhXdxD/dSQ/iI59J1 MRcqzS8RCXbpbZcQ4JmcXfi3rdhgiaFGBDIpMpN7cz1yeyN7FM8pOAcxx7PZHHVJKA7b CkFHHJG2l2VEXCBc/tr4DHPLS66m/pzKM6ah+XK9Z3dkaBrwSHKQsUVWNDkvUNNyxLC2 PjqQ== 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=3iBXCqqcYVDPh+wVJH4Q9mtRrvMzmJKqqCxn03MW/LY=; b=eEOAS+B3IRmWt0EYS9MlNM7cfVS7+YhFJkg7gMLVoFKU56K9jtWuX9scc2+OadmAqc dUSJ6h9ln59KJKluBPOlBigy9XzOvWPci4b8Km04vJw3WVAA6pR2NlVcGs2pxr0qHUjO W3h8uXY27Q2TmkY1lNPnQAmcl6Qktz9JEwxcFOy/diwY499glJM2EA+oDwZpLuGzV4gR Tv0TSXNqHFjPsYj38MgYv44nNNm/dkO5zZX8fkFIAmQ14RgD2bBZfS/otJBDTCfrREqG w/LrF4RdEmZhfC1ajDLYuEJPJA1CN2dN6pO1IMpI7ZthwoafkVe3r4NLZ07DlupzhcL0 VoJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y/f6w8Ov"; 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 m5si13520754plt.167.2019.07.24.13.31.55; Wed, 24 Jul 2019 13:32:10 -0700 (PDT) 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="Y/f6w8Ov"; 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 S2388623AbfGXTcR (ORCPT + 99 others); Wed, 24 Jul 2019 15:32:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:53522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388030AbfGXTcP (ORCPT ); Wed, 24 Jul 2019 15:32:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 E66AB2238C; Wed, 24 Jul 2019 19:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996734; bh=OMIEmC5y38l87lwjmF+MWWlsfb57JJMC0HeRUrSKT10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/f6w8Ovk3Lk7WtDXYCwVfrcKS2V5K1hxQAdtSNWBURU41VKTJgQHY7bllAo4o+N3 ZMVc+vfFXdLOSJILFsEG9D2Dnqy7o8ApZ6xik0e3yB+XnPTOaDQ6IGYbVsUQMKiqOc 0Z9oXJiRE72XoBZLXyULmzH7bWVkfrom5ymFGjxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Winkowski , Maxime Chevallier , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 197/413] net: mvpp2: prs: Dont override the sign bit in SRAM parser shift Date: Wed, 24 Jul 2019 21:18:08 +0200 Message-Id: <20190724191748.692416049@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 8ec3ede559956f8ad58db7b57d25ac724bab69e9 ] The Header Parser allows identifying various fields in the packet headers, used for various kind of filtering and classification steps. This is a re-entrant process, where the offset in the packet header depends on the previous lookup results. This offset is represented in the SRAM results of the TCAM, as a shift to be operated. This shift can be negative in some cases, such as in IPv6 parsing. This commit prevents overriding the sign bit when setting the shift value, which could cause instabilities when parsing IPv6 flows. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Suggested-by: Alan Winkowski Signed-off-by: Maxime Chevallier Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c index ae2240074d8e..5692c6087bbb 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c @@ -312,7 +312,8 @@ static void mvpp2_prs_sram_shift_set(struct mvpp2_prs_entry *pe, int shift, } /* Set value */ - pe->sram[MVPP2_BIT_TO_WORD(MVPP2_PRS_SRAM_SHIFT_OFFS)] = shift & MVPP2_PRS_SRAM_SHIFT_MASK; + pe->sram[MVPP2_BIT_TO_WORD(MVPP2_PRS_SRAM_SHIFT_OFFS)] |= + shift & MVPP2_PRS_SRAM_SHIFT_MASK; /* Reset and set operation */ mvpp2_prs_sram_bits_clear(pe, MVPP2_PRS_SRAM_OP_SEL_SHIFT_OFFS, -- 2.20.1