From patchwork Fri May 18 01:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 915964 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="WPiP/Xj5"; 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 40nBWs4Zlmz9s19 for ; Fri, 18 May 2018 12:12:25 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E90821156; Fri, 18 May 2018 01:59:06 +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 C2F881105 for ; Fri, 18 May 2018 01:58:54 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 817666FB for ; Fri, 18 May 2018 01:58:54 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id c22-v6so1940877pgn.11 for ; Thu, 17 May 2018 18:58:54 -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=WPiP/Xj5KZC+F8VTAxzLvmZHTNsWXLgjl2lC5kYCqcSis7+HKbj5PDCsPy3bkipZ4B tdgtwyTLlwt8LVKuykD855iO9wYxoBmnobfhieDbZcjOKf6Th8hfa/tM51668mDJqdcY fO/rXGu3ZkYZxSZda6qZIEmThvFN+XTo73+sF57Vk6cwAAskJAwP2aUxY8z61gOyGsQg YywbsZAFBXplxTIuleuC6aJQfYL+x1+/+t6qXURbMJjeFqF1FB89I0KDoDraFtQZBZuK 4AsHm9PyDkK+iYZuBnE6lRbPOVXvAKHCYchUBQRvFCNmYVe0thvzeYfWGs6dYOpmAG+Y BXZA== 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=C2//bEiGnLESHoWoJg9XUm9i/1GU6vfGAQLtxxBYIVbL/4a2rUpxX+Hgj4r+UMOXvh r04x0gzb21IKmPHy/np/T7SKpCmbLdXC0ok+GBwfUZHk0xMgDqrl6ZNG1PxdDo/dCNMM 3jnBhT4wlO70shCFXr/Df1F5N+ixB9fn9rTo4ZOyBG+GrzOSmYRSizPRaJbJkzD8hKGa Y2TNhhNpNebroccSaZhGXTEhoxso4hg5gA+Q+O/+fGJ/8h6R87NM7Tl0QVynAWzuX68s ngDlFajnos+iFA0JBuXe6AmrX2bbiL7HC4h51o6muRc+gKvPJC7eRqPshQNPxsUQtHrK X4AQ== X-Gm-Message-State: ALKqPwdSygIays5mKFPtSki5/qAAP4tjjXA3siTQ6roVg/cpGiSpOp0W ZwytrwR1P28DLPbkC16pOSzSUg== X-Google-Smtp-Source: AB8JxZrnJ4NlhiiSdJTAxQPCnr9PtaAnlInqHr0de8/H6HAr+HNk1Wu1n5jHJyUjewnYvQKewJaFcw== X-Received: by 2002:a65:4b8d:: with SMTP id t13-v6mr5911765pgq.53.1526608733821; Thu, 17 May 2018 18:58:53 -0700 (PDT) Received: from gizo.domain (97-115-125-157.ptld.qwest.net. [97.115.125.157]) by smtp.gmail.com with ESMTPSA id d15-v6sm10564908pfh.97.2018.05.17.18.58.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 18:58:53 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 17 May 2018 18:57:41 -0700 Message-Id: <1526608674-12702-29-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526608674-12702-1-git-send-email-gvrose8192@gmail.com> References: <1526608674-12702-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 V2 28/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)