Received: by 10.192.165.156 with SMTP id m28csp34790imm; Tue, 10 Apr 2018 15:50:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/gXTx4PxhD/bEOVEqyPw/szsm6P40+Bz0BiRCaizTmst2Dj4/mu1qimYVlA1Ga+jFn9xAO X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr2345990pln.40.1523400653901; Tue, 10 Apr 2018 15:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400653; cv=none; d=google.com; s=arc-20160816; b=RWV0apKCwryw3f6AOg2dmweSujZpYiYOJ5mZHzD0plh0XkXFvtSSDNQLw3H/nWjCF6 2jDWh81pkb2/Cu1K2EIo9sTB112UsYRjCOYHu1Umsw5CU42NbL+Xo5rKkOMuULmJ9Gco xlZpmyXJ8EvrU2im7engdhE1prSOVKgEj3PMKo33HAnmFu+I7n3vagtnpSTC+qcWowEj JGOKEzsg2k/vEZhfE9mLieZ47fItVIVC5p7m2u4X+n61fIMLxOpFE5eJs4qWVLA5vtjT qRsTTZTpdxgB4WK1FeP2E0eHCT4w4ncASwg7KpcaDacfHUZz6gYgg+Elfn7kuhwOXRN0 s3Xg== 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=fZ7VWn7KO7U3UeuuOlojxhtaEXP2fXwM7qS18TNcS1Y=; b=Vcgb2y9RhxAt5l33YrttamEjVEPOHkgyxbohllaLkxfHBZ3KKJyKW4Vd530r3S0hga m8+WG/4RT6RV/n3UKXJ9lbeBhHNDurCGpK55lJ0iSNlq1KNk/3c0kic3/FEwJDq16oxd I49kdjM3iRU0yfLFBHPfS+L9fyFolN+KdImgwIDJGwD+ljVfLomp6NRoMV4gPgL9HMEA qTeqQ36US55OZl9DvAG6+yQU3/WN6d1VrsMfNPp+5gqOsoraaPOkqarzGDVgoerCCGTi Ow5LDdfu5d4baoOfuHBqgV94QlXJHEeVJtjn4JL+0VsmReSlEsygeri7/ASFMpWnYtTY JyWQ== 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 c23-v6si3464286plo.80.2018.04.10.15.50.17; Tue, 10 Apr 2018 15:50:53 -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 S932547AbeDJWjL (ORCPT + 99 others); Tue, 10 Apr 2018 18:39:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45096 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932510AbeDJWjI (ORCPT ); Tue, 10 Apr 2018 18:39:08 -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 8497AD0D; Tue, 10 Apr 2018 22:39:07 +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.14 121/138] ip6_tunnel: better validate user provided tunnel names Date: Wed, 11 Apr 2018 00:25:11 +0200 Message-Id: <20180410212916.268036160@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: 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)