summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-04-05 06:39:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-12 12:32:25 +0200
commit048a64fbc22973d39568a0f569bf2877310f129e (patch)
treea1928c9bf7330c9da44bf7356bb0306479ef545f /net
parent77b9fc371d4d45e330acab7a1065e9f9b41cf58d (diff)
downloadlinux-stable-048a64fbc22973d39568a0f569bf2877310f129e.tar.gz
linux-stable-048a64fbc22973d39568a0f569bf2877310f129e.tar.bz2
linux-stable-048a64fbc22973d39568a0f569bf2877310f129e.zip
net: fool proof dev_valid_name()
[ Upstream commit a9d48205d0aedda021fc3728972a9e9934c2b9de ] 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>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index ef3337bb71a2..4be2a4047640 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1025,7 +1025,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;