Received: by 10.192.165.156 with SMTP id m28csp62136imm; Tue, 10 Apr 2018 16:26:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/eiiFhSCwvv48e1Ep4ZA97nbNk2bZDa+1cuSzsmdCSXgaUxhE6oo9b9F4Q5LiaZzyRh3EO X-Received: by 10.99.107.8 with SMTP id g8mr1667824pgc.271.1523402764261; Tue, 10 Apr 2018 16:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402764; cv=none; d=google.com; s=arc-20160816; b=FcfjFmfbiiN0VtANv/swJHayfrsmMace8z4VhUf75flVW8E9HF1cZEZyaox9zhwX9r OPTy/vkUVp8Sr6w0fXj26OSjYR0VwFOVh2Zftm+INoV2f7iRFDCXDb3rzJPp7kji+OYf 5u7phlTgYn4qzw1x6hmwF8uHVlyNkZVRARdeZcOHjnXNXzu3a4Dq3lczY2sifEEGMKkv ZsQCLoL4/bkE7Vmk8SWSZzhbeOxbJjsCBcoVK3RfU6AzvP8Ck6ckWMEeiIPuWNgRigde 0/UH/y93muqqlLXclL2lWtEAFa5VWCD0iqA3t8uBYwA5ePwvjpgU2qHBkwQRMlxPUvNd 0tAQ== 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 :arc-authentication-results; bh=Na/f6uN8ii6Al/iC2LsWxUILrKAZYdiV5CfWMXfcpJQ=; b=JWXwBs1E12iVr/f1KnSDSTFOSq6P/zy+bJm37KTNlhqhiPUlV+v/1VrO4xpC6VPGBh WPY/JCVfXvLLAuApKM/1H9KKWKg01LFqKNhUvAFM9fCywgo3NJ00He4U4dQvTPkDQE44 T3YrQV/qzs9VgBZSYjs8EGLalmfcTfzmeP+rTPXASgUm5REiC7KK1StU6QnafMV54qAk BwtXcNZFm3uIqVL2C+JA9aaHf8yaLIaEKG6br3tlzBISy7kbuzd1W9BZf1wzsIC6AbZB 096Wb8Os9RdxQJS8ljQ8FTOYKlfWZu1eu7HTo+64sLWHsXnsAlMI9nBJvIuEQHgmDXZN ICkg== 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 64si2447510pgd.737.2018.04.10.16.25.27; Tue, 10 Apr 2018 16:26:04 -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 S1755202AbeDJXRp (ORCPT + 99 others); Tue, 10 Apr 2018 19:17:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40398 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754814AbeDJWbe (ORCPT ); Tue, 10 Apr 2018 18:31:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 48F65DE0; Tue, 10 Apr 2018 22:31:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Potapenko , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.15 128/168] netlink: make sure nladdr has correct size in netlink_connect() Date: Wed, 11 Apr 2018 00:24:30 +0200 Message-Id: <20180410212806.210594032@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Potapenko [ Upstream commit 7880287981b60a6808f39f297bb66936e8bdf57a ] KMSAN reports use of uninitialized memory in the case when |alen| is smaller than sizeof(struct sockaddr_nl), and therefore |nladdr| isn't fully copied from the userspace. Signed-off-by: Alexander Potapenko Fixes: 1da177e4c3f41524 ("Linux-2.6.12-rc2") Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/netlink/af_netlink.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1052,6 +1052,9 @@ static int netlink_connect(struct socket if (addr->sa_family != AF_NETLINK) return -EINVAL; + if (alen < sizeof(struct sockaddr_nl)) + return -EINVAL; + if ((nladdr->nl_groups || nladdr->nl_pid) && !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND)) return -EPERM;