Received: by 10.192.165.148 with SMTP id m20csp850605imm; Fri, 27 Apr 2018 08:30:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqAjLKtKd4Ro5R1KbXF72PsW/WR6Ys4ZVzytVbOLto/s1KsKQmb/14fXhIeifvXXYZS3Wt7 X-Received: by 10.98.242.74 with SMTP id y10mr2624942pfl.75.1524843014074; Fri, 27 Apr 2018 08:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524843014; cv=none; d=google.com; s=arc-20160816; b=FBNo9jF0WlVwijmq2nsV89DnQii8ttPvkaDgNqxNTVb+VzNgizEEg+1o9zqFiUim1g cfundohrEXKqq2+0x9IPPReFNSdi29xzMMfsb2QGTUwJTU3n6dAY6ZYZItXKsoqHV8WP 4ulMCrriFHqgzWzYofu/qN/6NRmWahHwHu9gnF6eRW9xl9t/wm7ZJWRFtM/pWExmbJlb 8Awda4CzmvJlXPs1fRR4zc7nxDYVYVI669PqE7L3xZZfeXfipbS7ygk+nzGrXXUG4aWR 9YuE87vbW7BbkG6p8iqvoH93yhwKB6Ra6Mrp4pzFuo+lBA8vawKTVbvkwb078KChilD1 NGKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=4Gre5QBH/mxIBI5UduMWaL6y1/y4Bx6Pa2ueqoxi4yU=; b=iSC3g0Ij6p+v2rAJOvAJihUxXnRZDY2wm84Lq64yS9woEnzrNIanUSf9dUsrG1J5bC m7Z6zNxrxqu797ZyJquzjOHu2M21wW5yEjuZRMaO4+43sVSWFgj7dgMDgvv7kFnI6Klv Pyzo15bECaNWw4AlQe20z7fM5eACA2V3NoPveVwvxzqaQrPHbXdmqi7boKHWPjtF6glZ zuGxU4OY1SekABoHWa9IVftyhVNH65DgVHnjsHYCzzAY8Cwj7My6qTTUExkZnet5bfN3 tXI7+YPyi1PsXUsEGAThBLERI4Gg+eLcvMJCtmYuoCsiYfm5f5GOXtgmql2xawK4PyTn JnxA== ARC-Authentication-Results: i=1; mx.google.com; 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 u10-v6si1336656pgv.650.2018.04.27.08.30.00; Fri, 27 Apr 2018 08:30:14 -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; 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 S933277AbeD0P2y (ORCPT + 99 others); Fri, 27 Apr 2018 11:28:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:48488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932902AbeD0OBc (ORCPT ); Fri, 27 Apr 2018 10:01:32 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 C4C322185A; Fri, 27 Apr 2018 14:01:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4C322185A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a70ac890b23b1bf29f5c@syzkaller.appspotmail.com, Guillaume Nault , "David S. Miller" Subject: [PATCH 4.4 30/50] l2tp: check sockaddr length in pppol2tp_connect() Date: Fri, 27 Apr 2018 15:58:32 +0200 Message-Id: <20180427135657.477574230@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135655.623669681@linuxfoundation.org> References: <20180427135655.623669681@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guillaume Nault [ Upstream commit eb1c28c05894a4b1f6b56c5bf072205e64cfa280 ] Check sockaddr_len before dereferencing sp->sa_protocol, to ensure that it actually points to valid data. Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Reported-by: syzbot+a70ac890b23b1bf29f5c@syzkaller.appspotmail.com Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/l2tp/l2tp_ppp.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -606,6 +606,13 @@ static int pppol2tp_connect(struct socke lock_sock(sk); error = -EINVAL; + + if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) && + sockaddr_len != sizeof(struct sockaddr_pppol2tpv3) && + sockaddr_len != sizeof(struct sockaddr_pppol2tpin6) && + sockaddr_len != sizeof(struct sockaddr_pppol2tpv3in6)) + goto end; + if (sp->sa_protocol != PX_PROTO_OL2TP) goto end;