[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171112231511.4666-6-linux@rasmusvillemoes.dk>
Date: Mon, 13 Nov 2017 00:15:08 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: "David S. Miller" <davem@...emloft.net>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 5/7] net: core: check dev_valid_name in __dev_alloc_name
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@...musvillemoes.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
Powered by blists - more mailing lists