From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "David S. Miller" <davem@davemloft.net>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] net: core: check dev_valid_name in __dev_alloc_name
Date: Mon, 13 Nov 2017 00:15:08 +0100 [thread overview]
Message-ID: <20171112231511.4666-6-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20171112231511.4666-1-linux@rasmusvillemoes.dk>
We currently only exclude non-sysfs-friendly names via
dev_get_valid_name; there doesn't seem to be a reason to allow such
names when we're called via dev_alloc_name.
This does duplicate the dev_valid_name check in the dev_get_valid_name()
case; we'll fix that shortly.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
net/core/dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 14541b7a3195..c0a92cf27566 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1062,6 +1062,9 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
unsigned long *inuse;
struct net_device *d;
+ if (!dev_valid_name(name))
+ return -EINVAL;
+
p = strchr(name, '%');
if (p) {
/*
--
2.11.0
next prev parent reply other threads:[~2017-11-12 23:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-12 23:15 [PATCH 0/7] net: core: devname allocation cleanups Rasmus Villemoes
2017-11-12 23:15 ` [PATCH 1/7] net: core: improve sanity checking in __dev_alloc_name Rasmus Villemoes
2017-11-12 23:15 ` [PATCH 2/7] net: core: move dev_alloc_name_ns a little higher Rasmus Villemoes
2017-11-12 23:15 ` [PATCH 3/7] net: core: eliminate dev_alloc_name{,_ns} code duplication Rasmus Villemoes
2017-11-20 14:26 ` David Laight
2017-11-12 23:15 ` [PATCH 4/7] net: core: drop pointless check in __dev_alloc_name Rasmus Villemoes
2017-11-12 23:15 ` Rasmus Villemoes [this message]
2017-11-12 23:15 ` [PATCH 6/7] net: core: maybe return -EEXIST " Rasmus Villemoes
2017-11-13 0:03 ` Stephen Hemminger
2017-11-12 23:15 ` [PATCH 7/7] net: core: dev_get_valid_name is now the same as dev_alloc_name_ns Rasmus Villemoes
2017-11-13 0:12 ` [PATCH 0/7] net: core: devname allocation cleanups Stephen Hemminger
2017-11-14 7:39 ` David Miller
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=20171112231511.4666-6-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
Powered by JetHome