Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1324960rwb; Thu, 1 Dec 2022 15:59:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ouDEbZNckPv9L/30EDLpFAfs8SDtj1YXHtDWGKHh71rkTBqm2j28Hb548ouo7l9nQ/BXh X-Received: by 2002:a05:6402:360b:b0:468:f365:dca with SMTP id el11-20020a056402360b00b00468f3650dcamr25413747edb.41.1669939142002; Thu, 01 Dec 2022 15:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669939141; cv=none; d=google.com; s=arc-20160816; b=rHN1efMDHCBrh3NCu0hgl960FlV6pLfLMYbjxMcUwr3x1jm/pyB7j16dC3OOOozWf/ MaztuGzw6JLwG2usHyWqhv5VJktVM+l6OvgyGDHFVENkoQLxPDUtHZUtVfBKoisbKyEK 90oXUwST+7EL1+XfZQk2rEabOh12lHF5sZ9ZqpWqV3CulqQ8Ajrz2b/cf+vKy0Pi3uH+ Z3Vh/o2IsN6Fo8eGIVju/G0tSvsey/atJo9F8SeV9IRXLOycMLMsMmdZlyJx7RsSnCXl EPV1m9xXknlS9a1eq5cqZLfqbiWt/4IBYBXC7BIu8d2ItWzRCRlOZ5Qtfj8ORvI5MIMQ 1/Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=b50DMxxzpcvqZuaYvZ+NeDB+ivxCzALRsRPpNk8vSuo=; b=Jc8GVwepHzxSg8FBxZ4c3fnzyvGIDMXrR/npmovBgq1HsWvvlgkRZKQwCQtuZ9vwKZ zskha5nFMPzF9ffv5suiA2Qr7jbmfEKo33iWxws6GZVpd9J/bK2VhcDsZf1Ecz10UyxG 9iJtM8qLBfs5D2SEE94cx8Gl8bSKIKZenIAbPAy4s40cLqSGgEtQvwURD5htT7tWXCqY sFVRq6mzGfpQo67VHYBr7oGYWCOC6HcooCivZ2Q00JCKXdYwGTe9VcXe0YzXdy4QtTAe qsFZvPl3B4BW93gZ4LwV6NUNPlXdji9LieDhFzinGrRHbC7pmAkliMnIFq1OuzOprged P7EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=bJT+6Pf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn5-20020a170906d92500b0078d450cbb02si3702378ejb.452.2022.12.01.15.58.42; Thu, 01 Dec 2022 15:59:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=bJT+6Pf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbiLAWsz (ORCPT + 81 others); Thu, 1 Dec 2022 17:48:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbiLAWsy (ORCPT ); Thu, 1 Dec 2022 17:48:54 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 537DA9C617 for ; Thu, 1 Dec 2022 14:48:51 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id d6so4759603lfs.10 for ; Thu, 01 Dec 2022 14:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b50DMxxzpcvqZuaYvZ+NeDB+ivxCzALRsRPpNk8vSuo=; b=bJT+6Pf3gru2G2faqNC14AW+QMpsR+xneNE6bi+nKD/YnzuiEQuBNxCfistgza0ycf GZRQfPHJd9PCQKfct4zOcD7tinF1//EGcbuVyO10QoRxbK6RX4VVtG4WIOUQIjLz4W8p FEx2qQ8d+p6PoKZHfzWYpZ3ZmZJ0Gs4l/CJpFvhnADgyC2mXMgddYYf5QbhGcnFdMVnX mm5cR1pz0OaE7b3Bs5WsY4NqHcUlxxUUWb20dWgMz9APsKjDt4sV0dlCzyxrxIl/yYt9 Ce3tvHvPymkAbXbt/nE9ZXEXmjAdVEsW14oNY7PsOdsWnZR1AmaobLwlBzfrN+ekHykV zQUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b50DMxxzpcvqZuaYvZ+NeDB+ivxCzALRsRPpNk8vSuo=; b=SloVfUbdAL6HUwugkysyT5l5bLIHdBRW4oKhL9le6VCnV4Bs36ueElHFd+z/41CZwi 45lN4Xh4CvO5XnsutVx0nYbShTSThExyUu3lyQjY1U0w6ATTRJtNnLPznrz4t2yDD4P+ omKdEnICqGOIT5K4rfh19TEfLvBZ+0B1RHN0qMmJkEC+VWDRQeAsVkhIrVndAzwA/guY wVuNt6XD4WRY8lhk3SvDM1mwE//uI/QxhA6xp0Dpz4L2uXhiQZxWfD0SYxR2fTf+Qv1Q E12IVx9Euv3DuOq4LTYjllc2q6oSrW2Bb1b3O/ydaiDxzMi3ZPDgyEQiUCU4XkpGF4uu 7ABQ== X-Gm-Message-State: ANoB5pl8pUP0hJqMTn2ZGuYDTXpsBETiVUon1tnRl9aVyIW5R6ht4/03 dAg2oNGUFlPf5JjAprg/EF4JVg== X-Received: by 2002:ac2:5f6c:0:b0:4a2:bca5:76bc with SMTP id c12-20020ac25f6c000000b004a2bca576bcmr16343840lfc.123.1669934929672; Thu, 01 Dec 2022 14:48:49 -0800 (PST) Received: from localhost.localdomain ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id g7-20020a056512118700b00497ab34bf5asm797573lfr.20.2022.12.01.14.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 14:48:49 -0800 (PST) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: devel@daynix.com Subject: [PATCH v4 1/6] udp: allow header check for dodgy GSO_UDP_L4 packets. Date: Fri, 2 Dec 2022 00:33:27 +0200 Message-Id: <20221201223332.249441-1-andrew@daynix.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow UDP_L4 for robust packets. Signed-off-by: Jason Wang Signed-off-by: Andrew Melnychenko --- net/ipv4/udp_offload.c | 3 ++- net/ipv6/udp_offload.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 6d1a4bec2614..f65b1a7a0c26 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -387,7 +387,8 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, false); mss = skb_shinfo(skb)->gso_size; diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 7720d04ed396..057293293e30 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -42,7 +42,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, true); mss = skb_shinfo(skb)->gso_size; -- 2.38.1