From: Eric Dumazet Date: Thu, 5 Apr 2018 13:39:26 +0000 (-0700) Subject: net: fool proof dev_valid_name() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=048a64fbc22973d39568a0f569bf2877310f129e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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;