Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10534067ybi; Thu, 25 Jul 2019 01:03:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdhaC/TNHo9UzAzyvihNeb6bbSu9WcXOSW3EerkZiE/2SUXpZAGvKgwKJPFgYBzLOjbH7y X-Received: by 2002:a63:d415:: with SMTP id a21mr82871634pgh.229.1564041808980; Thu, 25 Jul 2019 01:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564041808; cv=none; d=google.com; s=arc-20160816; b=v2gyTj8Jrv8BmtYy89/mfuP4SpSPaKeTNzLOXsVHUTD5o68QI21zepL/CobqcnIR5A G1lZPVweSET0nFvqjIt5ncbOw9Jtm3w8bGMKxC08zhIsQKdcBQoaILQCOzhIhpbIXuRB nG6/xMDTRf2h/gqLoxJJ0fC2w/peWyP7+Ytr+Gz3WSTPF/kpB4WmQWzOwbQQVwH7KjYe WYvGS8SjNN5BGfT1OO6VXn9Ylmz/TeVQKdF+ZahH+jOk5nEov8Uae0IpuKFDNt5lqc+p gGgmsAuefiliaVWIhjQAv/bIAxkh0C/F/2lv8/2Dm0+zU/VRtxaAWe0U3RJvpTZtdb1z 7+ng== 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=A07+ytp8f1Mbw8mzf/uAX5XQQYHTyEmn7nUIRbTP41Ak07IJRznD/00wZPZMGuYLzF 9CVoyBtt2N9MkcrLQnIrwxvWhxQ/a+OfKftjhnhriTpfw1AlFp0vBRwDjeyoWqwXh6+U qGY5qApeuo1qzg53fG6FBuH6EEerMxxQ5cNxGnTh8Cu1kQehOyxWuo8jNK6mVB6L7q0k 3fyCEyQ6C459+bGbMZJN6msGopYLSZtZz49ZNDPFbs2+35kwy8vLQFxLfdCmtMOWopX0 vWI8hnBtL/SVd4DTQTsTf1+xkLFqNkkvgkHwBzF7LoOAmdKw9/9e1e3DwPS+gAXkhYKR IfCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jfaoh+1o; 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 u2si16218858pgm.242.2019.07.25.01.03.03; Thu, 25 Jul 2019 01:03:28 -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=jfaoh+1o; 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 S2404318AbfGXUQZ (ORCPT + 99 others); Wed, 24 Jul 2019 16:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388222AbfGXTvX (ORCPT ); Wed, 24 Jul 2019 15:51:23 -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 01B5220578; Wed, 24 Jul 2019 19:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997882; bh=OMIEmC5y38l87lwjmF+MWWlsfb57JJMC0HeRUrSKT10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfaoh+1om2ko8e1wtMtwyKKdPAwI1hxN8mMuGa8hrCKgZ4+EMiyLGC/GskYx4ZTH1 JP3e/opGaCvukB5EGjyt3lT7Pkul3g4y2Zw/TacBllq1Io3Hib2ifCRrKmQeXXZ49E PFPz+4KF97MFUT0JasODyvdjcI+gUl0tJaTCEeWw= 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.1 177/371] net: mvpp2: prs: Dont override the sign bit in SRAM parser shift Date: Wed, 24 Jul 2019 21:18:49 +0200 Message-Id: <20190724191738.532830430@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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