mptcp: A few fixes
Subsystems (4)
cover mptcp: A few fixes
This set has three separate changes for the net-next tree:
Patch 1 guarantees safe handling and a warning if a NULL value is encountered when gathering subflow data for the MPTCP_SUBFLOW_ADDRS socket option.
Patch 2 increases the default number of subflows allowed per MPTCP connection.
Patch 3 makes an existing function 'static'.
Mat Martineau (1):
mptcp: Make mptcp_pm_nl_mp_prio_send_ack() static
Paolo Abeni (1):
mptcp: increase default max additional subflows to 2
Tim Gardner (1):
mptcp: Avoid NULL dereference in mptcp_getsockopt_subflow_addrs()
net/mptcp/pm_netlink.c | 9 ++++++--- net/mptcp/protocol.h | 3 --- net/mptcp/sockopt.c | 3 +++ tools/testing/selftests/net/mptcp/mptcp_join.sh | 5 ++++- tools/testing/selftests/net/mptcp/pm_netlink.sh | 6 +++--- 5 files changed, 16 insertions(+), 10 deletions(-)
base-commit: 295711fa8fec42a55623bf6997d05a21d7855132
Signature · 1 line
2.33.1
PATCH 1/3 mptcp: Avoid NULL dereference in mptcp_getsockopt_subflow_addrs()
From: Tim Gardner <[email protected]>
Coverity complains of a possible NULL dereference in mptcp_getsockopt_subflow_addrs():
861 } else if (sk->sk_family == AF_INET6) {
3. returned_null: inet6_sk returns NULL. [show details]
4. var_assigned: Assigning: np = NULL return value from inet6_sk.
862 const struct ipv6_pinfo *np = inet6_sk(sk);
Fix this by checking for NULL.
--- net/mptcp/sockopt.c | 3 +++ 1 file changed, 3 insertions(+)
net/mptcp/sockopt.c +3 -0
@@ -861,6 +861,9 @@ static void mptcp_get_sub_addrs(const struct sock *sk, struct mptcp_subflow_addr }else if (sk->sk_family ==AF_INET6 ) {const struct ipv6_pinfo *np =inet6_sk (sk); +if (WARN_ON_ONCE (!np)) +return ; + a->sin6_local.sin6_family =AF_INET6 ; a->sin6_local.sin6_port = inet->inet_sport;
Signature · 1 line
2.33.1
PATCH 2/3 mptcp: increase default max additional subflows to 2
In reply to Mat MartineauFrom: Paolo Abeni <[email protected]>
The current default does not allowing additional subflows, mostly as a safety restriction to avoid uncontrolled resource consumption on busy servers.
Still the system admin and/or the application have to opt-in to MPTCP explicitly. After that, they need to change (increase) the default maximum number of additional subflows.
Let set that to reasonable default, and make end-users life easier.
Additionally we need to update some self-tests accordingly.
--- net/mptcp/pm_netlink.c | 3 +++ tools/testing/selftests/net/mptcp/mptcp_join.sh | 5 ++++- tools/testing/selftests/net/mptcp/pm_netlink.sh | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-)
net/mptcp/pm_netlink.c +3 -0
@@ -2052,6 +2052,9 @@ static int __net_init pm_nl_init_net(struct net *net)struct pm_nl_pernet *pernet =net_generic (net, pm_nl_pernet_id);INIT_LIST_HEAD_RCU (&pernet->local_addr_list); + +/* Cit. 2 subflows ought to be enough for anybody. */ + pernet->subflows_max =2 ; pernet->next_id =1 ; pernet->stale_loss_cnt =4 ;spin_lock_init (&pernet->lock);
tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -1
@@ -945,12 +945,15 @@ subflows_tests() # subflow limited by client reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 0 + ip netns exec $ns2 ./pm_nl_ctl limits 0 0 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow run_tests $ns1 $ns2 10.0.1.1 chk_join_nr "single subflow, limited by client" 0 0 0 # subflow limited by server reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 0 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow run_tests $ns1 $ns2 10.0.1.1
@@ -973,7 +976,7 @@ subflows_tests() run_tests $ns1 $ns2 10.0.1.1 chk_join_nr "multiple subflows" 2 2 2 - # multiple subflows limited by serverf + # multiple subflows limited by server reset ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ip netns exec $ns2 ./pm_nl_ctl limits 0 2
tools/testing/selftests/net/mptcp/pm_netlink.sh +3 -3
@@ -70,7 +70,7 @@ check() check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "defaults addr list" check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 -subflows 0" "defaults limits" +subflows 2" "defaults limits" ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo
@@ -118,11 +118,11 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs" ip netns exec $ns1 ./pm_nl_ctl limits 9 1 check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 -subflows 0" "rcv addrs above hard limit" +subflows 2" "rcv addrs above hard limit" ip netns exec $ns1 ./pm_nl_ctl limits 1 9 check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 -subflows 0" "subflows above hard limit" +subflows 2" "subflows above hard limit" ip netns exec $ns1 ./pm_nl_ctl limits 8 8 check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8
Signature · 1 line
2.33.1
PATCH 3/3 mptcp: Make mptcp_pm_nl_mp_prio_send_ack() static
In reply to Mat MartineauThis function is only used within pm_netlink.c now.
--- net/mptcp/pm_netlink.c | 6 +++--- net/mptcp/protocol.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-)
net/mptcp/pm_netlink.c +3 -3
@@ -654,9 +654,9 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) } } -int mptcp_pm_nl_mp_prio_send_ack (struct mptcp_sock *msk, -struct mptcp_addr_info *addr, -u8 bkup) +static int mptcp_pm_nl_mp_prio_send_ack (struct mptcp_sock *msk, +struct mptcp_addr_info *addr, +u8 bkup) {struct mptcp_subflow_context *subflow;
net/mptcp/protocol.h +0 -3
@@ -736,9 +736,6 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk);void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,const struct mptcp_rm_list *rm_list);void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup); -int mptcp_pm_nl_mp_prio_send_ack (struct mptcp_sock *msk, -struct mptcp_addr_info *addr, -u8 bkup);void mptcp_pm_mp_fail_received (struct sock *sk,u64 fail_seq);void mptcp_pm_free_anno_list (struct mptcp_sock *msk);bool mptcp_pm_sport_in_anno_list (struct mptcp_sock *msk,const struct sock *sk);
Signature · 1 line
2.33.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 10 lines · On Fri, 15 Oct 2021 16:05:49 -0700 you wrote:
This set has three separate changes for the net-next tree:
Patch 1 guarantees safe handling and a warning if a NULL value is encountered when gathering subflow data for the
MPTCP_SUBFLOW_ADDRSsocket option.Patch 2 increases the default number of subflows allowed per MPTCP connection.
[...]
Here is the summary with links:
- [net-next,1/3] mptcp: Avoid NULL dereference in mptcp_getsockopt_subflow_addrs()
https://git.kernel.org/netdev/net-next/c/29211e7db28a - [net-next,2/3] mptcp: increase default max additional subflows to 2 https://git.kernel.org/netdev/net-next/c/72bcbc46a5c3 - [net-next,3/3] mptcp: Make mptcp_pm_nl_mp_prio_send_ack() static https://git.kernel.org/netdev/net-next/c/3828c514726f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html