mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
net: fool proof dev_valid_name()
[ Upstream commit a9d48205d0 ]
We want to use dev_valid_name() to validate tunnel names,
so better use strnlen(name, IFNAMSIZ) than strlen(name) to make
sure to not upset KASAN.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
359d6e3578
commit
0d1c057dd6
@@ -993,7 +993,7 @@ bool dev_valid_name(const char *name)
|
||||
{
|
||||
if (*name == '\0')
|
||||
return false;
|
||||
if (strlen(name) >= IFNAMSIZ)
|
||||
if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
|
||||
return false;
|
||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user