From: Michal Kubecek <mkubecek@suse.cz>
To: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH for v4.9 LTS 86/87] net: account for current skb length when deciding about UFO
Date: Sat, 15 Jul 2017 10:53:27 +0200 [thread overview]
Message-ID: <20170715085327.GE10129@unicorn.suse.cz> (raw)
In-Reply-To: <20170715012538.10101-86-alexander.levin@verizon.com>
On Sat, Jul 15, 2017 at 01:26:27AM +0000, Levin, Alexander (Sasha Levin) wrote:
> From: Michal Kube�ek <mkubecek@suse.cz>
>
> [ Upstream commit a5cb659bbc1c8644efa0c3138a757a1e432a4880 ]
>
> Our customer encountered stuck NFS writes for blocks starting at specific
> offsets w.r.t. page boundary caused by networking stack sending packets via
> UFO enabled device with wrong checksum. The problem can be reproduced by
> composing a long UDP datagram from multiple parts using MSG_MORE flag:
>
> sendto(sd, buff, 1000, MSG_MORE, ...);
> sendto(sd, buff, 1000, MSG_MORE, ...);
> sendto(sd, buff, 3000, 0, ...);
>
> Assume this packet is to be routed via a device with MTU 1500 and
> NETIF_F_UFO enabled. When second sendto() gets into __ip_append_data(),
> this condition is tested (among others) to decide whether to call
> ip_ufo_append_data():
>
> ((length + fragheaderlen) > mtu) || (skb && skb_is_gso(skb))
>
> At the moment, we already have skb with 1028 bytes of data which is not
> marked for GSO so that the test is false (fragheaderlen is usually 20).
> Thus we append second 1000 bytes to this skb without invoking UFO. Third
> sendto(), however, has sufficient length to trigger the UFO path so that we
> end up with non-UFO skb followed by a UFO one. Later on, udp_send_skb()
> uses udp_csum() to calculate the checksum but that assumes all fragments
> have correct checksum in skb->csum which is not true for UFO fragments.
>
> When checking against MTU, we need to add skb->len to length of new segment
> if we already have a partially filled skb and fragheaderlen only if there
> isn't one.
>
> In the IPv6 case, skb can only be null if this is the first segment so that
> we have to use headersize (length of the first IPv6 header) rather than
> fragheaderlen (length of IPv6 header of further fragments) for skb == NULL.
>
> Fixes: e89e9cf539a2 ("[IPv4/IPv6]: UFO Scatter-gather approach")
> Fixes: e4c5e13aa45c ("ipv6: Should use consistent conditional judgement for
> ip6 fragment between __ip6_append_data and ip6_finish_output")
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> Acked-by: Vlad Yasevich <vyasevic@redhat.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> [SL: Drop changes to net/ipv4/ip_output.c because 4.9 doesn't have
> e89e9cf539a2 ("[IPv4/IPv6]: UFO Scatter-gather approach")]
Commit e89e9cf539a2 is in mainline since v2.6.16.28 so that 4.9 does
have it. The conflict on cherry-pick is caused by missing commit
e4c5e13aa45c but that is the same as in the IPv6 part. I'm adding the
IPv4 part backported to 4.9 below
> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
> ---
> net/ipv6/ip6_output.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 5a4b8e7bcedd..9213eba601d0 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -1376,7 +1376,7 @@ static int __ip6_append_data(struct sock *sk,
> */
>
> cork->length += length;
> - if ((((length + fragheaderlen) > mtu) ||
> + if ((((length + (skb ? skb->len : headersize)) > mtu) ||
> (skb && skb_is_gso(skb))) &&
> (sk->sk_protocol == IPPROTO_UDP) &&
> (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
> --
> 2.11.0
This is strange, it looks as if e4c5e13aa45c was already applied before
but I can't see that in stable-4.9.y branch.
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e5c1dbef3626..06215ba88b93 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -936,7 +936,8 @@ static int __ip_append_data(struct sock *sk,
csummode = CHECKSUM_PARTIAL;
cork->length += length;
- if (((length > mtu) || (skb && skb_is_gso(skb))) &&
+ if ((((length + (skb ? skb->len : fragheaderlen)) > mtu) ||
+ (skb && skb_is_gso(skb))) &&
(sk->sk_protocol == IPPROTO_UDP) &&
(rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
(sk->sk_type == SOCK_DGRAM) && !sk->sk_no_check_tx) {
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index fd649599620e..9213eba601d0 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1376,7 +1376,7 @@ static int __ip6_append_data(struct sock *sk,
*/
cork->length += length;
- if (((length > mtu) ||
+ if ((((length + (skb ? skb->len : headersize)) > mtu) ||
(skb && skb_is_gso(skb))) &&
(sk->sk_protocol == IPPROTO_UDP) &&
(rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
next prev parent reply other threads:[~2017-07-15 8:53 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-15 1:25 [PATCH for v4.9 LTS 01/87] x86/mce/AMD: Make the init code more robust Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 03/87] ARM: omap2+: fixing wrong strcat for Non-NULL terminated string Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 02/87] r8169: add support for RTL8168 series add-on card Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 06/87] ARM: dts: am57xx-idk: Put USB2 port in peripheral mode Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 04/87] dt-bindings: power/supply: Update TPS65217 properties Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 05/87] dt-bindings: input: Specify the interrupt number of TPS65217 power button Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 08/87] net/mlx5: Disable RoCE on the e-switch management port under switchdev mode Levin, Alexander (Sasha Levin)
2017-07-15 1:25 ` [PATCH for v4.9 LTS 07/87] ARM: dts: n900: Mark eMMC slot with no-sdio and no-sd flags Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 11/87] net/mlx4: Remove BUG_ON from ICM allocation routine Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 10/87] net/mlx4_core: Use-after-free causes a resource leak in flow-steering detach Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 09/87] ipv6: Should use consistent conditional judgement for ip6 fragment between __ip6_append_data and ip6_finish_output Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 12/87] net/mlx4_core: Fix raw qp flow steering rules under SRIOV Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 13/87] drm/msm: Ensure that the hardware write pointer is valid Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 14/87] drm/msm: Put back the vaddr in submit_reloc() Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 16/87] vfio-pci: use 32-bit comparisons for register address for gcc-4.5 Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 17/87] irqchip/keystone: Fix "scheduling while atomic" on rt Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 15/87] drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 20/87] ASoC: nau8825: fix invalid configuration in Pre-Scalar of FLL Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 19/87] spi: dw: Make debugfs name unique between instances Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 18/87] ASoC: tlv320aic3x: Mark the RESET register as volatile Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 22/87] openrisc: Add _text symbol to fix ksym build error Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 23/87] dmaengine: ioatdma: Add Skylake PCI Dev ID Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 21/87] irqchip/mxs: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 25/87] l2tp: consider '::' as wildcard address in l2tp_ip6 socket lookup Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 26/87] dmaengine: ti-dma-crossbar: Add some 'of_node_put()' in error path Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 24/87] dmaengine: ioatdma: workaround SKX ioatdma version Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 28/87] ARM64: zynqmp: Fix W=1 dtc 1.4 warnings Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 29/87] ARM64: zynqmp: Fix i2c node's compatible string Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 27/87] usb: dwc3: omap: fix race of pm runtime with irq handler in probe Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 30/87] perf probe: Fix to get correct modname from elf header Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 31/87] ARM: s3c2410_defconfig: Fix invalid values for NF_CT_PROTO_* Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 32/87] ACPI / scan: Prefer devices without _HID/_CID for _ADR matching Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 35/87] Btrfs: fix lockdep warning about log_mutex Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 33/87] usb: gadget: Fix copy/pasted error message Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 34/87] Btrfs: use down_read_nested to make lockdep silent Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 37/87] Btrfs: adjust outstanding_extents counter properly when dio write is split Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 36/87] benet: stricter vxlan offloading check in be_features_check Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 38/87] Xen: ARM: Zero reserved fields of xatp before making hypervisor call Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 39/87] tools lib traceevent: Fix prev/next_prio for deadline tasks Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 40/87] perf tools: Install tools/lib/traceevent plugins with install-bin Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 41/87] perf symbols: Robustify reading of build-id from sysfs Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 42/87] video: fbdev: cobalt_lcdfb: Handle return NULL error from devm_ioremap Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 43/87] perf probe: Fix to probe on gcc generated symbols for offline kernel Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 44/87] vfio-pci: Handle error from pci_iomap Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 45/87] arm64: mm: fix show_pte KERN_CONT fallout Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 46/87] nvmem: imx-ocotp: Fix wrong register size Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 47/87] net: usb: asix_devices: add .reset_resume for USB PM Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 50/87] ARCv2: IRQ: Call entry/exit functions for chained handlers in MCIP Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 48/87] ASoC: fsl_ssi: set fifo watermark to more reliable value Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 49/87] sh_eth: enable RX descriptor word 0 shift on SH7734 Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 51/87] ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 52/87] x86/platform/intel-mid: Rename 'spidev' to 'mrfld_spidev' Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 53/87] perf/x86: Set pmu->module in Intel PMU modules Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 54/87] ASoC: Intel: bytcr-rt5640: fix settings in internal clock mode Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 56/87] scsi: fnic: Avoid sending reset to firmware when another reset is in progress Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 55/87] HID: ignore Petzl USB headlamp Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 58/87] scsi: bfa: Increase requested firmware version to 3.2.5.1 Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 57/87] scsi: snic: Return error code on memory allocation failure Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 60/87] ASoC: dpcm: Avoid putting stream state to STOP when FE stream is paused Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 59/87] ASoC: Intel: Skylake: Release FW ctx in cleanup Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 61/87] sh_eth: fix EESIPR values for SH77{34|63} Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 64/87] tg3: Fix race condition in tg3_get_stats64() Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 62/87] sh_eth: R8A7740 supports packet shecksumming Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 63/87] net: phy: dp83867: fix irq generation Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 67/87] ASoC: rt5645: set sel_i2s_pre_div1 to 2 Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 66/87] spi: spi-axi: Free resources on error path Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 65/87] x86/boot: Add missing declaration of string functions Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 69/87] phy state machine: failsafe leave invalid RUNNING state Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 68/87] netfilter: use fwmark_reflect in nf_send_reset Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 70/87] ipv4: make tcp_notsent_lowat sysctl knob behave as true unsigned int Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 73/87] scsi: qla2xxx: Get mutex lock before checking optrom_state Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 71/87] clk/samsung: exynos542x: mark some clocks as critical Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 72/87] libfs: Modify mount_pseudo_xattr to be clear it is not a userspace mount Levin, Alexander (Sasha Levin)
2017-07-15 7:50 ` Eric W. Biederman
2017-07-15 15:46 ` Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 75/87] ARM: dts: sun6i: hummingbird: Enable display engine again Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 74/87] drm/virtio: fix framebuffer sparse warning Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 76/87] ARM: dts: sun8i: Support DTB build for NanoPi M1 Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 77/87] ARM: dts: sunxi: Change node name for pwrseq pin on Olinuxino-lime2-emmc Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 78/87] iw_cxgb4: do not send RX_DATA_ACK CPLs after close/abort Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 81/87] ARM: 8632/1: ftrace: fix syscall name matching Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 79/87] nbd: blk_mq_init_queue returns an error code on failure, not NULL Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 80/87] virtio_blk: fix panic in initialization error path Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 82/87] mm, slab: make sure that KMALLOC_MAX_SIZE will fit into MAX_ORDER Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 83/87] lib/Kconfig.debug: fix frv build failure Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 86/87] net: account for current skb length when deciding about UFO Levin, Alexander (Sasha Levin)
2017-07-15 8:53 ` Michal Kubecek [this message]
2017-07-24 14:10 ` Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 84/87] signal: protect SIGNAL_UNKILLABLE from unintentional clearing Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 85/87] mm: don't dereference struct page fields of invalid pages Levin, Alexander (Sasha Levin)
2017-07-15 1:26 ` [PATCH for v4.9 LTS 87/87] net/mlx5: E-Switch, Re-enable RoCE on mode change only after FDB destroy Levin, Alexander (Sasha Levin)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170715085327.GE10129@unicorn.suse.cz \
--to=mkubecek@suse.cz \
--cc=alexander.levin@verizon.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox