Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3541115imu; Mon, 7 Jan 2019 05:20:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4QCazxccQmnAD7SMG4GQ2lzBVZToTzu/0w8RFhX/gmMgBWVqHVAykmePGIty6YfTzRg+sf X-Received: by 2002:a63:6984:: with SMTP id e126mr11062520pgc.143.1546867225572; Mon, 07 Jan 2019 05:20:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546867225; cv=none; d=google.com; s=arc-20160816; b=BqAnIWsc20qhhCGMYxvVKIDaINO6Hbd4qm+2xs5Wv1vsvrvqno27yAuzlSMI7aIcKK aIfiM/2RR0d7/lMqP51ByPNzlmdUDXsF41fyzvvVMs2pYGUIhxNQpxJviSyro7/HO+FY apgeIa/Du9EWE3/zq+ZtjzQpcOt58692VG1CdUr+rkHn5LoIAq5nhLDdCufWEF6knDMu rLif8ZxyQgF1EoMm9hp1jP5yIql7pZaigqLBuOlJ6upwR08+D2GZNvmFufX+Rhs6NBIw BiAPHHQNvgLwLsG+PrRCErN2UX58Ocw6GVY6+dQ6oNmLcJxjo+92i6m+BF1GgWRnOpCB YT1w== 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=lJbdQL/jyhHpQyakGC/5ZLrnvM61CVUtkPYK9ZcniDk=; b=ZrSs2EF/TasRD7UacHKd8CLYZNUbE5perZfuuSAlbD73HAufj1NEp8KG9n0qlrSmX6 KxAh2gGdxNwOSUDylJ2YITBgvQ+xhjcARRZF1mN0yckgRPEF4ULBWrumvqLsV/z3b63T krDYl2RLyU0G3l5m1bHuk+5tRSkpTTlhC1faZiQB6mLn/sFDAQi/189aAHTnw4HVnBsu tdJYcoJ6Auuxc/D4KWT7XCgmQyk93wUmGbt0ETqggG8vKLTAlc/hYZlJO4IpCff5DH5B AzzdRDauf3LZxpuYa7WBDxNgBIvxMx6hoBRJ12Ib9eAKQ7uQjLLNXQin9n87kTLq814f CUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VyNB6sx7; 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 g25si11494013pgm.14.2019.01.07.05.20.10; Mon, 07 Jan 2019 05:20:25 -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=VyNB6sx7; 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 S1730693AbfAGNRR (ORCPT + 99 others); Mon, 7 Jan 2019 08:17:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:47714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729932AbfAGNAM (ORCPT ); Mon, 7 Jan 2019 08:00:12 -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 1050D21736; Mon, 7 Jan 2019 13:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866011; bh=pEOJnw15czpLF9eRBh1ucE5zO6rAK71X8Wcb1+UIEJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VyNB6sx7V1bbBZaPuM/yGYYnds+eDvxFKACp0tGBhKAg3XUl69A2wLvdnFD3TtyKJ yMi3ZnTBY2YUvTui20U/KcJ/4up1p30e9p7lws60b+PdgnTTsDxkgw/YLPs7QPv642 gWKS+/4JYf2l3V0j2DVDcJ+5GOXN27146eQOIOrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.14 017/101] packet: validate address length Date: Mon, 7 Jan 2019 13:32:05 +0100 Message-Id: <20190107105333.434936297@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Willem de Bruijn [ Upstream commit 99137b7888f4058087895d035d81c6b2d31015c5 ] Packet sockets with SOCK_DGRAM may pass an address for use in dev_hard_header. Ensure that it is of sufficient length. Reported-by: syzbot Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/packet/af_packet.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2665,6 +2665,8 @@ static int tpacket_snd(struct packet_soc proto = saddr->sll_protocol; addr = saddr->sll_addr; dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); + if (addr && dev && saddr->sll_halen < dev->addr_len) + goto out; } err = -ENXIO; @@ -2863,6 +2865,8 @@ static int packet_snd(struct socket *soc proto = saddr->sll_protocol; addr = saddr->sll_addr; dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex); + if (addr && dev && saddr->sll_halen < dev->addr_len) + goto out; } err = -ENXIO;