aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/netlink_compat.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-07-08 12:04:41 -0400
committerIngo Molnar <mingo@kernel.org>2019-07-08 12:04:41 -0400
commit552a031ba12a4236be107a5b082a399237758a5d (patch)
treea2bcdeb651b360013dbb654bbcd61dbaf51e0331 /net/tipc/netlink_compat.c
parentf584dd32edc5d4400d7ceb92111a89f0c1f6651f (diff)
parent0ecfebd2b52404ae0c54a878c872bb93363ada36 (diff)
Merge tag 'v5.2' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/tipc/netlink_compat.c')
-rw-r--r--net/tipc/netlink_compat.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index c6a04c09d075..cf155061c472 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd,
445 if (!bearer) 445 if (!bearer)
446 return -EMSGSIZE; 446 return -EMSGSIZE;
447 447
448 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME); 448 len = TLV_GET_DATA_LEN(msg->req);
449 if (len <= 0)
450 return -EINVAL;
451
452 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
449 if (!string_is_valid(name, len)) 453 if (!string_is_valid(name, len))
450 return -EINVAL; 454 return -EINVAL;
451 455
@@ -539,7 +543,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
539 543
540 name = (char *)TLV_DATA(msg->req); 544 name = (char *)TLV_DATA(msg->req);
541 545
542 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); 546 len = TLV_GET_DATA_LEN(msg->req);
547 if (len <= 0)
548 return -EINVAL;
549
550 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
543 if (!string_is_valid(name, len)) 551 if (!string_is_valid(name, len))
544 return -EINVAL; 552 return -EINVAL;
545 553
@@ -817,7 +825,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
817 if (!link) 825 if (!link)
818 return -EMSGSIZE; 826 return -EMSGSIZE;
819 827
820 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); 828 len = TLV_GET_DATA_LEN(msg->req);
829 if (len <= 0)
830 return -EINVAL;
831
832 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
821 if (!string_is_valid(name, len)) 833 if (!string_is_valid(name, len))
822 return -EINVAL; 834 return -EINVAL;
823 835