Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2094773ybl; Thu, 30 Jan 2020 11:15:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxCq0Ijbgflvy92VBOB7wa6Dv9OuwRDPDS/g7pPIA9/l72HFKGvHMOEzOG090ZFQTUsNs+F X-Received: by 2002:a9d:7dc9:: with SMTP id k9mr4664995otn.117.1580411743277; Thu, 30 Jan 2020 11:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411743; cv=none; d=google.com; s=arc-20160816; b=iJ30ucFk4Vm2dYBQzRq+qfHysRiOy1yWzuuToqUIjdBYjJiEeg0UMY0Vf7FDgx0184 Qfdh98nOoV5PVZCZUORCQtnl2x//le+MzjGseN36y2USGmvN6TmUoGlPlhxw6viSy6dV 7nYJ6EgeV/54izNkTqvCLut791MAgt2BK8ZkY0TV4PwgZhKvtahG6XU+2kGrWZ+ph1od pbbXkJ1lxZZ8vcGVPhy0aFowLjWq+9MOwVUqhrsP1kCA4T9CuRrzpewdZQFgXmLbrmNn vlKfXj2aAy7uKK2kicUjtWkdkWilz07UIFrtwhdCDwPGXzFIItyqGHUXnaZcPi2On5wr agBw== 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=glO6uUKC+2FgvC3gO2v0l59drKIbAImuLQ3uSBj/etpGbY30gTkWd9WU2giX4sNgOw PgqWwabS7i19RhjdoJQPa2sVBhPQ18+X/yMbCnKOXpDVtLDQQGg1QHOwlE2puJX5yFLE gvFa3cz/PKHelBHXBOCR9qTsAe2rPS+6NfBzgDhOveOQqEdQvs/ZfulmUTWNGMV+86G7 +MTnArZzmZwVLbqFJrpQmJxQOFX8L8B7t7ZRoqoFDvegr6f0vseJdIr4cIUFua5NUb5O pNdHyZPCWX3GHnWqMslQav09s0nX75PLvF2UI6kTnMjODtk6jptM69zTIozFaJi3R4zL 2cUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QxvQjUfn; 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 y186si3165768oig.241.2020.01.30.11.15.31; Thu, 30 Jan 2020 11:15:43 -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=QxvQjUfn; 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 S1730304AbgA3SmD (ORCPT + 99 others); Thu, 30 Jan 2020 13:42:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:50122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728028AbgA3SmA (ORCPT ); Thu, 30 Jan 2020 13:42:00 -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 A8EDC2083E; Thu, 30 Jan 2020 18:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409720; bh=N5y1muu8N21M0FsvptEApXfStVYRWbQEbqqaQyDIb50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxvQjUfnd+w2PvYH++mtQ4gwZ37RCbPF8wrQDqQCFu4zZOkELWCMniEUrhlJnLyz+ sB8hISz1j31hAF5JuNJYDuArF3er/ap7bJzKUsl21MAQT8Hsmgs2tDoCbd+XrZbW3+ g+t9SGnwAGOLtM8jQU8nGp59pniacGIgeh/s2Wf8= 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.5 42/56] udp: segment looped gso packets correctly Date: Thu, 30 Jan 2020 19:38:59 +0100 Message-Id: <20200130183616.721326806@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@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 */