From patchwork Thu May 17 21:15:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 915802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bR6k+7uu"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40n4Bn1WNpz9s33 for ; Fri, 18 May 2018 07:27:13 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AEF8CF6C; Thu, 17 May 2018 21:16:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 3089EE78 for ; Thu, 17 May 2018 21:16:03 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f65.google.com (mail-pl0-f65.google.com [209.85.160.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B11006DD for ; Thu, 17 May 2018 21:16:02 +0000 (UTC) Received: by mail-pl0-f65.google.com with SMTP id e6-v6so3259664plt.11 for ; Thu, 17 May 2018 14:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6gPwmbsxlJ++SQ1QOTKcmra14PfdL0ZHlWMKQ4vPL58=; b=bR6k+7uui1zmXwXPmbaEEnJqwUCs5jI660DwhbKGoOYIWZwcF5dJshVc3SgqJ3cO2m Eb2eOmouqyWAlRdGT3v8VLgBBq+3zgDmEbPPbov+lh7nvV3qaLu/xqd4kGr2iTSpPIuL evCgMDQl8KUJWU5uYPQbYbKuO5i4TlKYTuXuFA7Ph/e8vp+1I9ZvTe1lD54cIMjTJUuk ST4xS5kGjkn/SIspse4lh7/slcc/n00RfYQy0k9vBQ4dRD7mc20OJBeQ8vjON1rSr1II nfRq0/JSsQ6kadOk6mCKwM3NrVkgA4nmkFhf3jKPfHKL6ICT1ML4NYM4KQCurKzWKrJF LIhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6gPwmbsxlJ++SQ1QOTKcmra14PfdL0ZHlWMKQ4vPL58=; b=VU1ScyF9seeVELDHDpRGoCw8Vun+DgqaHmFmKU4EZFdSH/19/XZziSJ8KFQTD3HtWB I4GjXAZri9nnhS7O+t7G+/7JNIYFiAdoGYgKhXbyAD6zPdWB7lASf5WyxgCPumkLrnFb CrrIuPRkuFTv2tTAzRr3NGzQd1VfJUV76U263HJiAxVmb9WNtEM9K7pqxowr+mJiMgrY WcumYqUnaYaaqwPFCf+s3EtDa8fCnN14neGRqpADA3NZ651OnAMUIvZ7VgY+cEr8TxMs NwLk7GBKeJYyKGqHFnLGCQS85/181chI2m6c4AQ2v2kAP7hT2X3kqhMQLN+kLW9OQx4i 0EQw== X-Gm-Message-State: ALKqPwem0hrjhphlv4wpG6uuYU0qgbSAZBt1QnPPzf/sqMWiM2xGbKY9 I4yEbcOLO6AV1grHqnyAlWW/3g== X-Google-Smtp-Source: AB8JxZrS/95MQgXzAMDIxIScF5XA4GFs5mqOrZcsEINM3HfksHLNfERaZT3i59aH7XNL9xFgtqnbHw== X-Received: by 2002:a17:902:4603:: with SMTP id o3-v6mr6905107pld.49.1526591762057; Thu, 17 May 2018 14:16:02 -0700 (PDT) Received: from gizo.domain (97-115-125-157.ptld.qwest.net. [97.115.125.157]) by smtp.gmail.com with ESMTPSA id r68-v6sm12410581pfi.174.2018.05.17.14.16.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 14:16:01 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 17 May 2018 14:15:18 -0700 Message-Id: <1526591733-4450-27-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526591733-4450-1-git-send-email-gvrose8192@gmail.com> References: <1526591733-4450-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 26/41] openvswitch: fix vport packet length check. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: William Tu Upstream commit: commit 46e371f0e78a82186a83cbcb4f4b8850417c7dd5 Author: William Tu Date: Wed Mar 7 15:38:48 2018 -0800 openvswitch: fix vport packet length check. When sending a packet to a tunnel device, the dev's hard_header_len could be larger than the skb->len in function packet_length(). In the case of ip6gretap/erspan, hard_header_len = LL_MAX_HEADER + t_hlen, which is around 180, and an ARP packet sent to this tunnel has skb->len = 42. This causes the 'unsign int length' to become super large because it is negative value, causing the later ovs_vport_send to drop it due to over-mtu size. The patch fixes it by setting it to 0. Signed-off-by: William Tu Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: William Tu Signed-off-by: Greg Rose --- datapath/vport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datapath/vport.c b/datapath/vport.c index f4131be..184c859 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -520,10 +520,10 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb, return 0; } -static unsigned int packet_length(const struct sk_buff *skb, - struct net_device *dev) +static int packet_length(const struct sk_buff *skb, + struct net_device *dev) { - unsigned int length = skb->len - dev->hard_header_len; + int length = skb->len - dev->hard_header_len; if (!skb_vlan_tag_present(skb) && eth_type_vlan(skb->protocol)) @@ -534,7 +534,7 @@ static unsigned int packet_length(const struct sk_buff *skb, * account for 802.1ad. e.g. is_skb_forwardable(). */ - return length; + return length > 0 ? length: 0; } void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto)