lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201005192005.49459.opurdila@ixiacom.com>
Date:	Wed, 19 May 2010 20:05:49 +0300
From:	Octavian Purdila <opurdila@...acom.com>
To:	Daniel Lezcano <daniel.lezcano@...e.fr>
Cc:	Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: dev_get_valid_name buggy with hash collision

On Tuesday 18 May 2010 17:55:36 you wrote:

> >>         if (!dev_valid_name(name))
> >>                 return -EINVAL;
> >>
> >>         if (fmt&&  strchr(name, '%'))
> >> -               return __dev_alloc_name(net, name, buf);
> >> +               return dev_alloc_name(dev, name);
> >>         else if (__dev_get_by_name(net, name))
> >>                 return -EEXIST;
> >> -       else if (buf != name)
> >> -               strlcpy(buf, name, IFNAMSIZ);
> >> +       else if (strncmp(dev->name, name, IFNAMSIZ))
> >> +                strlcpy(dev->name, name, IFNAMSIZ);
> >
> > Why do the strncmp, can't we preserve the (buf != name) condition
> 
> The 'buf' parameter is no longer passed to the function. We have the
> 'dev'  and the 'newname' parameters.
> The pointer test was just to check 'dev_get_valid_name' was called from
> the 'register_netdevice' function context with 'dev_get_valid_name(net,
> dev->name, dev->name, 0)'. Comparing the strings is valid in this case.
> 
> Otherwise dev_get_valid_name is called from:
> 
>   *  "dev_change_net_namespace" with "dev%d" or "ifname" specified
> within the netlink message. Both are different pointers, the first will
> fall in the "if (fmt && strchr(name, '%'))".
> 
>   * "dev_change_name", where the pointers are different and the strings
> are different.
> 

True, but we why not use "if (dev->name !=name)" instead of strncmp? It should 
yield the same results and it is lighter then full strncmp.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ