Received: by 10.192.165.148 with SMTP id m20csp791597imm; Fri, 27 Apr 2018 07:35:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHY3HJE1+ftToEZqjiRsOT8slhDrI2D5h5aampwkVem3FywDivR0C3MARjH9haIoXBS9MM X-Received: by 2002:a17:902:2826:: with SMTP id e35-v6mr2538344plb.348.1524839709611; Fri, 27 Apr 2018 07:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524839709; cv=none; d=google.com; s=arc-20160816; b=OyKcjJtNfGLrEkRqNvVFa38rEDehkGcCOqpmHCYBOr2E9aW6u2xlFK4SUdOaAmAOBT QXvBiw1dOVpQF4zSV1Vf+M7dSC4eMbYYSaTW88xUeOJAksHbx6TjrpH8a+wrWvZZ2013 yOvcy5Se/HZNMzeC67G/jTcuCA2//ZiW2NoAC5L+ATkGP0mAw+xt8ihlCUrvIuqRfgIg YrzuRXI+WZcuzCv856/MejnBDF/gcsS0jeMeB3376Oj0YK+3TRcR6pD2ZWlHx7qOV6uo quyPXGXzgoEBpQzfLp4CAAz5aIN8PyYvRf0H2nW5Yfya/DRpwv/3lCgBA3ufXTdiiueI JReg== 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=SyezYbHQtOCXnKeQNvQXrb3k1L4meu/gkyel2dqRTLo=; b=ql6n2u2QFR0Md0FjxyPAVE7YGiDke0Y6PapJ58BmAQGz5ow657bkGYqZXIMZT2GYQ3 N3IWoZoz2CzC1mrWj7QDMpNizeetDP3TzHUqtXydaRE3EgW5WdkjhzJukVjaX8Sg1RQP EyKSPk7QjjsmSgq3k8MWbCiCMX6MlUcU0h7fimXidr6+Z1hZIeRmEBBnDm7efwG91y+W 06xS90K2K9KtsXE4BfggluO4FGT6YMi0gTybY6oxmyzC1sGlQOAl/JwXiUEcCWyNiPX1 ZiW+YMSBD3XHnbj0AxoFn6+1PLiXNXNePSubgRcy2Yymx1vH2YWAuP0PLM7yw/dZw4nE /pdA== 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 72si1427812pfn.44.2018.04.27.07.34.55; Fri, 27 Apr 2018 07:35:09 -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 S934921AbeD0Ody (ORCPT + 99 others); Fri, 27 Apr 2018 10:33:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:55378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934787AbeD0OKN (ORCPT ); Fri, 27 Apr 2018 10:10:13 -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 8EE4D21864; Fri, 27 Apr 2018 14:10:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EE4D21864 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+4f03bdf92fdf9ef5ddab@syzkaller.appspotmail.com, Guillaume Nault , "David S. Miller" Subject: [PATCH 4.16 22/81] pppoe: check sockaddr length in pppoe_connect() Date: Fri, 27 Apr 2018 15:58:24 +0200 Message-Id: <20180427135744.507904367@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135743.216853156@linuxfoundation.org> References: <20180427135743.216853156@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guillaume Nault [ Upstream commit a49e2f5d5fb141884452ddb428f551b123d436b5 ] We must validate sockaddr_len, otherwise userspace can pass fewer data than we expect and we end up accessing invalid data. Fixes: 224cf5ad14c0 ("ppp: Move the PPP drivers") Reported-by: syzbot+4f03bdf92fdf9ef5ddab@syzkaller.appspotmail.com Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ppp/pppoe.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -620,6 +620,10 @@ static int pppoe_connect(struct socket * lock_sock(sk); error = -EINVAL; + + if (sockaddr_len != sizeof(struct sockaddr_pppox)) + goto end; + if (sp->sa_protocol != PX_PROTO_OE) goto end;