Received: by 10.192.165.156 with SMTP id m28csp57445imm; Tue, 10 Apr 2018 16:19:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+U9jdXecKnYKcAJwu/OWA8dxAQDW94JBW8eS5IgYIAa2a7MnwfOVQc4A5z+PMjp727bO++ X-Received: by 2002:a17:902:6909:: with SMTP id j9-v6mr2458432plk.92.1523402367394; Tue, 10 Apr 2018 16:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402367; cv=none; d=google.com; s=arc-20160816; b=u2NouFQiSrbZx/OgVBqsfL8SQf2Xvnq/gwVWQ+uign64WIZrguYLo++hzga/Pa3PgP tHSKT/eL7AOnZUQZ6amO4bA4TNCdQsfD09Xi9tNLqw6p4YgE2CIuTnxQre+GD/gA65RO 5vDUwB9nQNY4+CMIgtdo4pYQq5PwnatXNh7cxF/pQPMD+Ks6zyovsr+GZiXrxDrYQcU1 DmoaeLPXMkdQvApjudz+yYXd1U1oCt6pV41DEtEhUmbP2Bc3zF9FdF5X7Kb9v9l23RQ2 2Mrs34dBDQm841tR0HFaFjzeaGi6mMOK67BIsbgnkNXNfmzfla2OUN1Id0P6GO1024jU GLAA== 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=O3PyblxV2gcNo0PNFwK8vwE+/jCWhOk42XOFk5POh2s=; b=QzXbriNARyneuxaRdlXuF4II8oeXaenrKIX5Jj2t0u8dWLOvma6P/kChLwDJNVabGj 0s3G4R4OKVozevWjFWpfW2VUgvOVi32avEi54z6G2rESV95hhPQIemrjOOgA5G+JtyKB rGADD/BaSKN7bfRtW+ecxeyyygRsyccm+Boptc4WEGw7EqZvy/ej5wt9eZ4uqQEVD9H6 FLYD7i452cCUhfy2Gqj9YL9iOUUHAKzv/eJb9+XPFJ5gKGME1MYBKn+8wSWSR/oGAhPP 63i5tKT3j5e4vIpv3ss5xk1l4k01Sk0JjOK0STmwoDP0y5vt2BQL1KsZRJcLTKTVXAMY /LBw== 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 k21-v6si3589703pll.299.2018.04.10.16.18.50; Tue, 10 Apr 2018 16:19:27 -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 S932102AbeDJXNa (ORCPT + 99 others); Tue, 10 Apr 2018 19:13:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40912 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754999AbeDJWcZ (ORCPT ); Tue, 10 Apr 2018 18:32:25 -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 855F4A47; Tue, 10 Apr 2018 22:32:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.15 147/168] ip6_tunnel: better validate user provided tunnel names Date: Wed, 11 Apr 2018 00:24:49 +0200 Message-Id: <20180410212807.340871231@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: Eric Dumazet [ Upstream commit db7a65e3ab78e5b1c4b17c0870ebee35a4ee3257 ] Use valid_name() to make sure user does not provide illegal device name. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_tunnel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -297,13 +297,16 @@ static struct ip6_tnl *ip6_tnl_create(st struct net_device *dev; struct ip6_tnl *t; char name[IFNAMSIZ]; - int err = -ENOMEM; + int err = -E2BIG; - if (p->name[0]) + if (p->name[0]) { + if (!dev_valid_name(p->name)) + goto failed; strlcpy(name, p->name, IFNAMSIZ); - else + } else { sprintf(name, "ip6tnl%%d"); - + } + err = -ENOMEM; dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, ip6_tnl_dev_setup); if (!dev)