Received: by 10.223.185.116 with SMTP id b49csp5446226wrg; Wed, 7 Mar 2018 11:54:50 -0800 (PST) X-Google-Smtp-Source: AG47ELvJkwXpcmdKmHnWAWIICp17pSHRvz/YreazhPZjWq/nqLLkK6KxrIvl82O2vki7Izwv/YvZ X-Received: by 10.167.129.67 with SMTP id d3mr23720442pfn.108.1520452490454; Wed, 07 Mar 2018 11:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520452490; cv=none; d=google.com; s=arc-20160816; b=e34cbDFUV5A1QuPijkTrJFzHT7GSxesuK0j9jWIofnoeZz+LPyt6XUO1+9vs31R51r sZ1kyie501pvlzcoyewO7tkIpMY3a3v+pCxh3KHrGlF6pQjfFxPix55MrSsuFvVgpZQ6 L+lziaPm4T14ZDAOzKMzWeQQNUWLwi2npSQAkH/Gn3fPM4LehZitiyXU6inN7GUeoxa1 HC7ey7/9xqjHxKPa6Pbyq4agnHbtLZGlCQjWp3E99kbAP2PxTyDp1QdhAzROTWCHLVUy kDrjzdKdUlUaj49IVAQpN+VvrQ1gjrzm1v2SiN3bqK7XBEC6W14QRdPo8HlA8Dp/LWWX XodA== 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=7qYCIGxTGV3obfUCey1+Ub5URZD7jM5bL3LP9a7VGog=; b=igxP4oyZ/pZ1PI5VyGFiS2X58juaKTtpJIaeX5WLCSL2P4Pwnzv3Ju6oy7T6Dhuxx6 sQMP9PikEgqwF0N2JcasyE8opNz71wMZ/JUZilQWbiX5OnnQGJ5ETwu8bZ6BugsFJ5VP pOkAZyX2PpUHRaBmS9F1/sAbAYPHKFNcR8lp07dVML8CAwuaA/0Fframy09BJjdB5XSJ 4uOKRXJ2vEbx3iBKjQLRRAFzUMaRx4bFcs+2t0NeFW4hTEcaWbr6DYBMkK3+yQyeNRkR 25YHor8gkRNxFjBAVoIt74UjGcXT2zEK+WoXigS2JULrzt7aiwAeEm3T7fsxFbll7mt3 FJ7A== 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 b68si14198620pfd.345.2018.03.07.11.54.35; Wed, 07 Mar 2018 11:54:50 -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 S1754907AbeCGTxC (ORCPT + 99 others); Wed, 7 Mar 2018 14:53:02 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45128 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965803AbeCGTrr (ORCPT ); Wed, 7 Mar 2018 14:47:47 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1C47C10F9; Wed, 7 Mar 2018 19:47:46 +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.14 058/110] net/sched: cls_u32: fix cls_u32 on filter replace Date: Wed, 7 Mar 2018 11:38:41 -0800 Message-Id: <20180307191047.042343240@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-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 @@ -927,7 +927,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);