Received: by 10.192.165.156 with SMTP id m28csp80112imm; Tue, 10 Apr 2018 16:52:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Oy7kdeSHT4AWsHguqtHK4aboH73pmITD1T/g2QmrtzV8IIUxQ/ZHOtrjAp4uIrbZalPyc X-Received: by 10.101.101.136 with SMTP id u8mr1737166pgv.333.1523404375959; Tue, 10 Apr 2018 16:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523404375; cv=none; d=google.com; s=arc-20160816; b=C/vVTGL9z1jqmy3jT/jV7b+Yso7jN8NR2pKE/UOT/+RTnJ+ONyUz9No8MH/xmcPQXX CA4Beg1F8IPFuHqah00z2rCbI6SLwuKwtRfwsnFYM7QGq1getI2NMGnlQHkxBerrthls wN0V7jz6We2JAqNuXUlk7FNqnhYg/I3gg637mLXxbfbz8yKPTPBfpbFFIDGQ46tmwtgV 9vLrlheVdyM5ICwj18aBYtREeZFiQi9cPcWh3THK0unchwAvAlG7qAe/l2oy2QOyznU4 N+80oYZUB4LNPzePR1b6ZfOd+Wm2p5JrhGxbCRW1gw9Pi8TV0E08YcC1/eXAW7iW3URE Jbhw== 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=4Cz7Ze6YbUW5TFBA9do3olmTZ/E2MkUmynO1AEk/eMs=; b=wWT3F3aBOUbrnyAWxjCpK21c4l50Dxa9FUH5vNaB7L7yJb506NqgBEX2B3nX8SGBqr 3bHxcPxU6Cjof07I4vRQzaX2sc9FhkCARPDj5IlThjcY/OQ7Fn2xTAR76JNOgebyQYin YlQy/FMjfBmH15uTK3j0GeRl86QHeAD1lIuCn/vwJ/NEwlplgMujG39cIbWJsjN2x7Gm dKSCrNwZl4O32HL9MtBaeGZRoD2DTMiAI+RCB2WWyKAmyFjkM02q0AMr1/3DaSyFuBlk f/lXrq36XvASBfr2PMxV3sY8qkE7JQV9PYpTeXaf30xaA2AWzB9nKAYSKOofmhz2ItGh rgzA== 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 k65si2335425pgc.329.2018.04.10.16.52.18; Tue, 10 Apr 2018 16:52:55 -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 S1753580AbeDJXqP (ORCPT + 99 others); Tue, 10 Apr 2018 19:46:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36746 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbeDJWY2 (ORCPT ); Tue, 10 Apr 2018 18:24:28 -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 EB163CFC; Tue, 10 Apr 2018 22:24:27 +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.16 16/18] vti6: better validate user provided tunnel names Date: Wed, 11 Apr 2018 00:23:51 +0200 Message-Id: <20180410212759.435007511@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212758.564682823@linuxfoundation.org> References: <20180410212758.564682823@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.16-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)