Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2255558ybg; Sun, 27 Oct 2019 14:30:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqywSPilTYam3i8HoD8mxEoPcvbmTHPA5Rcr35H5ugCxiVr/uzO+GSEdwC4ATz5Fw5ZRExuC X-Received: by 2002:a50:8871:: with SMTP id c46mr16297983edc.24.1572211846514; Sun, 27 Oct 2019 14:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572211846; cv=none; d=google.com; s=arc-20160816; b=xYwD+l9oyIswThYmpPPKFfqM1Wb4knTTAC21m0jYbPceY7qo3RA58BSrHIBc5Ua52h 86lgPvfE0uOHcweEjyEiX+4smXBgUTR5rfDBmmnyAk+hIbV8bjcmQyJTzEl6IzxMj7ly Pq28ibOyQXgAJbwf6tQe5BQsY5opFsJrYadhQcC/1j3uMX43nrAmz8b9NwEIteSvFb3v wOTtZ+w29Ba8QxZHF8iVjAHLjqYqGcpm0M3I2WPWeHnmIarWsPpSMpML30SHP1VLDzz0 /KLwE7OYoyaUKolDb6c/Tt2/HdRhUQsZAK7ALePX8OP83zt84DIU3ZhtCeGHRC/R5l0r 00QQ== 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=0261EYjGzfGUhQuO00aCfkVvGUs4cSrLHyHnRai5nfc=; b=uxY/RHwz35Iy7BgfUYUOnRjmoHXX93n5xNTxdYF2lBWeh/i4pG/EE4mA3d95koYAmM hLdo7vkYj+aJ7/NxZ4m6YuAAKCCKh/ShOsaERn4hx5Fsy20H2LjH6QQAYdIcX7wViuRJ Dh2QZctIdd/bS4dBM4qr7VaYnVmYcuChFVTW75Hj5pta+NGBO7u8BpMpYzBosZ/AvzUq 37GcYgf/94ZF9lR18VaKdZ2LJkcWdFKKxvFI1GgQQl+nJXuSBCVaMuApRqJsfQDwWYqe 8P/0VGytTRepLfJWH55ZTz1bZOGLR4tURLI8ldIMM7H3bxBG0uw21O4BbelM2EQHs28D qS6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g6ybWOsh; 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 b34si6293016edc.74.2019.10.27.14.30.23; Sun, 27 Oct 2019 14:30:46 -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=g6ybWOsh; 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 S1730899AbfJ0V24 (ORCPT + 99 others); Sun, 27 Oct 2019 17:28:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:42654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730729AbfJ0VVo (ORCPT ); Sun, 27 Oct 2019 17:21:44 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 76D64214E0; Sun, 27 Oct 2019 21:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572211303; bh=Cgywksyt4H2wmbf4RTwC80HR3uuAZ4hEsERpXkzJm8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6ybWOshaY1tuL92SH+TPyO49bfASwNjhrnd/1gVLXKBdJpFTOr6pHwxuHLBrJ0ho yVK6VtSUEAHZGvw25skkuT4rvGOYa9NPS/JZDsyR1hVk3i0+9Ho44UVKLFotJTFf3U uZ3Tg8kRX87a5lwS08vmq4EySpEX3jwSy+K9Kydk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Horman , John Hurley , Davide Caratti , "David S. Miller" Subject: [PATCH 5.3 087/197] net: avoid errors when trying to pop MLPS header on non-MPLS packets Date: Sun, 27 Oct 2019 22:00:05 +0100 Message-Id: <20191027203356.427262492@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203351.684916567@linuxfoundation.org> References: <20191027203351.684916567@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: Davide Caratti [ Upstream commit dedc5a08da07874c6e0d411e7f39c5c2cf137014 ] the following script: # tc qdisc add dev eth0 clsact # tc filter add dev eth0 egress matchall action mpls pop implicitly makes the kernel drop all packets transmitted by eth0, if they don't have a MPLS header. This behavior is uncommon: other encapsulations (like VLAN) just let the packet pass unmodified. Since the result of MPLS 'pop' operation would be the same regardless of the presence / absence of MPLS header(s) in the original packet, we can let skb_mpls_pop() return 0 when dealing with non-MPLS packets. For the OVS use-case, this is acceptable because __ovs_nla_copy_actions() already ensures that MPLS 'pop' operation only occurs with packets having an MPLS Ethernet type (and there are no other callers in current code, so the semantic change should be ok). v2: better documentation of use-cases for skb_mpls_pop(), thanks to Simon Horman Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC") Reviewed-by: Simon Horman Acked-by: John Hurley Signed-off-by: Davide Caratti Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5524,7 +5524,7 @@ int skb_mpls_pop(struct sk_buff *skb, __ int err; if (unlikely(!eth_p_mpls(skb->protocol))) - return -EINVAL; + return 0; err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN); if (unlikely(err))