netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Eric Dumazet <edumazet@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net 6/6] vti6: better validate user provided tunnel names
Date: Thu,  5 Apr 2018 06:39:31 -0700	[thread overview]
Message-ID: <20180405133931.207634-7-edumazet@google.com> (raw)
In-Reply-To: <20180405133931.207634-1-edumazet@google.com>

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 <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
 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

  parent reply	other threads:[~2018-04-05 13:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 13:39 [PATCH net 0/6] net: better validate user provided tunnel names Eric Dumazet
2018-04-05 13:39 ` [PATCH net 1/6] net: fool proof dev_valid_name() Eric Dumazet
2018-04-05 13:39 ` [PATCH net 2/6] ip_tunnel: better validate user provided tunnel names Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 3/6] ipv6: sit: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 4/6] ip6_gre: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-05 13:39 ` [PATCH net 5/6] ip6_tunnel: " Eric Dumazet
2018-04-09  3:37   ` Sasha Levin
2018-04-05 13:39 ` Eric Dumazet [this message]
2018-04-09  3:37   ` [PATCH net 6/6] vti6: " Sasha Levin
2018-04-05 19:21 ` [PATCH net 0/6] net: " David Miller
2018-04-05 19:40   ` Eric Dumazet
2018-04-09  3:37 ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180405133931.207634-7-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).