[PATCH] colons are invalid characters in netdev names

Subsystems: networking [general], the rest

STALE4266d

6 messages, 3 authors, 2015-02-18 · open the first message on its own page

[PATCH] colons are invalid characters in netdev names

From: Matthew Thode <hidden>
Date: 2015-02-17 23:22:20

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <redacted>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index d030575..e9b6d5a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {
-- 
2.0.5

Re: [PATCH] colons are invalid characters in netdev names

From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Date: 2015-02-17 23:46:17

On 18.02.2015 00:15, Matthew Thode wrote:
quoted hunk
colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <redacted>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index d030575..e9b6d5a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {
Hi,

that check should be done in the loop below, shouldn't it?

Regards,
Lino

Re: [PATCH] colons are invalid characters in netdev names

From: Matthew Thode <hidden>
Date: 2015-02-17 23:57:22

On 02/17/2015 05:46 PM, Lino Sanfilippo wrote:
On 18.02.2015 00:15, Matthew Thode wrote:
quoted
colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <redacted>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index d030575..e9b6d5a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {
Hi,

that check should be done in the loop below, shouldn't it?

Regards,
Lino
You are correct,  should I resend a patch.  Not really sure the
procedure of updating a patchset sent to the ML.

-- 
Matthew Thode

Re: [PATCH] colons are invalid characters in netdev names

From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Date: 2015-02-18 00:13:44

On 18.02.2015 00:57, Matthew Thode wrote:
quoted
You are correct,  should I resend a patch.  Not really sure the
procedure of updating a patchset sent to the ML.
You could resend as [PATCH v2] to indicate that it is an updated
version. But you should also try to improve the patch subject line and
description, e.g. by writing it in the imperative. See
"SubmittingPatches" in the Documents folder of the kernel (or take a
look at other patches).

Regards,
Lino

Re: [PATCH] colons are invalid characters in netdev names

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2015-02-18 01:28:10

On Tue, 17 Feb 2015 17:15:42 -0600
Matthew Thode [off-list ref] wrote:
colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <redacted>
What is the exact sequence that causes the problem?
SIOCSIFNAME already strips of colon.

Re: [PATCH] colons are invalid characters in netdev names

From: Matthew Thode <hidden>
Date: 2015-02-18 01:33:38

On 02/17/2015 07:28 PM, Stephen Hemminger wrote:
On Tue, 17 Feb 2015 17:15:42 -0600
Matthew Thode [off-list ref] wrote:
quoted
colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <redacted>
What is the exact sequence that causes the problem?
SIOCSIFNAME already strips of colon.
It strips the name one access, not creation.  You can create a dummy
device and not access it, escaping doesn't seem to help.

ip link add name foo:asdasd type dummy
ip link del dev foo:asdasd              # will not be deleted

-- 
Matthew Thode
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help