Received: by 10.192.165.156 with SMTP id m28csp34445imm; Tue, 10 Apr 2018 15:50:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/slUVWWs6AuDp/ekKnoHHvm20ue4mD8NRMHXlEMfA6ip25+k/hkbM0DcrxNMO+E4c6qUHY X-Received: by 10.98.10.131 with SMTP id 3mr1910325pfk.112.1523400628987; Tue, 10 Apr 2018 15:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400628; cv=none; d=google.com; s=arc-20160816; b=H2+vwFBXNnxWFkc68OgDOB+K5JrMumysMtG9DgHorUvxaBjBKS7jS/lqFH/NMMGtSn K/R024vdyF/7A1Vl6JoDG9cPQ8LM8oJCsTR9juqDVXRsI6EgPGqpZ8lVRA2OzTwtlVme RRF3buQxaZExU3XoNCynOeiE1HTAztvnwptHZ7acD/B+DnRC3dU9B3Rw8X0AzyqtCfYx Xbg8+vizGKdQXF/3YOvEooE+7LX3HU+Ruk4UIT8DTadG8RG+cEaZdTJxQc3qwIL8Rojx F35eNnE0CTQ6DNdUJtBpkQ9vwMy+iO2voNKLNvgBWk4HMJZymsi6rlzxD7Tf5TVeqwim ISVg== 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=lsGYO1jWDmD+Dai+VCdvo65kavR1ky+gc411q7QSHnQ=; b=Dxfde0POGSoZoaes3c8IU4J9uZVqQRZ1+5FJtrGeUox1xjFxvDwwQwLUd5Nq6RXlRQ KV5pa58s9RBpHAq2DjmtUMRUWosHPVpwj/f2AmC/V8oH3u+uONm3re3N+t5OqQWOIbJg mxGDgYePyOK16HnMxwh6qcGLgmW5aLOZ/912Yff3dTtdGYW4n6Xy17LysNKagC9kJ6+A WpV97NhpdWwiFGa9ebA6kq/EBk/P1gNJIgrt/r0EQikLDP2SWNF5k5HhTsQ6hpmbyneH l0lhc362jbF7u1zcW6c0d/1O0LbFeIqL79ToPLpaFSOn9YTbpiu8Eu1fDlH+DSf2/51d YzmA== 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 l12-v6si3530676plc.696.2018.04.10.15.49.52; Tue, 10 Apr 2018 15:50:28 -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 S932559AbeDJWjO (ORCPT + 99 others); Tue, 10 Apr 2018 18:39:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45136 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932546AbeDJWjL (ORCPT ); Tue, 10 Apr 2018 18:39:11 -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 BB6AFD61; Tue, 10 Apr 2018 22:39:10 +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.14 122/138] vti6: better validate user provided tunnel names Date: Wed, 11 Apr 2018 00:25:12 +0200 Message-Id: <20180410212916.363758583@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 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)