Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3396163ybp; Sun, 6 Oct 2019 11:01:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgMe4rM6xOafoLKn34MXvZLziy01rSy73cezYkegTu1C1ACe1hrKFZJ1rNXUqz9876q52N X-Received: by 2002:a50:b6aa:: with SMTP id d39mr24965670ede.16.1570384887623; Sun, 06 Oct 2019 11:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384887; cv=none; d=google.com; s=arc-20160816; b=hXxmi5AKb/MMUTPK74A77ITGIazWePHqns8caAjnDBXUS3UCSGNirBHeBF6C1cXWA7 2Dt8g+9mIdF4pC5y0UPcKrNFzeLtBrMkSbhOKXgsYt2p6vVvOAYFfPQpm+mNnVu2kK14 R9KavE+ihG3vItqJit05JaNVtV+Buejcgfwc0XQII6CErMxFqkW8dxhJi5chBqnX1/hA WW+lJ4F1u6BtVBba74pdU2DR8Qh9kVzyK9MqiTXOcUSjp26aG54azJDZHXdJWysbveQK xFdZYgieTq/C+r5hTx5qm1YOtQDgxzQjUlcFVS+6GJRmBys5VHO1CrWYswoiIvyWo5Re pbAw== 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=7kg7K0ekqRw5+9QBse6RSJ0rTV/k6c1NXXw28oR7+3I=; b=gMBiJ2NiqiycPCGL/kdlA3fkQ9pwo9yPhdOmN15pgdEypDTSbFgYb5UKjsqQ1e6Kqb kvXy/NguakC4Nubt3uOjB/JIIXicVPVxZ5Dq5E0vi6SzvWEKg8yY5I/eAUXJzPbrxHpV yNdQnjOdUUC1vKV0Vs0jStitTNA5F8R917cm3qmJp/KaZheZTJBs+8LV2QGg8djfAsKc oH5k+d57W7VMOe5CpIfwD2jsuoTHcrsvqyyvCwXsFgHwdtqEOjymVIl3Ii1oN10qmBUI qKwVzhbbZgf/BM7cF5QR8i95JM+csB6XadBYrkRh4Go5SF/ilSq6m/kplcO4UfWb/Sfh JPhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AGC52F2k; 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 y28si7467658edb.162.2019.10.06.11.01.04; Sun, 06 Oct 2019 11:01:27 -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=AGC52F2k; 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 S1728349AbfJFR6j (ORCPT + 99 others); Sun, 6 Oct 2019 13:58:39 -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; }