From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [PATCH net 6/6] vti6: better validate user provided tunnel names Date: Thu, 5 Apr 2018 06:39:31 -0700 Message-ID: <20180405133931.207634-7-edumazet@google.com> References: <20180405133931.207634-1-edumazet@google.com> Cc: netdev , Steffen Klassert , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:36847 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165AbeDENj6 (ORCPT ); Thu, 5 Apr 2018 09:39:58 -0400 Received: by mail-pl0-f67.google.com with SMTP id 91-v6so19141441pld.3 for ; Thu, 05 Apr 2018 06:39:58 -0700 (PDT) In-Reply-To: <20180405133931.207634-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- net/ipv6/ip6_vti.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 6ebb2e8777f42054ca5ee8338aa560f5501d8262..c214ffec02f06f6dccfb9769fc8640e5e56da618 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -212,10 +212,13 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p 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) -- 2.17.0.484.g0c8726318c-goog