From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E45AAC43613 for ; Thu, 20 Jun 2019 18:14:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6A22215EA for ; Thu, 20 Jun 2019 18:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054499; bh=YR5qsibLBz6MkHT9JmmO8QWMeEftMZt6WOL/PZ8HGjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Dj8JASUAEsUEeaxdLA77kgqFSGS9it/XN0PQr7f2rXiO6G340puJMyYmzu4uylNz4 NfAHt3844Zj8YQJnXhpaOV/dokkoN7rHlzr4VOCzQLM2ulBeTqOogGM4zaX/BgJhOO rvdWjCN2kvQLbfbav7Z2agvO53C3bTp7scsix738= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbfFTSO6 (ORCPT ); Thu, 20 Jun 2019 14:14:58 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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);