Commit 5fe9c601 authored by John Rutherford's avatar John Rutherford Committed by Kleber Sacilotto de Souza

tipc: fix link name length check

BugLink: https://bugs.launchpad.net/bugs/1855313

[ Upstream commit fd567ac2 ]

In commit 4f07b80c ("tipc: check msg->req data len in
tipc_nl_compat_bearer_disable") the same patch code was copied into
routines: tipc_nl_compat_bearer_disable(),
tipc_nl_compat_link_stat_dump() and tipc_nl_compat_link_reset_stats().
The two link routine occurrences should have been modified to check
the maximum link name length and not bearer name length.

Fixes: 4f07b80c ("tipc: check msg->reg data len in tipc_nl_compat_bearer_disable")
Signed-off-by: default avatarJohn Rutherford <john.rutherford@dektech.com.au>
Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent bcf65a20
...@@ -516,7 +516,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, ...@@ -516,7 +516,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
if (len <= 0) if (len <= 0)
return -EINVAL; return -EINVAL;
len = min_t(int, len, TIPC_MAX_BEARER_NAME); len = min_t(int, len, TIPC_MAX_LINK_NAME);
if (!string_is_valid(name, len)) if (!string_is_valid(name, len))
return -EINVAL; return -EINVAL;
...@@ -791,7 +791,7 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, ...@@ -791,7 +791,7 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
if (len <= 0) if (len <= 0)
return -EINVAL; return -EINVAL;
len = min_t(int, len, TIPC_MAX_BEARER_NAME); len = min_t(int, len, TIPC_MAX_LINK_NAME);
if (!string_is_valid(name, len)) if (!string_is_valid(name, len))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment