Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2231471ybi; Thu, 20 Jun 2019 11:16:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEsMDYng8ncB0YE49H83DzMIfg7nxqQRiav1ouFcprxZ/cvvS4h/ZyVrJCL2kb2FYEg47M X-Received: by 2002:a17:902:2a68:: with SMTP id i95mr128261732plb.167.1561054588170; Thu, 20 Jun 2019 11:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054588; cv=none; d=google.com; s=arc-20160816; b=tNVxY9GcXzbthVLiIrFANWdW1YtOBaKD/NLm97Cf6skBukKSMcNy3VVo82eHroAq4r G0f0ZZreacQgyvkAia4tz83kdQxlhIhtnQfDD53T7Hsa0aS32HkSvk7jcGArobNKdJxR eKa/1oWeQtB88L4bRP18Tc92jJqxEW84y+IkC1JtbVIlImL+8J9f8fz7LdvKpR5OCLti 4x/Rmh0oj5ePeHnLmJel1OYpQ3LfKQQFZaEwvGFCrF5X2ONednCXKCkNu9rsDVJ4tIl2 wNSPQy7p9MRmwRzr/e99dWZriVUh+rZeCTL7h3gPs7+9b8EL5QWEiYQHaobnSJ+zG6aC acQw== 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=USBFL8JZxPMaRIMvkXkcf86xTQYmzw2z191H4caPGPw=; b=c3DEyoLrHtE3FPke+KCGXvH/zAA5bnDH1VWMDIkR647KcM1sioSdwBPvRSRfpqrSSl j5UVUSGboY/hxTi/UBIRyfnWGpYtTkevQujX11ZY9P2s1y1Om4zVYpD9xcjIozPnzcej dBHRqJOCsGzruHkbkb01iw268J9n0+7DhxdWgMlyb7b7uOT48YFVSpnEfsKn5QsHelHU lG9YQnIJyEaxDqq31wYz7V5GZydIK5Tw5fmsOThNiAh7tMpxMumzfnDJWahNwVUYMTdd 4QgWhHl2WuwW7GjzdfKmmxrFM2HOosCVSK3IUcz0PjrnD2bkkC9MkLTyJekJdsFg/GTP mwAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1KqBXslC; 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 l3si174259pgp.179.2019.06.20.11.16.12; Thu, 20 Jun 2019 11:16:28 -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=1KqBXslC; 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 S1728386AbfFTSOz (ORCPT + 99 others); Thu, 20 Jun 2019 14:14:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729503AbfFTSOw (ORCPT ); Thu, 20 Jun 2019 14:14:52 -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 9E27F21530; Thu, 20 Jun 2019 18:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054491; bh=O1AOVWIfY8FUP0UKPr0TTotD4YyJ3xpe9kg3M8Azp08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1KqBXslC9KyRVaAphIEmZ9vLjPCrqAGDzypsjcWnobHIGfdFdmcDEoSCfCqvf75kF 7+x1/m1gVrP+JAcqwxNGdny5i3ePsFVcpOMG9QsbiPtnUzMIDiCHOOwRpLBIM5njUf LGLvALcWgsXmGScFQQJ5eVND9VKEe2sYXpm2vzQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Stefano Brivio , "David S. Miller" Subject: [PATCH 5.1 17/98] vxlan: Dont assume linear buffers in error handler Date: Thu, 20 Jun 2019 19:56:44 +0200 Message-Id: <20190620174350.058456278@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@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: Stefano Brivio [ Upstream commit 8399a6930d12f5965230f4ff058228a4cc80c0b9 ] In commit c3a43b9fec8a ("vxlan: ICMP error lookup handler") I wrongly assumed buffers from icmp_socket_deliver() would be linear. This is not the case: icmp_socket_deliver() only guarantees we have 8 bytes of linear data. Eric fixed this same issue for fou and fou6 in commits 26fc181e6cac ("fou, fou6: do not assume linear skbs") and 5355ed6388e2 ("fou, fou6: avoid uninit-value in gue_err() and gue6_err()"). Use pskb_may_pull() instead of checking skb->len, and take into account the fact we later access the VXLAN header with udp_hdr(), so we also need to sum skb_transport_header() here. Reported-by: Guillaume Nault Fixes: c3a43b9fec8a ("vxlan: ICMP error lookup handler") Signed-off-by: Stefano Brivio Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1765,7 +1765,7 @@ static int vxlan_err_lookup(struct sock struct vxlanhdr *hdr; __be32 vni; - if (skb->len < VXLAN_HLEN) + if (!pskb_may_pull(skb, skb_transport_offset(skb) + VXLAN_HLEN)) return -EINVAL; hdr = vxlan_hdr(skb);