Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3646213ima; Mon, 4 Feb 2019 02:44:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IYy909qfWM9TmNCsxHi0Z/IFetoqeJcUJskH3FqVLyI8RCLRXcR8w5yPjMzpTj5z2IwcXrK X-Received: by 2002:a63:4819:: with SMTP id v25mr12387492pga.308.1549277090662; Mon, 04 Feb 2019 02:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549277090; cv=none; d=google.com; s=arc-20160816; b=uGuVwHKsAwd+7sj5QWSnjHPSqcVpSW+oSC7FpPqBWKS9vKc6pFRSHe+TgYCjhhFAdn /hjJLMhpHu13U3rzQ+6gp5NSNtdOYIvngHeTIHUnP+Nh5pPl3riiA0UwizFbvQMjOFv1 +LxP8JW3RgbfIhVOmEVUqyjmh96LAL3uXBy9+S4gmBVyqfhxgKHnp3Rwm316oNMUoWu6 FXCn0KAZaG7aNOh5k3fSZQHlYcUakWrpyjc9QO8BXyp8Oxi4XHU0tobkwzsXCZGNYmW3 Yc0r0PgKTBeoGhtyEHlkKoeVI50wbWdgurc0QZ/nOV5ANQae7LDh5n2Wmb21TIk2US1r RhGg== 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=f6ep/gexVkONWhDENcP9flbNiIXOp/OTNki8MAoePsA=; b=nJn1kvOh0qOPPGEXigv0UY5z6ji3wxBILhvbFVwpSPcw1DR+mhYK8aiCshLEjcwEVZ 1Hy3YyN5HVO4y3gPyuQcgO+XyD/K+2BOHBTlr81Z7G015Gj2C/j5UwtleHSmZWLfzFaV QkCQrasprKGK/XHZkdriK8N99OhiQzx3rtwPLiAl9GvA715OMi48AWogq8ETPyG8I8PV SrAy6RLKZcMH/wQ+FIUrpAs3DMczeuWO88BY2i/u+xPmZwVHItYNmrVPdLWD7gUzb5cL 5iLSH+S3nqTxQ9917nQWtiOQCFR6rNOeVJcT2cWP1G26RLTBoyjpDCTCRsv+pSVUtmkE eUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BU03w/Kd"; 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 y20si4233885plr.106.2019.02.04.02.44.35; Mon, 04 Feb 2019 02:44:50 -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="BU03w/Kd"; 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 S1730777AbfBDKng (ORCPT + 99 others); Mon, 4 Feb 2019 05:43:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:41384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730755AbfBDKnd (ORCPT ); Mon, 4 Feb 2019 05:43:33 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 68B922070C; Mon, 4 Feb 2019 10:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549277012; bh=9YErLF5KAN463XQ8tSNDfo8rg7o5mRh1tn0GCyp8/b8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BU03w/Kdwuzcm15jj4D9kpqnh13DRseTiqKM8yl/q1Ph1kVzJG/8tv5LPx6SR6rD6 6JgIAVmWAZ6wsi86CD05N6ZU0YcktOMOt14J2nEYuFYmfAN6n1T2wYSFjsnWpvmXUo MIPkNJFlI/qnxHc0JPyaydikntRc2TNfSlL5ez20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Jacob Wen , "David S. Miller" Subject: [PATCH 4.9 04/30] l2tp: copy 4 more bytes to linear part if necessary Date: Mon, 4 Feb 2019 11:36:42 +0100 Message-Id: <20190204103606.260796991@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103605.271746870@linuxfoundation.org> References: <20190204103605.271746870@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Wen [ Upstream commit 91c524708de6207f59dd3512518d8a1c7b434ee3 ] The size of L2TPv2 header with all optional fields is 14 bytes. l2tp_udp_recv_core only moves 10 bytes to the linear part of a skb. This may lead to l2tp_recv_common read data outside of a skb. This patch make sure that there is at least 14 bytes in the linear part of a skb to meet the maximum need of l2tp_udp_recv_core and l2tp_recv_common. The minimum size of both PPP HDLC-like frame and Ethernet frame is larger than 14 bytes, so we are safe to do so. Also remove L2TP_HDR_SIZE_NOSEQ, it is unused now. Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Suggested-by: Guillaume Nault Signed-off-by: Jacob Wen Acked-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/l2tp/l2tp_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -83,8 +83,7 @@ #define L2TP_SLFLAG_S 0x40000000 #define L2TP_SL_SEQ_MASK 0x00ffffff -#define L2TP_HDR_SIZE_SEQ 10 -#define L2TP_HDR_SIZE_NOSEQ 6 +#define L2TP_HDR_SIZE_MAX 14 /* Default trace flags */ #define L2TP_DEFAULT_DEBUG_FLAGS 0 @@ -944,7 +943,7 @@ static int l2tp_udp_recv_core(struct l2t __skb_pull(skb, sizeof(struct udphdr)); /* Short packet? */ - if (!pskb_may_pull(skb, L2TP_HDR_SIZE_SEQ)) { + if (!pskb_may_pull(skb, L2TP_HDR_SIZE_MAX)) { l2tp_info(tunnel, L2TP_MSG_DATA, "%s: recv short packet (len=%d)\n", tunnel->name, skb->len);