aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/netlink_compat.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 4ad3586da8f0..5f8e53cca222 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -397,7 +397,12 @@ static int tipc_nl_compat_bearer_enable(struct tipc_nl_compat_cmd_doit *cmd,
397 if (!bearer) 397 if (!bearer)
398 return -EMSGSIZE; 398 return -EMSGSIZE;
399 399
400 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME); 400 len = TLV_GET_DATA_LEN(msg->req);
401 len -= offsetof(struct tipc_bearer_config, name);
402 if (len <= 0)
403 return -EINVAL;
404
405 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
401 if (!string_is_valid(b->name, len)) 406 if (!string_is_valid(b->name, len))
402 return -EINVAL; 407 return -EINVAL;
403 408