Received: by 10.192.165.156 with SMTP id m28csp1093596imm; Wed, 11 Apr 2018 12:17:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Ysdcm+VkPuEJCUC1UiQQ588sqf8Kuqc+wRQPcQZxksyTga4BNDKZe7Rv4QWxKTyldR2GX X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr6583658pld.104.1523474220592; Wed, 11 Apr 2018 12:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523474220; cv=none; d=google.com; s=arc-20160816; b=b32Equ1moLvk9qIH4ldeL3FO3P+ekaiTbbkOkSGFzt2K3aNF3O2YPXgo9UTM2GgkIr jO7+U6mbjSHHNmtIcgwtJKNX/CoRX6joxOzJoFy685Txz8qoYanag/Vup1KbRwpJshvP ATV8RnS7I/95X1kS6dkjqSDb0l7IalKv2d+8dm3C5UsMUCDt+Z85KQW0xSzDU4y4nb6F gVKgITQWtAc8JZPEp0y228KHsJcso0IdkOOkosAXsMZEy5kb1bgTXna+YOcofDhONblS 80smwMtFAFFjrpDaiBJHSFFcseJ/ZcfTQWdo4LagsieCySLRQjbmsHI7oaqfxCUGMFDS Sgyg== 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=gY4RmNMDzUcJ+Zq19KYX5iymprkS5NXIMK2qp6FScLE=; b=JScr/w6cwSGMjk9fRlFbm2ntgiA07VjAa6zgryku0qiJRcU6yxAMA9EG91DY7eFb0H 6m8I9ouKGV011l1jsMCIVHn0oplw6rKtxo5oiteu9jMf5Um4CS/Vk6xkQkARuR9xIsQs 3/FJm8wtGqzJeRYssjndCo2qGgnyM5weugrBEKWPv123z/lbNX+NxaPypxegk0XXtW4o 3tvRU8tLkBFQttOfucRuCFKpxk3e+PYKjBRbpXMXve2KPjZyAQuYgEKj8LfvPGy5sZ/Z UrW2VTtutPTAl65xtnneY7stcg3wzRL4ayPY1N00PXZbVcTeKsm5SedyBF97W/x4GqkG ELlQ== 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 v85si1094026pgb.739.2018.04.11.12.16.24; Wed, 11 Apr 2018 12:17:00 -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 S1753821AbeDKTMM (ORCPT + 99 others); Wed, 11 Apr 2018 15:12:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40732 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935165AbeDKTGO (ORCPT ); Wed, 11 Apr 2018 15:06:14 -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 2F466BAC; Wed, 11 Apr 2018 19:06:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Steffen Klassert , "David S. Miller" Subject: [PATCH 4.9 298/310] vti6: better validate user provided tunnel names Date: Wed, 11 Apr 2018 20:37:17 +0200 Message-Id: <20180411183635.391684630@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: Eric Dumazet [ Upstream commit 537b361fbcbcc3cd6fe2bb47069fd292b9256d16 ] Use valid_name() to make sure user does not provide illegal device name. Fixes: ed1efb2aefbb ("ipv6: Add support for IPsec virtual tunnel interfaces") Signed-off-by: Eric Dumazet Cc: Steffen Klassert Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_vti.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -212,10 +212,13 @@ static struct ip6_tnl *vti6_tnl_create(s char name[IFNAMSIZ]; int err; - 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, "ip6_vti%%d"); + } dev = alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, vti6_dev_setup); if (!dev)