diff options
| author | Xin Long <lucien.xin@gmail.com> | 2023-05-14 15:52:29 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-24 17:36:51 +0100 |
| commit | 673cb4798921c0a88c4bbcf6fb7a4691966a611e (patch) | |
| tree | e89a3a4abd8d3da534db39aa7a0b2f927b840df6 /net | |
| parent | 575e84d90a74c0b091b3417ba763ebb237aa0a8c (diff) | |
| download | linux-673cb4798921c0a88c4bbcf6fb7a4691966a611e.tar.gz linux-673cb4798921c0a88c4bbcf6fb7a4691966a611e.tar.bz2 linux-673cb4798921c0a88c4bbcf6fb7a4691966a611e.zip | |
tipc: check the bearer min mtu properly when setting it by netlink
[ Upstream commit 35a089b5d793d2bfd2cc7cfa6104545184de2ce7 ]
Checking the bearer min mtu with tipc_udp_mtu_bad() only works for
IPv4 UDP bearer, and IPv6 UDP bearer has a different value for the
min mtu. This patch checks with encap_hlen + TIPC_MIN_BEARER_MTU
for min mtu, which works for both IPv4 and IPv6 UDP bearer.
Note that tipc_udp_mtu_bad() is still used to check media min mtu
in __tipc_nl_media_set(), as m->mtu currently is only used by the
IPv4 UDP bearer as its default mtu value.
Fixes: 682cd3cf946b ("tipc: confgiure and apply UDP bearer MTU on running links")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/tipc/bearer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 897fc8fc08a0..1048607a1528 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -1151,8 +1151,8 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) return -EINVAL; } #ifdef CONFIG_TIPC_MEDIA_UDP - if (tipc_udp_mtu_bad(nla_get_u32 - (props[TIPC_NLA_PROP_MTU]))) { + if (nla_get_u32(props[TIPC_NLA_PROP_MTU]) < + b->encap_hlen + TIPC_MIN_BEARER_MTU) { NL_SET_ERR_MSG(info->extack, "MTU value is out-of-range"); return -EINVAL; |
