Skip to content

Commit f377efa

Browse files
Eric Dumazetgregkh
Eric Dumazet
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8666081 commit f377efa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/dev.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ bool dev_valid_name(const char *name)
937937
{
938938
if (*name == '\0')
939939
return false;
940-
if (strlen(name) >= IFNAMSIZ)
940+
if (strnlen(name, IFNAMSIZ) == IFNAMSIZ)
941941
return false;
942942
if (!strcmp(name, ".") || !strcmp(name, ".."))
943943
return false;

0 commit comments

Comments
 (0)