]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
tipc: fix link name length check
authorJohn Rutherford <john.rutherford@dektech.com.au>
Tue, 26 Nov 2019 02:52:55 +0000 (13:52 +1100)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 5 Dec 2019 22:30:15 +0000 (16:30 -0600)
BugLink: https://bugs.launchpad.net/bugs/1855326
[ Upstream commit fd567ac20cb0377ff466d3337e6e9ac5d0cb15e4 ]

In commit 4f07b80c9733 ("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: 4f07b80c9733 ("tipc: check msg->reg data len in tipc_nl_compat_bearer_disable")
Signed-off-by: John Rutherford <john.rutherford@dektech.com.au>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
net/tipc/netlink_compat.c

index e135d4e11231995c952d4adbe69d7b42a63adc27..d4d2928424e2f0550fc2f63fb93c7b9458519fec 100644 (file)
@@ -550,7 +550,7 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
        if (len <= 0)
                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))
                return -EINVAL;
 
@@ -822,7 +822,7 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
        if (len <= 0)
                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))
                return -EINVAL;