Received: by 10.223.185.116 with SMTP id b49csp5489009wrg; Wed, 7 Mar 2018 12:39:43 -0800 (PST) X-Google-Smtp-Source: AG47ELtPDFVDzOjlX2UaJL7vvry0/o4U6FOfk9gLqMReuNtxGiGhBXsyI1bPrd2aSI39OwM+GgIN X-Received: by 2002:a17:902:3383:: with SMTP id b3-v6mr22031989plc.224.1520455183322; Wed, 07 Mar 2018 12:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520455183; cv=none; d=google.com; s=arc-20160816; b=rjlkk6eQ3dVNrFcTDJp3vaxzA3gEXeA2sYWeNzVZ6Dt4Q8p9h1skaH6X3Zh82TKhbG tKKHqIbVV2vmNdcSOGiPqH/2G0nYr+QGVjPs/3GXnKOfP1Hp/+fHZcUDw9CZZgU6vqGN 61gvDz4bz5aeLG16qa46fbwitZ2MxZs9wMXfUT0BGFoANyraxMksgg5wFs0re7Q2ZPVP SxbDUXbGZIFeYUcjn0MPzmAfWuVZSuGbQednnkceEe3Nhr/bpBHuNzpNUdVei9B1IxRP kKdAmqiygxH8uPaFzqfvDOyx73pLEs0EUwd7Vfl0oxICQTVf4V2DQ7WgFAno9OqKbm93 YqDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1YzYHNotYC+sPQrEJs+4JJvRkKgN+QHL90fy7Cwrzbo=; b=Kpn+k3k11GY5MNpO6elrU+9ryMwDTQHU/j9FQLkvk9aXxR0MrO24KhyzLfjUPNBp9U ReFa6erFjThCGtVlrMAEi1ChqmrURnakoFxYKx5vogB8yXUFdQWULyYfK9quPDDWFmLm f22im62mvpppMyEKcIi5ngH//lsIBNuDafKThVrmRpSb4/4GBJfyyQtXgQkrs3t7xoWA s9vhA+tb8jKaCIYEuKu8gK45/kL4SQ7OOSdn3etR0NPff3kFdy/x0VW8F/qjIAJLAi8s 8VB3OIpTXoOC7LNMKNWPEZLVUUefuHgTQD87Wx9iqKtPkfoZUtg0Vw+z95OAUR7lhiyD Qtdg== ARC-Authentication-Results: i=1; mx.google.com; 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 u1si11782754pgp.498.2018.03.07.12.39.28; Wed, 07 Mar 2018 12:39:43 -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; 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 S934857AbeCGTlv (ORCPT + 99 others); Wed, 7 Mar 2018 14:41:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41232 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934671AbeCGTlt (ORCPT ); Wed, 7 Mar 2018 14:41:49 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E0A3BFB7; Wed, 7 Mar 2018 19:41:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Vecera , "David S. Miller" Subject: [PATCH 4.15 063/122] net/sched: cls_u32: fix cls_u32 on filter replace Date: Wed, 7 Mar 2018 11:37:55 -0800 Message-Id: <20180307191738.432422321@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ivan Vecera [ Upstream commit eb53f7af6f15285e2f6ada97285395343ce9f433 ] The following sequence is currently broken: # tc qdisc add dev foo ingress # tc filter replace dev foo protocol all ingress \ u32 match u8 0 0 action mirred egress mirror dev bar1 # tc filter replace dev foo protocol all ingress \ handle 800::800 pref 49152 \ u32 match u8 0 0 action mirred egress mirror dev bar2 Error: cls_u32: Key node flags do not match passed flags. We have an error talking to the kernel, -1 The error comes from u32_change() when comparing new and existing flags. The existing ones always contains one of TCA_CLS_FLAGS_{,NOT}_IN_HW flag depending on offloading state. These flags cannot be passed from userspace so the condition (n->flags != flags) in u32_change() always fails. Fix the condition so the flags TCA_CLS_FLAGS_NOT_IN_HW and TCA_CLS_FLAGS_IN_HW are not taken into account. Fixes: 24d3dc6d27ea ("net/sched: cls_u32: Reflect HW offload status") Signed-off-by: Ivan Vecera Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/cls_u32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -928,7 +928,8 @@ static int u32_change(struct net *net, s if (TC_U32_KEY(n->handle) == 0) return -EINVAL; - if (n->flags != flags) + if ((n->flags ^ flags) & + ~(TCA_CLS_FLAGS_IN_HW | TCA_CLS_FLAGS_NOT_IN_HW)) return -EINVAL; new = u32_init_knode(tp, n);