Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2231081ybi; Thu, 20 Jun 2019 11:16:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEGpRyEZxd0umCPlyPFGKgwkw58skALPBpLPM2Tg3l10uJjH3UG5TsTFjhqoQ4bbcLFiME X-Received: by 2002:a17:90a:36a9:: with SMTP id t38mr990674pjb.19.1561054563024; Thu, 20 Jun 2019 11:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054563; cv=none; d=google.com; s=arc-20160816; b=NXL46HlTTwYw57/4uU8V6UV4hA8Hx2pne68/wD2GJTwa/h7/9OL7sPk2jM8K1FSiUz 1auvZQHORLRI1Bbk5tv9CpX9C7EUYuRwp9Oo0ysrrHjGFCM9DYPr2/YRycMVrldUDQMA KPlbavvE/jqI+CmIY/4LCd3DmI71DT/t6PzUjwRN3c8Dhsm7wChF6L4a9+XEj/os8a5D 4zl6enz6VJYspbS2RamL/wWQMz4cLiRXWuQCTmcW00XIqLYryzQa3FfLnZiX13hzZhjo tJLyZ/ghZVIFXRfJe6/QnMudE4rapBN9E+xQ32UNRDglUtMhvsOF/LDfMwm6Lrxpn09p xhYQ== 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=yzAL4SuHOSByW0dXB/FITGYDeR21oVp0Ru+ry3SDNNk=; b=dTr893Yqox3FqjiSeBuV6bUTSxEe1xM7tqZlmj2N2vBqsHmDWqziF0kodQzn2+IuKT Ow2RXBCYZ0qTS9ZJJ5vDCpSTbRXMMPgAvkjhMuKcsEsCfItcxrnTZ8hmushv9CXNRbtu BK/JM47BxmDCgrwB7LnzigPoWGgMGlfwIJ2H4i5/RUwMelHzCNYfgzBfANs4etUrY/88 ti2wBh1xygIrHqf5LQzStOm1C9SPFDSEg2TRRIhKd7GeXW3Eg7+HLZLlMCMBPlEycQK0 iyz0x0/2T0+MwAN0Kn6oXJ7EpT9u6wDRFjr0CCIBdpCxPrWfuulPcxYOlF2ghsBg2c7P /pFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WLaRj4lJ; 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 99si337706pla.397.2019.06.20.11.15.47; Thu, 20 Jun 2019 11:16:03 -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=WLaRj4lJ; 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 S1729521AbfFTSO7 (ORCPT + 99 others); Thu, 20 Jun 2019 14:14:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:43374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729288AbfFTSOy (ORCPT ); Thu, 20 Jun 2019 14:14: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 3B311205F4; Thu, 20 Jun 2019 18:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054493; bh=YR5qsibLBz6MkHT9JmmO8QWMeEftMZt6WOL/PZ8HGjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLaRj4lJmO/lijU58iQq9HOPVV7TOodXz04dcHJdq6Bocp4zA2lQNwPj0q5kSSKA8 7+0fxFME9oq1rxZ3hGqIjbtk54d/M+cXWWMzLIMuQmUWRgYU3iJ75XsS2tuyCWVv0j UeXvFZHCuK/3fhxnU3IrE+o7deIYpy8m22sHZgjk= 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 18/98] geneve: Dont assume linear buffers in error handler Date: Thu, 20 Jun 2019 19:56:45 +0200 Message-Id: <20190620174350.089480832@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 eccc73a6b2cb6c04bfbc40a0769f3c428dfba232 ] In commit a07966447f39 ("geneve: 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 GENEVE header with udp_hdr(), so we also need to sum skb_transport_header() here. Reported-by: Guillaume Nault Fixes: a07966447f39 ("geneve: ICMP error lookup handler") Signed-off-by: Stefano Brivio Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/geneve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -396,7 +396,7 @@ static int geneve_udp_encap_err_lookup(s u8 zero_vni[3] = { 0 }; u8 *vni = zero_vni; - if (skb->len < GENEVE_BASE_HLEN) + if (!pskb_may_pull(skb, skb_transport_offset(skb) + GENEVE_BASE_HLEN)) return -EINVAL; geneveh = geneve_hdr(skb);