From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1912C4360C for ; Sun, 6 Oct 2019 17:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9282221835 for ; Sun, 6 Oct 2019 17:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570384722; bh=0LPan9G7XckvOv9wlMbUmkGQNfko0u8W+m8WCmrr38c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=f/OnWsxoo4A0gcHxu4of3qLe2NiXz9yrIHpo/55HigeCW1pWvaEkbS6F/OvXYSu15 qJQYrXSxLZ2tT1LjW6y67E1QI5wqI1SLI3DVoZm0vygFugCrlHUQiF7PvIg68EPEoY hkFrJFsdHip3N9c9PeSGeN5b41on3Kuclr0Z9hXk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbfJFR6l (ORCPT ); Sun, 6 Oct 2019 13:58:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:58274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfJFRby (ORCPT ); Sun, 6 Oct 2019 13:31:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3BBF021479; Sun, 6 Oct 2019 17:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383113; bh=0LPan9G7XckvOv9wlMbUmkGQNfko0u8W+m8WCmrr38c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AGC52F2kGlJc8b/0+xnWRzpm0AfafvuPlxmZSyO+vvPEJIDUwIdgx1kdGl+Op63MT rl3gTOsaD+zYcl8a2PnZZLsZS9Np2vNDNf+jUPjm6bqGtIrMhj8Rn5OMC0YRHMu92Q 1+OqkEVpPyfhtpH7HXYOOMM8j1rVUiwHds9ugQjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Hunt , Alexander Duyck , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.19 092/106] udp: fix gso_segs calculations Date: Sun, 6 Oct 2019 19:21:38 +0200 Message-Id: <20191006171200.501041275@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@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: Josh Hunt [ Upstream commit 44b321e5020d782ad6e8ae8183f09b163be6e6e2 ] Commit dfec0ee22c0a ("udp: Record gso_segs when supporting UDP segmentation offload") added gso_segs calculation, but incorrectly got sizeof() the pointer and not the underlying data type. In addition let's fix the v6 case. Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT") Fixes: dfec0ee22c0a ("udp: Record gso_segs when supporting UDP segmentation offload") Signed-off-by: Josh Hunt Reviewed-by: Alexander Duyck Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -810,7 +810,7 @@ static int udp_send_skb(struct sk_buff * skb_shinfo(skb)->gso_size = cork->gso_size; skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; - skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh), + skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh), cork->gso_size); goto csum_partial; } --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1081,6 +1081,8 @@ static int udp_v6_send_skb(struct sk_buf skb_shinfo(skb)->gso_size = cork->gso_size; skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; + skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh), + cork->gso_size); goto csum_partial; }