Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17926803ybl; Thu, 2 Jan 2020 14:58:56 -0800 (PST) X-Google-Smtp-Source: APXvYqw25FeTYUayCi3kfBXoS7JXWStJhrzEmkhMcl5OEZFP8TUop5LbVwBLTymwg77+BYDqPadh X-Received: by 2002:a05:6830:1501:: with SMTP id k1mr82102018otp.125.1578005936269; Thu, 02 Jan 2020 14:58:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005936; cv=none; d=google.com; s=arc-20160816; b=tWJ5ykCgV2YHyH3SS/pnjqVrwnRfW5mcyz3aorwUQDz2+y1EgCNrR/NaXSQvNQI97U WpVv0RQlCQ27MHIqbM2uWyEA2I6Y/gBAIRuTBbptGTfcDYhpiEPNUmGYRygX68Hw/bC0 4LBfm31wFlYFMfAd2rBRkjfIqxQuyjYugELg1eMrqZgl899RiHY2YDt2xd+0D+O4uxzl KIAvcYZqpwvQFA51Y+YJMl2rVpviainfnVnjDZh0RId7kB2B55UMLZiEJjKEhN5N/rB/ sKvT8xRz6PAUvYeuBU7aCkMiqCV59RZcjK97n7W7ZxwuPkiiZ30CG38t795/6JnLqex4 85eQ== 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=ExCnYuZljp/Yf9mUAP2LfA6B+TLNk/AuaHuQfYr+YN0=; b=I+m52baI2U4YXcgwT5bQf+w3obEaJqijRnvue4fzPsvOcdQAXtsi1pz2GH4nOnDGGX PLHfgz5Ha9kHLsLLQBbVU4DlMy6Ev9Uq/AgZe1wZMdXdWgacMCLVmlw55WCL4uMjyFHn qIhv+r5kRLaqjmFf8GVOQ1GSStcEyRLGhQeWpEdw1ZU/FrNdk6L+bHiSRUCvPyRcwLov 07OGxPjd26tukfwQXNM1ZoGGjpRcOMcqv8920ilceo5AGCxm5oc1vt/a3G40GLvljCKn 6c+wLSmhyQcnrqsi+sSUN+qfBKHMf6ahoOykynkD7JwJK8X01vOk9qNZr1X1XEc0IdSx tB+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VydE8dll; 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 w202si18936723oiw.194.2020.01.02.14.58.44; Thu, 02 Jan 2020 14:58:56 -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=VydE8dll; 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 S1727988AbgABW4q (ORCPT + 99 others); Thu, 2 Jan 2020 17:56:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:60764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728365AbgABWRv (ORCPT ); Thu, 2 Jan 2020 17:17:51 -0500 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 E171322314; Thu, 2 Jan 2020 22:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003471; bh=p3mN6/BO5IBOxZGR65xlpM+u9W8WRUgft2jFWJ41u7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VydE8dllimaOs/kTCgA/r/Dh+ot/FeY5qcLaRTP9et+wgd+xLNk8Erw9xAGGgdgIb PhPHAOCekGarDcHsVoQuo3a5zmJL94wp1GDPmTOV+PjForI2shsEz3FlJkkJBXxVED FOZF/VO/zbpezqFcfLjqDP/e7WgoXZcXqLN92BeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 5.4 148/191] net: dsa: bcm_sf2: Fix IP fragment location and behavior Date: Thu, 2 Jan 2020 23:07:10 +0100 Message-Id: <20200102215845.368774557@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@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 From: Florian Fainelli [ Upstream commit 7c3125f0a6ebc17846c5908ad7d6056d66c1c426 ] The IP fragment is specified through user-defined field as the first bit of the first user-defined word. We were previously trying to extract it from the user-defined mask which could not possibly work. The ip_frag is also supposed to be a boolean, if we do not cast it as such, we risk overwriting the next fields in CFP_DATA(6) which would render the rule inoperative. Fixes: 7318166cacad ("net: dsa: bcm_sf2: Add support for ethtool::rxnfc") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/bcm_sf2_cfp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -358,7 +358,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(str return -EINVAL; } - ip_frag = be32_to_cpu(fs->m_ext.data[0]); + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); /* Locate the first rule available */ if (fs->location == RX_CLS_LOC_ANY) @@ -569,7 +569,7 @@ static int bcm_sf2_cfp_rule_cmp(struct b if (rule->fs.flow_type != fs->flow_type || rule->fs.ring_cookie != fs->ring_cookie || - rule->fs.m_ext.data[0] != fs->m_ext.data[0]) + rule->fs.h_ext.data[0] != fs->h_ext.data[0]) continue; switch (fs->flow_type & ~FLOW_EXT) { @@ -621,7 +621,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(str return -EINVAL; } - ip_frag = be32_to_cpu(fs->m_ext.data[0]); + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); layout = &udf_tcpip6_layout; slice_num = bcm_sf2_get_slice_number(layout, 0);