Received: by 10.192.165.156 with SMTP id m28csp38104imm; Tue, 10 Apr 2018 15:55:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+w+F6am6ymnZm6bb/otkvD0u4IHZvuQ51bSD9vMi89GcpnfVTjHifGFRn9cowdpx6X0fTx X-Received: by 2002:a17:902:1025:: with SMTP id b34-v6mr2313398pla.324.1523400941745; Tue, 10 Apr 2018 15:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400941; cv=none; d=google.com; s=arc-20160816; b=eu8KOeor0f1xjsqd8to9e5JTH3afmGmcM8qyYk4TFOvCC4jhpcO21a0GZoAkkDic4W DwttakcaBqmLqqTc64pSj9XkMmNX7+DJJIkMl5JxBRf7Fh4UNviY5rOqw+u5hGlBVZfP 9+6A3xHWMHGuV3/wIZ/+7Tot53CoOoOHB25efR1leZfgwAh+ITu2r4MkQZBGIziLaNJu /9BBamKqEf0MUQ2gpKx7wg8UEZgJ3eL+YGVprlxDCwTFbaFLWXnoOmkQ27LJBzQBNrNX XyBYO9JlOdnSkXuFw2LwRhnWHbioASyYPE3Yo2z4nfp/rfo8vi1+SPrGNyfkVmWJdEuo BnMQ== 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=HryqammWS/7SLFkOhwjYb+eyV0BNED21zX4dUE70vy0=; b=uAW2LdKSB+oddyvQXOLcCfyWc024veUVYrSxYCciA69zjpSFvAhpYR93n7pxKem8NE w7jg3OFXElDTT55Xo6oSrzb7SssJmsFuW86yIrcdSLXFyTHPzP4uVMjh1kd4Yn9CwuUj yhLlq2HwH2lr+N0ix7EbqCcVO1IIu7vyaXyPooGS1nTAWjKQKo0oR4kFf6Y0VEqtyz9r MINEMd21ry/m/FP+PpgLNonRYD8Fz12EU+7DCYb+llrNzwYFDsJGAwHkJSQ4opVeXA6M obYGWAKH29ZNw8Ic+6qxMR9EwbBxp9XvUYOv+i8WfK4OlBoE33zEzM7v+f5G9SZrJjQA WjYQ== 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 j9si2425699pgp.373.2018.04.10.15.55.04; Tue, 10 Apr 2018 15:55:41 -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 S1755951AbeDJWiV (ORCPT + 99 others); Tue, 10 Apr 2018 18:38:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44738 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755900AbeDJWiR (ORCPT ); Tue, 10 Apr 2018 18:38:17 -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 D2D24D29; Tue, 10 Apr 2018 22:38:16 +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.14 103/138] netlink: make sure nladdr has correct size in netlink_connect() Date: Wed, 11 Apr 2018 00:24:53 +0200 Message-Id: <20180410212914.154737115@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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 @@ -1053,6 +1053,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;