Received: by 10.192.165.156 with SMTP id m28csp1099086imm; Wed, 11 Apr 2018 12:23:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/7H2RuWo1votsPdzeI2sX3KcHhSpYaQxUcByivuQQBssSHYQ0xT+6AqAg5d4apeAMrTpr7 X-Received: by 10.99.102.195 with SMTP id a186mr4454801pgc.207.1523474592215; Wed, 11 Apr 2018 12:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523474592; cv=none; d=google.com; s=arc-20160816; b=0zpuvVCmR38pZRUcHN+ux5aUzq2TMNp/DdWLW/Xv2RnE4+vJgZtuBhq9q5txulz+r6 s1lut98fVTzJMCMuyS2/yYxFw6enX539vLSISCAtYukJ8THvCuomX9Q2beiroNcm8K49 2u9Qq5aMsn9wxg3/+Pe5n34A5mXDs8dk5Spv9Ongc4Z6d7iQATozgz/3drPiyoFHNbJf KUHux9udQd1aietrI+fYlT+uJrPVWS6cVvr8JymEtI8V9AE9+1pmJLGBekPg+dsCt0C5 OGVKnN9o1fCJMXt7W/F+PbZuXLut+rPpdV9c8NH5DNjNm4urcS9r4fiFZJXKK59BKJAb h2Eg== 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=mHz+U+D4UhXYEqV8dHLyipvUwfLf5SrmOiolN2tZRLs=; b=jsUBqV7dG5yFiGf8BCtxuL9t+1gdm50yKeHnOGS7damOABYRFgwpsoe27/KkmhOEeN SBRezKY0CdP5qKpSdAuLCwM+Dirodkr0Oy7NGDYvy10qVAh9vtcp7C5s2cENqmyhtESI 2c0Qc32kKPM66aUn91ryo5IPBLVCI76Z+kQKbGoSzltd01q+W8JK7QM6LmFUPFqehrlw LyEjF3k6HWFab5TPxE1uBKcC1VgIEW+n58yUK0LLmVjW8sKRUO/K5KA7+55hz1Ewte16 zysFZlcQY4uRdc4KitZMewL4HqFXSftrcc86ZUenxQt2oYwolDFT15502vky+vTf09NY Tj5Q== 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 b10-v6si1635932plz.464.2018.04.11.12.22.36; Wed, 11 Apr 2018 12:23:12 -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 S1757106AbeDKTO4 (ORCPT + 99 others); Wed, 11 Apr 2018 15:14:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935051AbeDKTFc (ORCPT ); Wed, 11 Apr 2018 15:05:32 -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 3655ECE3; Wed, 11 Apr 2018 19:05:32 +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.9 281/310] netlink: make sure nladdr has correct size in netlink_connect() Date: Wed, 11 Apr 2018 20:37:00 +0200 Message-Id: <20180411183634.706120395@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-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 @@ -1054,6 +1054,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;