netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] colons are invalid characters in netdev names
@ 2015-02-17 23:15 Matthew Thode
  2015-02-17 23:46 ` Lino Sanfilippo
  2015-02-18  1:28 ` Stephen Hemminger
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Thode @ 2015-02-17 23:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, Matthew Thode

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 <mthode@mthode.org>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] colons are invalid characters in netdev names
  2015-02-17 23:15 [PATCH] colons are invalid characters in netdev names Matthew Thode
@ 2015-02-17 23:46 ` Lino Sanfilippo
  2015-02-17 23:57   ` Matthew Thode
  2015-02-18  1:28 ` Stephen Hemminger
  1 sibling, 1 reply; 6+ messages in thread
From: Lino Sanfilippo @ 2015-02-17 23:46 UTC (permalink / raw)
  To: Matthew Thode, davem; +Cc: netdev, linux-kernel

On 18.02.2015 00:15, Matthew Thode 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 <mthode@mthode.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] colons are invalid characters in netdev names
  2015-02-17 23:46 ` Lino Sanfilippo
@ 2015-02-17 23:57   ` Matthew Thode
  2015-02-18  0:13     ` Lino Sanfilippo
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Thode @ 2015-02-17 23:57 UTC (permalink / raw)
  To: Lino Sanfilippo, davem; +Cc: netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

On 02/17/2015 05:46 PM, Lino Sanfilippo wrote:
> On 18.02.2015 00:15, Matthew Thode 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 <mthode@mthode.org>
>> ---
>>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] colons are invalid characters in netdev names
  2015-02-17 23:57   ` Matthew Thode
@ 2015-02-18  0:13     ` Lino Sanfilippo
  0 siblings, 0 replies; 6+ messages in thread
From: Lino Sanfilippo @ 2015-02-18  0:13 UTC (permalink / raw)
  To: mthode, davem; +Cc: netdev, linux-kernel

On 18.02.2015 00:57, Matthew Thode wrote:

>> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] colons are invalid characters in netdev names
  2015-02-17 23:15 [PATCH] colons are invalid characters in netdev names Matthew Thode
  2015-02-17 23:46 ` Lino Sanfilippo
@ 2015-02-18  1:28 ` Stephen Hemminger
  2015-02-18  1:33   ` Matthew Thode
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2015-02-18  1:28 UTC (permalink / raw)
  To: Matthew Thode; +Cc: davem, netdev, linux-kernel

On Tue, 17 Feb 2015 17:15:42 -0600
Matthew Thode <mthode@mthode.org> 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 <mthode@mthode.org>

What is the exact sequence that causes the problem?
SIOCSIFNAME already strips of colon.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] colons are invalid characters in netdev names
  2015-02-18  1:28 ` Stephen Hemminger
@ 2015-02-18  1:33   ` Matthew Thode
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Thode @ 2015-02-18  1:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: davem, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

On 02/17/2015 07:28 PM, Stephen Hemminger wrote:
> On Tue, 17 Feb 2015 17:15:42 -0600
> Matthew Thode <mthode@mthode.org> 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 <mthode@mthode.org>
> 
> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-18  1:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-17 23:15 [PATCH] colons are invalid characters in netdev names Matthew Thode
2015-02-17 23:46 ` Lino Sanfilippo
2015-02-17 23:57   ` Matthew Thode
2015-02-18  0:13     ` Lino Sanfilippo
2015-02-18  1:28 ` Stephen Hemminger
2015-02-18  1:33   ` Matthew Thode

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).