Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2096992ybl; Thu, 30 Jan 2020 11:18:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxSiM4+PfnB3YoB1K/+jD9T6Ly7kazbrdEbjhxsU0y6nMnzQV8685FUxaIGTzzn18LdWJtm X-Received: by 2002:a05:6830:4cd:: with SMTP id s13mr4621716otd.181.1580411886721; Thu, 30 Jan 2020 11:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411886; cv=none; d=google.com; s=arc-20160816; b=wAYq23U87B4exk/dbN8NbA2DC/GhD6gbvgjfE9dxOp9h764xZbRMFVshmnC1tRbtfP 36gh0XHOttiRCVK4iyybNbm5I6OxnoQQ+Ne+bPFISzskpW+2URAgJTMXHQM1HZVWKi96 oqRIgTrDs8Z3nlOm5saVHodn7kW2Jc2TJoY1gqhElZPX00mT+vpoTuo+sJ+bdqOO7ciX PuHq5xDLv0yWu43oyybAtEbUq4Nfi6WDBp77Arb87iPXZZzL+Nj7cQN7Ymm4nmJxzcI2 17LzvD7HzZKMQaMI2+mXyqU5Rz0TI2XXiOfDsn9sr8c6PEqIdvakQyrv0fqme67aD6xM qoTA== 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=RM68xbuu7GuXXi3XnHIpfFcjXU1Jnw51HtwzsvZEwNg=; b=XzhexEcyNg3sdHmWfTvAeR6MjPsIB8jNkTU9U4LtCg4NjabwEOvDAwCOy+TQds2un4 /eKT1Pejc19NzL+2PnQ4Y0M33klHOfrHGxsS1MjlrMsDZk3c8gabCl3o137WlZW0R90I 3y1OlSSPGqnuXGhP3pIvxiJJry4mxT3a5S5iuWGAq1SBxgoWfVR28/owrA9qA5w8Msmi UPUKanXyLJb3niLBtTkCWyvt4b/f+jRmGsK61XfwPCOxNTCna7MbIy5o5raWL2LGVkoO /0JGdQb8gE/pFpiQh5kJlq4zPfQ/q55UtP9irh6E/JtKtecI+7tWJqJNS1g/ait7SjwZ 0KZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FgzycVbp; 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 z73si3265203oia.40.2020.01.30.11.17.54; Thu, 30 Jan 2020 11:18:06 -0800 (PST) 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=FgzycVbp; 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 S1730660AbgA3Snk (ORCPT + 99 others); Thu, 30 Jan 2020 13:43:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:52204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730625AbgA3Snb (ORCPT ); Thu, 30 Jan 2020 13:43:31 -0500 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 2FC7A2083E; Thu, 30 Jan 2020 18:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409809; bh=N5y1muu8N21M0FsvptEApXfStVYRWbQEbqqaQyDIb50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FgzycVbpg3OEnAxp2CfCiaVvizI6/hNldp+MtPLYnKYUf1Zqe7nTE32t8nhcdXTdX FJZLfJOkNU1MRKPBmLClbaP2Sq2hDaMOCap0ujnEzTny5Xun9diTGvJBiPoZPeHw4x 3S11ODs/nayaOsfiGx6wbm2g/GuKvPLry2TKcDtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Willem de Bruijn , "David S. Miller" Subject: [PATCH 5.4 040/110] udp: segment looped gso packets correctly Date: Thu, 30 Jan 2020 19:38:16 +0100 Message-Id: <20200130183620.104536345@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@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: Willem de Bruijn [ Upstream commit 6cd021a58c18a1731f7e47f83e172c0c302d65e5 ] Multicast and broadcast packets can be looped from egress to ingress pre segmentation with dev_loopback_xmit. That function unconditionally sets ip_summed to CHECKSUM_UNNECESSARY. udp_rcv_segment segments gso packets in the udp rx path. Segmentation usually executes on egress, and does not expect packets of this type. __udp_gso_segment interprets !CHECKSUM_PARTIAL as CHECKSUM_NONE. But the offsets are not correct for gso_make_checksum. UDP GSO packets are of type CHECKSUM_PARTIAL, with their uh->check set to the correct pseudo header checksum. Reset ip_summed to this type. (CHECKSUM_PARTIAL is allowed on ingress, see comments in skbuff.h) Reported-by: syzbot Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection") Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/udp.h | 3 +++ 1 file changed, 3 insertions(+) --- a/include/net/udp.h +++ b/include/net/udp.h @@ -476,6 +476,9 @@ static inline struct sk_buff *udp_rcv_se if (!inet_get_convert_csum(sk)) features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + if (skb->pkt_type == PACKET_LOOPBACK) + skb->ip_summed = CHECKSUM_PARTIAL; + /* the GSO CB lays after the UDP one, no need to save and restore any * CB fragment */