diff options
author | Eric Dumazet <edumazet@google.com> | 2018-04-05 15:39:26 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-05 21:16:15 +0200 |
commit | a9d48205d0aedda021fc3728972a9e9934c2b9de (patch) | |
tree | ce46b423aca75ded37bd178fa505270dd6454e42 | |
parent | Merge tag 'char-misc-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff) | |
download | linux-a9d48205d0aedda021fc3728972a9e9934c2b9de.tar.xz linux-a9d48205d0aedda021fc3728972a9e9934c2b9de.zip |
net: fool proof dev_valid_name()
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>
-rw-r--r-- | net/core/dev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 9b04a9fd1dfd..969462ebb296 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1027,7 +1027,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; |