Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3512235imu; Mon, 7 Jan 2019 04:52:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9AUCtL43rpIfIZC+3UstaE0jza0JuBQj1Li3YU7RmoAzrGQ/vGw5Ki4pyhKiJTzwVfZbv X-Received: by 2002:a62:2a4b:: with SMTP id q72mr62206411pfq.61.1546865566710; Mon, 07 Jan 2019 04:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865566; cv=none; d=google.com; s=arc-20160816; b=ScoUu8je/0GHALNTfeabU4zC61w/vGSBQvkhzgLIxL5Tf6qxCDfmMAbM9KFUY7YzOW /64IImCjb77o5dz+W1oczMPuK22keLIKfwgh7fUvr83UKZARtS6zZbRQIDu5uWxGJyCI 7V1/F70YNUJ51LgAfyQoqBWWmxaZkd1c6ZAEgyyXOEgrCR/Mnxorp6QuOWZVe5VLbZ7E V4wMr4sw5+rKqFuy11Ynujt92DKOB03sqD8R2ZRJphsKn8+rEJMUk58Q4eehj6UQXOn8 uH2Cc71Ey1Oz3gWDW18K9XDg5W3ThvXLQ4H09s69eEUQhq9fV6GNMX6hN/CnxqpgZ2aC wyTA== 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=b/JkHP3/Zdl0lrhWLhOCzK6MBwzCgI2GRGSzWKVGANI=; b=a4dRphPJeQyCSoTUOBpLGyaHYCxyOWKMb9Brbc1taYGw1Lbs1obHvItDxPT1G4yDIt OWA+KEWnU9SYrKdXlFYlkYLdkAIoqzI7TOswy8iKOWq/vF7wHqqHw9JpWTxOqgZdBXp/ vzaJE9BS3CJgq4SSJGAkkDdfhpWnpUPGmFkpjMVc7MGCv1ObhzAdsTMhs+ro7uNFoBmY bGHR+4qhuJ6MCEMqpS9aGaxiP1KM4dpoq3xjezWkp/VMtyb9vsSua37oeFSjlZ5eJFiX 9Q9oJ9rUtnscbOXbTCtI4QL0H1Mu82EE71WiY7n6ys42xkBJL2T/hooSeaZn4PzHeTk1 celA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o29ZSeaD; 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 q2si9909820plr.204.2019.01.07.04.52.31; Mon, 07 Jan 2019 04:52:46 -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=o29ZSeaD; 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 S1729295AbfAGMtD (ORCPT + 99 others); Mon, 7 Jan 2019 07:49:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:39856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfAGMtB (ORCPT ); Mon, 7 Jan 2019 07:49:01 -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 07B25206BB; Mon, 7 Jan 2019 12:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865340; bh=tLBHRbnTs9BduumBf87Ij+lR8awHDvtbmF+mUkFp5YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o29ZSeaDXzPZ9gNWKhRGgIb1zlSS/o55eqDRkKtgah+Wue9Jp1frcNlawJn9Ezhdp MV45W6S3BpBDaoJiVnt1qZSS0WyS382/oKichbIlAfZlM4GXjsSfCbjQrvnlw3YQvj 6tGrHF0QQfiHDU5ICw7saVB+bZMVj2S36zIAx2Ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Willem de Bruijn , "David S. Miller" Subject: [PATCH 4.19 024/170] packet: validate address length if non-zero Date: Mon, 7 Jan 2019 13:30:51 +0100 Message-Id: <20190107104455.900289673@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Willem de Bruijn [ Upstream commit 6b8d95f1795c42161dc0984b6863e95d6acf24ed ] Validate packet socket address length if a length is given. Zero length is equivalent to not setting an address. Fixes: 99137b7888f4 ("packet: validate address length") Reported-by: Ido Schimmel 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, 2 insertions(+), 2 deletions(-) --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2625,7 +2625,7 @@ static int tpacket_snd(struct packet_soc sll_addr))) goto out; proto = saddr->sll_protocol; - addr = saddr->sll_addr; + addr = saddr->sll_halen ? saddr->sll_addr : NULL; dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); if (addr && dev && saddr->sll_halen < dev->addr_len) goto out; @@ -2825,7 +2825,7 @@ static int packet_snd(struct socket *soc if (msg->msg_namelen < (saddr->sll_halen + offsetof(struct sockaddr_ll, sll_addr))) goto out; proto = saddr->sll_protocol; - addr = saddr->sll_addr; + addr = saddr->sll_halen ? saddr->sll_addr : NULL; dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex); if (addr && dev && saddr->sll_halen < dev->addr_len) goto out;